| 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: %llvm2ice -O2 --verbose none %s | FileCheck %s | 3 ; RUN: %llvm2ice -O2 --verbose none %s | FileCheck %s |
| 4 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s | 4 ; RUN: %llvm2ice --verbose none %s | FileCheck --check-prefix=ERRORS %s |
| 5 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s | 5 ; RUN: %llvm2iceinsts %s | %szdiff %s | FileCheck --check-prefix=DUMP %s |
| 6 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \ | 6 ; RUN: %llvm2iceinsts --pnacl %s | %szdiff %s \ |
| 7 ; RUN: | FileCheck --check-prefix=DUMP %s | 7 ; RUN: | FileCheck --check-prefix=DUMP %s |
| 8 | 8 |
| 9 define internal i32 @cast_f2i(float %f) { | 9 define internal i32 @cast_f2i(float %f) { |
| 10 entry: | 10 entry: |
| 11 %v0 = bitcast float %f to i32 | 11 %v0 = bitcast float %f to i32 |
| 12 ret i32 %v0 | 12 ret i32 %v0 |
| 13 } | 13 } |
| 14 | 14 ; CHECK-LABEL: cast_f2i |
| 15 ; CHECK: mov eax | 15 ; CHECK: mov eax |
| 16 ; CHECK: ret | 16 ; CHECK: ret |
| 17 | 17 |
| 18 define internal float @cast_i2f(i32 %i) { | 18 define internal float @cast_i2f(i32 %i) { |
| 19 entry: | 19 entry: |
| 20 %v0 = bitcast i32 %i to float | 20 %v0 = bitcast i32 %i to float |
| 21 ret float %v0 | 21 ret float %v0 |
| 22 } | 22 } |
| 23 | 23 ; CHECK-LABEL: cast_i2f |
| 24 ; CHECK: fld dword ptr | 24 ; CHECK: fld dword ptr |
| 25 ; CHECK: ret | 25 ; CHECK: ret |
| 26 | 26 |
| 27 define internal i64 @cast_d2ll(double %d) { | 27 define internal i64 @cast_d2ll(double %d) { |
| 28 entry: | 28 entry: |
| 29 %v0 = bitcast double %d to i64 | 29 %v0 = bitcast double %d to i64 |
| 30 ret i64 %v0 | 30 ret i64 %v0 |
| 31 } | 31 } |
| 32 | 32 ; CHECK-LABEL: cast_d2ll |
| 33 ; CHECK: mov edx | 33 ; CHECK: mov edx |
| 34 ; CHECK: ret | 34 ; CHECK: ret |
| 35 | 35 |
| 36 define internal i64 @cast_d2ll_const() { |
| 37 entry: |
| 38 %v0 = bitcast double 0x12345678901234 to i64 |
| 39 ret i64 %v0 |
| 40 } |
| 41 ; CHECK-LABEL: cast_d2ll_const |
| 42 ; CHECK: movsd xmm{{.*}}, {{.*}}L$double |
| 43 ; CHECK: mov edx |
| 44 ; CHECK: ret |
| 45 |
| 36 define internal double @cast_ll2d(i64 %ll) { | 46 define internal double @cast_ll2d(i64 %ll) { |
| 37 entry: | 47 entry: |
| 38 %v0 = bitcast i64 %ll to double | 48 %v0 = bitcast i64 %ll to double |
| 39 ret double %v0 | 49 ret double %v0 |
| 40 } | 50 } |
| 41 | 51 ; CHECK-LABEL: cast_ll2d |
| 42 ; CHECK: fld qword ptr | 52 ; CHECK: fld qword ptr |
| 43 ; CHECK: ret | 53 ; CHECK: ret |
| 44 | 54 |
| 55 define internal double @cast_ll2d_const() { |
| 56 entry: |
| 57 %v0 = bitcast i64 12345678901234 to double |
| 58 ret double %v0 |
| 59 } |
| 60 ; CHECK-LABEL: cast_ll2d_const |
| 61 ; CHECK: mov {{.*}}, 1942892530 |
| 62 ; CHECK: mov {{.*}}, 2874 |
| 63 ; CHECK: fld qword ptr |
| 64 ; CHECK: ret |
| 65 |
| 45 ; ERRORS-NOT: ICE translation error | 66 ; ERRORS-NOT: ICE translation error |
| 46 ; DUMP-NOT: SZ | 67 ; DUMP-NOT: SZ |
| OLD | NEW |