Reid Spencer | 73e7082 | 2006-12-29 20:01:32 +0000 | [diff] [blame] | 1 | ; RUN: llvm-upgrade < %s | llvm-as | llc -march=c | \ |
Dan Gohman | 28beeea | 2007-08-15 13:36:28 +0000 | [diff] [blame^] | 2 | ; RUN: grep __BITCAST | count 14 |
Reid Spencer | 711679e | 2006-12-11 20:40:28 +0000 | [diff] [blame] | 3 | |
| 4 | int %test1(float %F) { |
| 5 | %X = bitcast float %F to int |
| 6 | ret int %X |
| 7 | } |
| 8 | |
| 9 | float %test2(int %I) { |
| 10 | %X = bitcast int %I to float |
| 11 | ret float %X |
| 12 | } |
| 13 | |
| 14 | long %test3(double %D) { |
| 15 | %X = bitcast double %D to long |
| 16 | ret long %X |
| 17 | } |
| 18 | |
| 19 | double %test4(long %L) { |
| 20 | %X = bitcast long %L to double |
| 21 | ret double %X |
| 22 | } |
| 23 | |
| 24 | double %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 | |
| 32 | float %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 | |
| 40 | int %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 | } |