blob: bf846545c9c51c515438c7705d767d406cd2fc67 [file] [log] [blame]
Reid Spencer73e70822006-12-29 20:01:32 +00001; RUN: llvm-upgrade < %s | llvm-as | llc -march=c &&
2; RUN: llvm-upgrade < %s | llvm-as | llc -march=c | \
3; RUN: grep '__BITCAST' | wc -l | grep 14
Reid Spencer711679e2006-12-11 20:40:28 +00004
5int %test1(float %F) {
6 %X = bitcast float %F to int
7 ret int %X
8}
9
10float %test2(int %I) {
11 %X = bitcast int %I to float
12 ret float %X
13}
14
15long %test3(double %D) {
16 %X = bitcast double %D to long
17 ret long %X
18}
19
20double %test4(long %L) {
21 %X = bitcast long %L to double
22 ret double %X
23}
24
25double %test5(double %D) {
26 %X = bitcast double %D to double
27 %Y = add double %X, 2.0
28 %Z = bitcast double %Y to long
29 %res = bitcast long %Z to double
30 ret double %res
31}
32
33float %test6(float %F) {
34 %X = bitcast float %F to float
35 %Y = add float %X, 2.0
36 %Z = bitcast float %Y to int
37 %res = bitcast int %Z to float
38 ret float %res
39}
40
41int %main(int %argc, sbyte** %argv) {
42 %a = call int %test1(float 3.1415926)
43 %b = call float %test2(int %a)
44 %c = call long %test3(double 3.1415926)
45 %d = call double %test4(long %c)
46 %e = call double %test5(double 7.0)
47 %f = call float %test6(float 7.0)
48 ret int %a
49}