2006-12-29 20:01:32 +00:00
|
|
|
; RUN: llvm-upgrade < %s | llvm-as | llc -march=c | \
|
2007-08-15 13:36:28 +00:00
|
|
|
; RUN: grep __BITCAST | count 14
|
2006-12-11 20:40:28 +00:00
|
|
|
|
|
|
|
int %test1(float %F) {
|
|
|
|
%X = bitcast float %F to int
|
|
|
|
ret int %X
|
|
|
|
}
|
|
|
|
|
|
|
|
float %test2(int %I) {
|
|
|
|
%X = bitcast int %I to float
|
|
|
|
ret float %X
|
|
|
|
}
|
|
|
|
|
|
|
|
long %test3(double %D) {
|
|
|
|
%X = bitcast double %D to long
|
|
|
|
ret long %X
|
|
|
|
}
|
|
|
|
|
|
|
|
double %test4(long %L) {
|
|
|
|
%X = bitcast long %L to double
|
|
|
|
ret double %X
|
|
|
|
}
|
|
|
|
|
|
|
|
double %test5(double %D) {
|
|
|
|
%X = bitcast double %D to double
|
|
|
|
%Y = add double %X, 2.0
|
|
|
|
%Z = bitcast double %Y to long
|
|
|
|
%res = bitcast long %Z to double
|
|
|
|
ret double %res
|
|
|
|
}
|
|
|
|
|
|
|
|
float %test6(float %F) {
|
|
|
|
%X = bitcast float %F to float
|
|
|
|
%Y = add float %X, 2.0
|
|
|
|
%Z = bitcast float %Y to int
|
|
|
|
%res = bitcast int %Z to float
|
|
|
|
ret float %res
|
|
|
|
}
|
|
|
|
|
|
|
|
int %main(int %argc, sbyte** %argv) {
|
2007-09-05 17:50:36 +00:00
|
|
|
%a = call int %test1(float 0x400921FB40000000)
|
2006-12-11 20:40:28 +00:00
|
|
|
%b = call float %test2(int %a)
|
2007-09-05 17:50:36 +00:00
|
|
|
%c = call long %test3(double 0x400921FB4D12D84A)
|
2006-12-11 20:40:28 +00:00
|
|
|
%d = call double %test4(long %c)
|
|
|
|
%e = call double %test5(double 7.0)
|
|
|
|
%f = call float %test6(float 7.0)
|
|
|
|
ret int %a
|
|
|
|
}
|