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