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 --filetype=obj --disassemble -i %s --args -O2 | FileCheck %s | 3 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -O2 | FileCheck %s |
4 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -Om1 | FileCheck %s | 4 ; RUN: %p2i --filetype=obj --disassemble -i %s --args -Om1 | FileCheck %s |
5 | 5 |
6 ; RUN: %if --need=target_ARM32 --command %p2i --filetype=obj --disassemble \ | 6 ; RUN: %if --need=target_ARM32 --command %p2i --filetype=obj --disassemble \ |
7 ; RUN: --target arm32 -i %s --args -O2 \ | 7 ; RUN: --target arm32 -i %s --args -O2 \ |
8 ; RUN: | %if --need=target_ARM32 --command FileCheck %s \ | 8 ; RUN: | %if --need=target_ARM32 --command FileCheck %s \ |
9 ; RUN: --check-prefix=ARM32 | 9 ; RUN: --check-prefix=ARM32 |
10 | 10 |
11 ; RUN: %if --need=target_ARM32 --command %p2i --filetype=obj --disassemble \ | 11 ; RUN: %if --need=target_ARM32 --command %p2i --filetype=obj --disassemble \ |
12 ; RUN: --target arm32 -i %s --args -Om1 \ | 12 ; RUN: --target arm32 -i %s --args -Om1 \ |
13 ; RUN: | %if --need=target_ARM32 --command FileCheck %s \ | 13 ; RUN: | %if --need=target_ARM32 --command FileCheck %s \ |
14 ; RUN: --check-prefix=ARM32 | 14 ; RUN: --check-prefix=ARM32 |
15 | 15 |
| 16 ; RUN: %if --need=target_MIPS32 --command %p2i --filetype=asm \ |
| 17 ; RUN: --target mips32 -i %s --args -O2 \ |
| 18 ; RUN: | %if --need=target_MIPS32 --command FileCheck %s \ |
| 19 ; RUN: --check-prefix=MIPS32 --check-prefix=MIPS32-O2 |
| 20 |
| 21 ; RUN: %if --need=target_MIPS32 --command %p2i --filetype=asm \ |
| 22 ; RUN: --target mips32 -i %s --args -Om1 \ |
| 23 ; RUN: | %if --need=target_MIPS32 --command FileCheck %s \ |
| 24 ; RUN: --check-prefix=MIPS32 --check-prefix=MIPS32-OM1 |
| 25 |
16 define internal i32 @cast_f2i(float %f) { | 26 define internal i32 @cast_f2i(float %f) { |
17 entry: | 27 entry: |
18 %v0 = bitcast float %f to i32 | 28 %v0 = bitcast float %f to i32 |
19 ret i32 %v0 | 29 ret i32 %v0 |
20 } | 30 } |
21 ; CHECK-LABEL: cast_f2i | 31 ; CHECK-LABEL: cast_f2i |
22 ; CHECK: movd eax | 32 ; CHECK: movd eax |
23 ; ARM32-LABEL: cast_f2i | 33 ; ARM32-LABEL: cast_f2i |
24 ; ARM32: vmov r{{[0-9]+}}, s{{[0-9]+}} | 34 ; ARM32: vmov r{{[0-9]+}}, s{{[0-9]+}} |
| 35 ; MIPS32-LABEL: cast_f2i |
| 36 ; MIPS32-O2: mfc1 $v0, $f{{[0-9]+}} |
| 37 ; MIPS32-OM1: swc1 |
| 38 ; MIPS32-OM1: lw |
25 | 39 |
26 define internal float @cast_i2f(i32 %i) { | 40 define internal float @cast_i2f(i32 %i) { |
27 entry: | 41 entry: |
28 %v0 = bitcast i32 %i to float | 42 %v0 = bitcast i32 %i to float |
29 ret float %v0 | 43 ret float %v0 |
30 } | 44 } |
31 ; CHECK-LABEL: cast_i2f | 45 ; CHECK-LABEL: cast_i2f |
32 ; CHECK: fld DWORD PTR | 46 ; CHECK: fld DWORD PTR |
33 ; ARM32-LABEL: cast_i2f | 47 ; ARM32-LABEL: cast_i2f |
34 ; ARM32: vmov s{{[0-9]+}}, r{{[0-9]+}} | 48 ; ARM32: vmov s{{[0-9]+}}, r{{[0-9]+}} |
| 49 ; MIPS32-LABEL: cast_i2f |
| 50 ; MIPS32-O2: mtc1 $a0, $f{{[0-9]+}} |
| 51 ; MIPS32-OM1: sw |
| 52 ; MIPS32-OM1: lwc1 |
35 | 53 |
36 define internal i64 @cast_d2ll(double %d) { | 54 define internal i64 @cast_d2ll(double %d) { |
37 entry: | 55 entry: |
38 %v0 = bitcast double %d to i64 | 56 %v0 = bitcast double %d to i64 |
39 ret i64 %v0 | 57 ret i64 %v0 |
40 } | 58 } |
41 ; CHECK-LABEL: cast_d2ll | 59 ; CHECK-LABEL: cast_d2ll |
42 ; CHECK: mov edx | 60 ; CHECK: mov edx |
43 ; ARM32-LABEL: cast_d2ll | 61 ; ARM32-LABEL: cast_d2ll |
44 ; ARM32: vmov r{{[0-9]+}}, r{{[0-9]+}}, d{{[0-9]+}} | 62 ; ARM32: vmov r{{[0-9]+}}, r{{[0-9]+}}, d{{[0-9]+}} |
| 63 ; MIPS32-LABEL: cast_d2ll |
| 64 ; MIPS32-O2: mfc1 $v1, $f{{[0-9]+}} |
| 65 ; MIPS32-O2: mfc1 $v0, $f{{[0-9]+}} |
| 66 ; MIPS32-OM1: sdc1 |
| 67 ; MIPS32-OM1: lw |
| 68 ; MIPS32-OM1: lw |
45 | 69 |
46 define internal i64 @cast_d2ll_const() { | 70 define internal i64 @cast_d2ll_const() { |
47 entry: | 71 entry: |
48 %v0 = bitcast double 0x12345678901234 to i64 | 72 %v0 = bitcast double 0x12345678901234 to i64 |
49 ret i64 %v0 | 73 ret i64 %v0 |
50 } | 74 } |
51 ; CHECK-LABEL: cast_d2ll_const | 75 ; CHECK-LABEL: cast_d2ll_const |
52 ; CHECK: mov e{{..}},{{(DWORD PTR )?}}ds:0x0 {{.*}} {{.*}}0012345678901234 | 76 ; CHECK: mov e{{..}},{{(DWORD PTR )?}}ds:0x0 {{.*}} {{.*}}0012345678901234 |
53 ; CHECK: mov e{{..}},{{(DWORD PTR )?}}ds:0x4 {{.*}} {{.*}}0012345678901234 | 77 ; CHECK: mov e{{..}},{{(DWORD PTR )?}}ds:0x4 {{.*}} {{.*}}0012345678901234 |
54 ; ARM32-LABEL: cast_d2ll_const | 78 ; ARM32-LABEL: cast_d2ll_const |
55 ; ARM32-DAG: movw [[ADDR:r[0-9]+]], #{{.*_MOVW_}} | 79 ; ARM32-DAG: movw [[ADDR:r[0-9]+]], #{{.*_MOVW_}} |
56 ; ARM32-DAG: movt [[ADDR]], #{{.*_MOVT_}} | 80 ; ARM32-DAG: movt [[ADDR]], #{{.*_MOVT_}} |
57 ; ARM32-DAG: vldr [[DREG:d[0-9]+]], {{\[}}[[ADDR]]{{\]}} | 81 ; ARM32-DAG: vldr [[DREG:d[0-9]+]], {{\[}}[[ADDR]]{{\]}} |
58 ; ARM32: vmov r{{[0-9]+}}, r{{[0-9]+}}, [[DREG]] | 82 ; ARM32: vmov r{{[0-9]+}}, r{{[0-9]+}}, [[DREG]] |
| 83 ; MIPS32-LABEL: cast_d2ll_const |
| 84 ; MIPS32: lui {{.*}}, %hi(.L$double$0012345678901234) |
| 85 ; MIPS32: ldc1 {{.*}}, %lo(.L$double$0012345678901234)({{.*}}) |
| 86 ; MIPS32-O2: mfc1 $v1, $f{{[0-9]+}} |
| 87 ; MIPS32-O2: mfc1 $v0, $f{{[0-9]+}} |
| 88 ; MIPS32-OM1: sdc1 |
| 89 ; MIPS32-OM1: lw |
| 90 ; MIPS32-OM1: lw |
59 | 91 |
60 define internal double @cast_ll2d(i64 %ll) { | 92 define internal double @cast_ll2d(i64 %ll) { |
61 entry: | 93 entry: |
62 %v0 = bitcast i64 %ll to double | 94 %v0 = bitcast i64 %ll to double |
63 ret double %v0 | 95 ret double %v0 |
64 } | 96 } |
65 ; CHECK-LABEL: cast_ll2d | 97 ; CHECK-LABEL: cast_ll2d |
66 ; CHECK: fld QWORD PTR | 98 ; CHECK: fld QWORD PTR |
67 ; ARM32-LABEL: cast_ll2d | 99 ; ARM32-LABEL: cast_ll2d |
68 ; ARM32: vmov d{{[0-9]+}}, r{{[0-9]+}}, r{{[0-9]+}} | 100 ; ARM32: vmov d{{[0-9]+}}, r{{[0-9]+}}, r{{[0-9]+}} |
| 101 ; MIPS32-LABEL: cast_ll2d |
| 102 ; MIPS32-O2: mtc1 $a0, $f{{[0-9]+}} |
| 103 ; MIPS32-O2: mtc1 $a1, $f{{[0-9]+}} |
| 104 ; MIPS32-OM1: sw |
| 105 ; MIPS32-OM1: sw |
| 106 ; MIPS32-OM1: ldc1 |
69 | 107 |
70 define internal double @cast_ll2d_const() { | 108 define internal double @cast_ll2d_const() { |
71 entry: | 109 entry: |
72 %v0 = bitcast i64 12345678901234 to double | 110 %v0 = bitcast i64 12345678901234 to double |
73 ret double %v0 | 111 ret double %v0 |
74 } | 112 } |
75 ; CHECK-LABEL: cast_ll2d_const | 113 ; CHECK-LABEL: cast_ll2d_const |
76 ; CHECK: mov {{.*}},0x73ce2ff2 | 114 ; CHECK: mov {{.*}},0x73ce2ff2 |
77 ; CHECK: mov {{.*}},0xb3a | 115 ; CHECK: mov {{.*}},0xb3a |
78 ; CHECK: fld QWORD PTR | 116 ; CHECK: fld QWORD PTR |
79 ; ARM32-LABEL: cast_ll2d_const | 117 ; ARM32-LABEL: cast_ll2d_const |
80 ; ARM32-DAG: movw [[REG0:r[0-9]+]], #12274 | 118 ; ARM32-DAG: movw [[REG0:r[0-9]+]], #12274 |
81 ; ARM32-DAG: movt [[REG0:r[0-9]+]], #29646 | 119 ; ARM32-DAG: movt [[REG0:r[0-9]+]], #29646 |
82 ; ARM32-DAG: movw [[REG1:r[0-9]+]], #2874 | 120 ; ARM32-DAG: movw [[REG1:r[0-9]+]], #2874 |
83 ; ARM32: vmov d{{[0-9]+}}, [[REG0]], [[REG1]] | 121 ; ARM32: vmov d{{[0-9]+}}, [[REG0]], [[REG1]] |
| 122 ; MIPS32-LABEL: cast_ll2d_const |
| 123 ; MIPS32: lui {{.*}}, 29646 |
| 124 ; MIPS32: ori {{.*}}, {{.*}}, 12274 |
| 125 ; MIPS32: addiu {{.*}}, $zero, 2874 |
| 126 ; MIPS32-O2: mtc1 {{.*}}, $f{{[0-9]+}} |
| 127 ; MIPS32-O2: mtc1 {{.*}}, $f{{[0-9]+}} |
| 128 ; MIPS32-OM1: sw |
| 129 ; MIPS32-OM1: sw |
| 130 ; MIPS32-OM1: ldc1 |
OLD | NEW |