OLD | NEW |
1 ; Trivial smoke test of bitcast between integer and FP types. | 1 ; Trivial smoke test of bitcast between integer and FP types. |
2 | 2 |
3 ; RUN: %p2i -i %s --args -O2 --verbose none \ | 3 ; RUN: %p2i --assemble --disassemble -i %s --args -O2 --verbose none \ |
4 ; RUN: | llvm-mc -triple=i686-none-nacl -filetype=obj \ | 4 ; RUN: | FileCheck %s |
5 ; RUN: | llvm-objdump -d --symbolize -x86-asm-syntax=intel - | FileCheck %s | 5 ; RUN: %p2i --assemble --disassemble -i %s --args -Om1 --verbose none \ |
6 ; RUN: %p2i -i %s --args -Om1 --verbose none \ | 6 ; RUN: | FileCheck %s |
7 ; RUN: | llvm-mc -triple=i686-none-nacl -filetype=obj \ | |
8 ; RUN: | llvm-objdump -d --symbolize -x86-asm-syntax=intel - | FileCheck %s | |
9 | 7 |
10 define internal i32 @cast_f2i(float %f) { | 8 define internal i32 @cast_f2i(float %f) { |
11 entry: | 9 entry: |
12 %v0 = bitcast float %f to i32 | 10 %v0 = bitcast float %f to i32 |
13 ret i32 %v0 | 11 ret i32 %v0 |
14 } | 12 } |
15 ; CHECK-LABEL: cast_f2i | 13 ; CHECK-LABEL: cast_f2i |
16 ; CHECK: mov eax | 14 ; CHECK: mov eax |
17 ; CHECK: ret | 15 ; CHECK: ret |
18 | 16 |
19 define internal float @cast_i2f(i32 %i) { | 17 define internal float @cast_i2f(i32 %i) { |
20 entry: | 18 entry: |
21 %v0 = bitcast i32 %i to float | 19 %v0 = bitcast i32 %i to float |
22 ret float %v0 | 20 ret float %v0 |
23 } | 21 } |
24 ; CHECK-LABEL: cast_i2f | 22 ; CHECK-LABEL: cast_i2f |
25 ; CHECK: fld dword ptr | 23 ; CHECK: fld DWORD PTR |
26 ; CHECK: ret | 24 ; CHECK: ret |
27 | 25 |
28 define internal i64 @cast_d2ll(double %d) { | 26 define internal i64 @cast_d2ll(double %d) { |
29 entry: | 27 entry: |
30 %v0 = bitcast double %d to i64 | 28 %v0 = bitcast double %d to i64 |
31 ret i64 %v0 | 29 ret i64 %v0 |
32 } | 30 } |
33 ; CHECK-LABEL: cast_d2ll | 31 ; CHECK-LABEL: cast_d2ll |
34 ; CHECK: mov edx | 32 ; CHECK: mov edx |
35 ; CHECK: ret | 33 ; CHECK: ret |
36 | 34 |
37 define internal i64 @cast_d2ll_const() { | 35 define internal i64 @cast_d2ll_const() { |
38 entry: | 36 entry: |
39 %v0 = bitcast double 0x12345678901234 to i64 | 37 %v0 = bitcast double 0x12345678901234 to i64 |
40 ret i64 %v0 | 38 ret i64 %v0 |
41 } | 39 } |
42 ; CHECK-LABEL: cast_d2ll_const | 40 ; CHECK-LABEL: cast_d2ll_const |
43 ; CHECK: movsd xmm{{.*}}, qword ptr | 41 ; CHECK: movsd xmm{{.*}},QWORD PTR |
44 ; CHECK: mov edx | 42 ; CHECK: mov edx |
45 ; CHECK: ret | 43 ; CHECK: ret |
46 | 44 |
47 define internal double @cast_ll2d(i64 %ll) { | 45 define internal double @cast_ll2d(i64 %ll) { |
48 entry: | 46 entry: |
49 %v0 = bitcast i64 %ll to double | 47 %v0 = bitcast i64 %ll to double |
50 ret double %v0 | 48 ret double %v0 |
51 } | 49 } |
52 ; CHECK-LABEL: cast_ll2d | 50 ; CHECK-LABEL: cast_ll2d |
53 ; CHECK: fld qword ptr | 51 ; CHECK: fld QWORD PTR |
54 ; CHECK: ret | 52 ; CHECK: ret |
55 | 53 |
56 define internal double @cast_ll2d_const() { | 54 define internal double @cast_ll2d_const() { |
57 entry: | 55 entry: |
58 %v0 = bitcast i64 12345678901234 to double | 56 %v0 = bitcast i64 12345678901234 to double |
59 ret double %v0 | 57 ret double %v0 |
60 } | 58 } |
61 ; CHECK-LABEL: cast_ll2d_const | 59 ; CHECK-LABEL: cast_ll2d_const |
62 ; CHECK: mov {{.*}}, 1942892530 | 60 ; CHECK: mov {{.*}},0x73ce2ff2 |
63 ; CHECK: mov {{.*}}, 2874 | 61 ; CHECK: mov {{.*}},0xb3a |
64 ; CHECK: fld qword ptr | 62 ; CHECK: fld QWORD PTR |
65 ; CHECK: ret | 63 ; CHECK: ret |
OLD | NEW |