OLD | NEW |
1 ; This file tests casting / conversion operations that apply to vector types. | 1 ; This file tests casting / conversion operations that apply to vector types. |
2 ; bitcast operations are in vector-bitcast.ll. | 2 ; bitcast operations are in vector-bitcast.ll. |
3 | 3 |
4 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -O2 | FileCheck %s | 4 ; RUN: %p2i -i %s --target=x8632 --filetype=obj --disassemble --args -O2 \ |
5 ; RUN: %p2i -i %s --filetype=obj --disassemble --args -Om1 | FileCheck %s | 5 ; RUN: | FileCheck %s --check-prefix=X8632 --check-prefix=CHECK |
| 6 ; RUN: %p2i -i %s --target=x8632 --filetype=obj --disassemble --args -Om1 \ |
| 7 ; RUN: | FileCheck %s --check-prefix=X8632 --check-prefix=CHECK |
| 8 |
| 9 ; RUN: %p2i -i %s --target=arm32 --filetype=obj --disassemble --args -O2 \ |
| 10 ; RUN: | FileCheck %s --check-prefix=ARM32 --check-prefix=CHECK |
| 11 ; RUN: %p2i -i %s --target=arm32 --filetype=obj --disassemble --args -Om1 \ |
| 12 ; RUN: | FileCheck %s --check-prefix=ARM32 --check-prefix=CHECK |
6 | 13 |
7 ; sext operations | 14 ; sext operations |
8 | 15 |
9 define internal <16 x i8> @test_sext_v16i1_to_v16i8(<16 x i1> %arg) { | 16 define internal <16 x i8> @test_sext_v16i1_to_v16i8(<16 x i1> %arg) { |
10 entry: | 17 entry: |
11 %res = sext <16 x i1> %arg to <16 x i8> | 18 %res = sext <16 x i1> %arg to <16 x i8> |
12 ret <16 x i8> %res | 19 ret <16 x i8> %res |
13 | 20 |
14 ; CHECK-LABEL: test_sext_v16i1_to_v16i8 | 21 ; CHECK-LABEL: test_sext_v16i1_to_v16i8 |
15 ; CHECK: pxor | 22 ; X8632: pxor |
16 ; CHECK: pcmpeqb | 23 ; X8632: pcmpeqb |
17 ; CHECK: psubb | 24 ; X8632: psubb |
18 ; CHECK: pand | 25 ; X8632: pand |
19 ; CHECK: pxor | 26 ; X8632: pxor |
20 ; CHECK: pcmpgtb | 27 ; X8632: pcmpgtb |
| 28 ; ARM32: vshl.s8 |
| 29 ; ARM32-NEXT: vshr.s8 |
21 } | 30 } |
22 | 31 |
23 define internal <8 x i16> @test_sext_v8i1_to_v8i16(<8 x i1> %arg) { | 32 define internal <8 x i16> @test_sext_v8i1_to_v8i16(<8 x i1> %arg) { |
24 entry: | 33 entry: |
25 %res = sext <8 x i1> %arg to <8 x i16> | 34 %res = sext <8 x i1> %arg to <8 x i16> |
26 ret <8 x i16> %res | 35 ret <8 x i16> %res |
27 | 36 |
28 ; CHECK-LABEL: test_sext_v8i1_to_v8i16 | 37 ; CHECK-LABEL: test_sext_v8i1_to_v8i16 |
29 ; CHECK: psllw {{.*}},0xf | 38 ; X8632: psllw {{.*}},0xf |
30 ; CHECK: psraw {{.*}},0xf | 39 ; X8632: psraw {{.*}},0xf |
| 40 ; ARM32: vshl.s16 |
| 41 ; ARM32-NEXT: vshr.s16 |
31 } | 42 } |
32 | 43 |
33 define internal <4 x i32> @test_sext_v4i1_to_v4i32(<4 x i1> %arg) { | 44 define internal <4 x i32> @test_sext_v4i1_to_v4i32(<4 x i1> %arg) { |
34 entry: | 45 entry: |
35 %res = sext <4 x i1> %arg to <4 x i32> | 46 %res = sext <4 x i1> %arg to <4 x i32> |
36 ret <4 x i32> %res | 47 ret <4 x i32> %res |
37 | 48 |
38 ; CHECK-LABEL: test_sext_v4i1_to_v4i32 | 49 ; CHECK-LABEL: test_sext_v4i1_to_v4i32 |
39 ; CHECK: pslld {{.*}},0x1f | 50 ; X8632: pslld {{.*}},0x1f |
40 ; CHECK: psrad {{.*}},0x1f | 51 ; X8632: psrad {{.*}},0x1f |
| 52 ; ARM32: vshl.s32 |
| 53 ; ARM32-NEXT: vshr.s32 |
41 } | 54 } |
42 | 55 |
43 ; zext operations | 56 ; zext operations |
44 | 57 |
45 define internal <16 x i8> @test_zext_v16i1_to_v16i8(<16 x i1> %arg) { | 58 define internal <16 x i8> @test_zext_v16i1_to_v16i8(<16 x i1> %arg) { |
46 entry: | 59 entry: |
47 %res = zext <16 x i1> %arg to <16 x i8> | 60 %res = zext <16 x i1> %arg to <16 x i8> |
48 ret <16 x i8> %res | 61 ret <16 x i8> %res |
49 | 62 |
50 ; CHECK-LABEL: test_zext_v16i1_to_v16i8 | 63 ; CHECK-LABEL: test_zext_v16i1_to_v16i8 |
51 ; CHECK: pxor | 64 ; X8632: pxor |
52 ; CHECK: pcmpeqb | 65 ; X8632: pcmpeqb |
53 ; CHECK: psubb | 66 ; X8632: psubb |
54 ; CHECK: pand | 67 ; X8632: pand |
| 68 ; ARM32: vmov.i8 [[S:.*]], #1 |
| 69 ; ARM32-NEXT: vand {{.*}}, [[S]] |
55 } | 70 } |
56 | 71 |
57 define internal <8 x i16> @test_zext_v8i1_to_v8i16(<8 x i1> %arg) { | 72 define internal <8 x i16> @test_zext_v8i1_to_v8i16(<8 x i1> %arg) { |
58 entry: | 73 entry: |
59 %res = zext <8 x i1> %arg to <8 x i16> | 74 %res = zext <8 x i1> %arg to <8 x i16> |
60 ret <8 x i16> %res | 75 ret <8 x i16> %res |
61 | 76 |
62 ; CHECK-LABEL: test_zext_v8i1_to_v8i16 | 77 ; CHECK-LABEL: test_zext_v8i1_to_v8i16 |
63 ; CHECK: pxor | 78 ; X8632: pxor |
64 ; CHECK: pcmpeqw | 79 ; X8632: pcmpeqw |
65 ; CHECK: psubw | 80 ; X8632: psubw |
66 ; CHECK: pand | 81 ; X8632: pand |
| 82 ; ARM32: vmov.i16 [[S:.*]], #1 |
| 83 ; ARM32-NEXT: vand {{.*}}, [[S]] |
67 } | 84 } |
68 | 85 |
69 define internal <4 x i32> @test_zext_v4i1_to_v4i32(<4 x i1> %arg) { | 86 define internal <4 x i32> @test_zext_v4i1_to_v4i32(<4 x i1> %arg) { |
70 entry: | 87 entry: |
71 %res = zext <4 x i1> %arg to <4 x i32> | 88 %res = zext <4 x i1> %arg to <4 x i32> |
72 ret <4 x i32> %res | 89 ret <4 x i32> %res |
73 | 90 |
74 ; CHECK-LABEL: test_zext_v4i1_to_v4i32 | 91 ; CHECK-LABEL: test_zext_v4i1_to_v4i32 |
75 ; CHECK: pxor | 92 ; X8632: pxor |
76 ; CHECK: pcmpeqd | 93 ; X8632: pcmpeqd |
77 ; CHECK: psubd | 94 ; X8632: psubd |
78 ; CHECK: pand | 95 ; X8632: pand |
| 96 ; ARM32: vmov.i32 [[S:.*]], #1 |
| 97 ; ARM32-NEXT: vand {{.*}}, [[S]] |
79 } | 98 } |
80 | 99 |
81 ; trunc operations | 100 ; trunc operations |
82 | 101 |
83 define internal <16 x i1> @test_trunc_v16i8_to_v16i1(<16 x i8> %arg) { | 102 define internal <16 x i1> @test_trunc_v16i8_to_v16i1(<16 x i8> %arg) { |
84 entry: | 103 entry: |
85 %res = trunc <16 x i8> %arg to <16 x i1> | 104 %res = trunc <16 x i8> %arg to <16 x i1> |
86 ret <16 x i1> %res | 105 ret <16 x i1> %res |
87 | 106 |
88 ; CHECK-LABEL: test_trunc_v16i8_to_v16i1 | 107 ; CHECK-LABEL: test_trunc_v16i8_to_v16i1 |
89 ; CHECK: pxor | 108 ; X8632: pxor |
90 ; CHECK: pcmpeqb | 109 ; X8632: pcmpeqb |
91 ; CHECK: psubb | 110 ; X8632: psubb |
92 ; CHECK: pand | 111 ; X8632: pand |
93 } | 112 } |
94 | 113 |
95 define internal <8 x i1> @test_trunc_v8i16_to_v8i1(<8 x i16> %arg) { | 114 define internal <8 x i1> @test_trunc_v8i16_to_v8i1(<8 x i16> %arg) { |
96 entry: | 115 entry: |
97 %res = trunc <8 x i16> %arg to <8 x i1> | 116 %res = trunc <8 x i16> %arg to <8 x i1> |
98 ret <8 x i1> %res | 117 ret <8 x i1> %res |
99 | 118 |
100 ; CHECK-LABEL: test_trunc_v8i16_to_v8i1 | 119 ; CHECK-LABEL: test_trunc_v8i16_to_v8i1 |
101 ; CHECK: pxor | 120 ; X8632: pxor |
102 ; CHECK: pcmpeqw | 121 ; X8632: pcmpeqw |
103 ; CHECK: psubw | 122 ; X8632: psubw |
104 ; CHECK: pand | 123 ; X8632: pand |
105 } | 124 } |
106 | 125 |
107 define internal <4 x i1> @test_trunc_v4i32_to_v4i1(<4 x i32> %arg) { | 126 define internal <4 x i1> @test_trunc_v4i32_to_v4i1(<4 x i32> %arg) { |
108 entry: | 127 entry: |
109 %res = trunc <4 x i32> %arg to <4 x i1> | 128 %res = trunc <4 x i32> %arg to <4 x i1> |
110 ret <4 x i1> %res | 129 ret <4 x i1> %res |
111 | 130 |
112 ; CHECK-LABEL: test_trunc_v4i32_to_v4i1 | 131 ; CHECK-LABEL: test_trunc_v4i32_to_v4i1 |
113 ; CHECK: pxor | 132 ; X8632: pxor |
114 ; CHECK: pcmpeqd | 133 ; X8632: pcmpeqd |
115 ; CHECK: psubd | 134 ; X8632: psubd |
116 ; CHECK: pand | 135 ; X8632: pand |
117 } | 136 } |
118 | 137 |
119 ; fpto[us]i operations | 138 ; fpto[us]i operations |
120 | 139 |
121 define internal <4 x i32> @test_fptosi_v4f32_to_v4i32(<4 x float> %arg) { | 140 define internal <4 x i32> @test_fptosi_v4f32_to_v4i32(<4 x float> %arg) { |
122 entry: | 141 entry: |
123 %res = fptosi <4 x float> %arg to <4 x i32> | 142 %res = fptosi <4 x float> %arg to <4 x i32> |
124 ret <4 x i32> %res | 143 ret <4 x i32> %res |
125 | 144 |
126 ; CHECK-LABEL: test_fptosi_v4f32_to_v4i32 | 145 ; CHECK-LABEL: test_fptosi_v4f32_to_v4i32 |
127 ; CHECK: cvttps2dq | 146 ; X8632: cvttps2dq |
| 147 ; ARM32: vcvt.s32.f32 |
128 } | 148 } |
129 | 149 |
130 define internal <4 x i32> @test_fptoui_v4f32_to_v4i32(<4 x float> %arg) { | 150 define internal <4 x i32> @test_fptoui_v4f32_to_v4i32(<4 x float> %arg) { |
131 entry: | 151 entry: |
132 %res = fptoui <4 x float> %arg to <4 x i32> | 152 %res = fptoui <4 x float> %arg to <4 x i32> |
133 ret <4 x i32> %res | 153 ret <4 x i32> %res |
134 | 154 |
135 ; CHECK-LABEL: test_fptoui_v4f32_to_v4i32 | 155 ; CHECK-LABEL: test_fptoui_v4f32_to_v4i32 |
136 ; CHECK: call {{.*}} R_{{.*}} __Sz_fptoui_4xi32_f32 | 156 ; X8632: call {{.*}} R_{{.*}} __Sz_fptoui_4xi32_f32 |
| 157 ; ARM32: vcvt.u32.f32 |
137 } | 158 } |
138 | 159 |
139 ; [su]itofp operations | 160 ; [su]itofp operations |
140 | 161 |
141 define internal <4 x float> @test_sitofp_v4i32_to_v4f32(<4 x i32> %arg) { | 162 define internal <4 x float> @test_sitofp_v4i32_to_v4f32(<4 x i32> %arg) { |
142 entry: | 163 entry: |
143 %res = sitofp <4 x i32> %arg to <4 x float> | 164 %res = sitofp <4 x i32> %arg to <4 x float> |
144 ret <4 x float> %res | 165 ret <4 x float> %res |
145 | 166 |
146 ; CHECK-LABEL: test_sitofp_v4i32_to_v4f32 | 167 ; CHECK-LABEL: test_sitofp_v4i32_to_v4f32 |
147 ; CHECK: cvtdq2ps | 168 ; X8632: cvtdq2ps |
| 169 ; ARM32: vcvt.f32.s32 |
148 } | 170 } |
149 | 171 |
150 define internal <4 x float> @test_uitofp_v4i32_to_v4f32(<4 x i32> %arg) { | 172 define internal <4 x float> @test_uitofp_v4i32_to_v4f32(<4 x i32> %arg) { |
151 entry: | 173 entry: |
152 %res = uitofp <4 x i32> %arg to <4 x float> | 174 %res = uitofp <4 x i32> %arg to <4 x float> |
153 ret <4 x float> %res | 175 ret <4 x float> %res |
154 | 176 |
155 ; CHECK-LABEL: test_uitofp_v4i32_to_v4f32 | 177 ; CHECK-LABEL: test_uitofp_v4i32_to_v4f32 |
156 ; CHECK: call {{.*}} R_{{.*}} __Sz_uitofp_4xi32_4xf32 | 178 ; X8632: call {{.*}} R_{{.*}} __Sz_uitofp_4xi32_4xf32 |
| 179 ; ARM32: vcvt.f32.u32 |
157 } | 180 } |
OLD | NEW |