1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse2 | FileCheck %s --check-prefixes=SSE2-SSSE3,SSE2
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+ssse3 | FileCheck %s --check-prefixes=SSE2-SSSE3,SSSE3
4 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx | FileCheck %s --check-prefixes=AVX12,AVX1
5 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2 | FileCheck %s --check-prefixes=AVX12,AVX2,AVX2-SLOW
6 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2,+fast-variable-shuffle | FileCheck %s --check-prefixes=AVX12,AVX2,AVX2-FAST
7 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f | FileCheck %s --check-prefixes=AVX512,AVX512F
8 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f,+avx512vl,+avx512bw,+fast-variable-shuffle | FileCheck %s --check-prefixes=AVX512,AVX512VLBW
14 define <2 x i64> @ext_i2_2i64(i2 %a0) {
15 ; SSE2-SSSE3-LABEL: ext_i2_2i64:
16 ; SSE2-SSSE3: # %bb.0:
17 ; SSE2-SSSE3-NEXT: movd %edi, %xmm0
18 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm1 = xmm0[0,1,0,1]
19 ; SSE2-SSSE3-NEXT: movdqa {{.*#+}} xmm0 = [1,2]
20 ; SSE2-SSSE3-NEXT: pand %xmm0, %xmm1
21 ; SSE2-SSSE3-NEXT: pcmpeqd %xmm0, %xmm1
22 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,0,3,2]
23 ; SSE2-SSSE3-NEXT: pand %xmm1, %xmm0
24 ; SSE2-SSSE3-NEXT: psrlq $63, %xmm0
25 ; SSE2-SSSE3-NEXT: retq
27 ; AVX1-LABEL: ext_i2_2i64:
29 ; AVX1-NEXT: vmovd %edi, %xmm0
30 ; AVX1-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[0,1,0,1]
31 ; AVX1-NEXT: vmovdqa {{.*#+}} xmm1 = [1,2]
32 ; AVX1-NEXT: vpand %xmm1, %xmm0, %xmm0
33 ; AVX1-NEXT: vpcmpeqq %xmm1, %xmm0, %xmm0
34 ; AVX1-NEXT: vpsrlq $63, %xmm0, %xmm0
37 ; AVX2-LABEL: ext_i2_2i64:
39 ; AVX2-NEXT: vmovd %edi, %xmm0
40 ; AVX2-NEXT: vpbroadcastq %xmm0, %xmm0
41 ; AVX2-NEXT: vmovdqa {{.*#+}} xmm1 = [1,2]
42 ; AVX2-NEXT: vpand %xmm1, %xmm0, %xmm0
43 ; AVX2-NEXT: vpcmpeqq %xmm1, %xmm0, %xmm0
44 ; AVX2-NEXT: vpsrlq $63, %xmm0, %xmm0
47 ; AVX512F-LABEL: ext_i2_2i64:
49 ; AVX512F-NEXT: kmovw %edi, %k1
50 ; AVX512F-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
51 ; AVX512F-NEXT: vpsrlq $63, %xmm0, %xmm0
52 ; AVX512F-NEXT: vzeroupper
55 ; AVX512VLBW-LABEL: ext_i2_2i64:
56 ; AVX512VLBW: # %bb.0:
57 ; AVX512VLBW-NEXT: kmovd %edi, %k1
58 ; AVX512VLBW-NEXT: vpcmpeqd %xmm0, %xmm0, %xmm0
59 ; AVX512VLBW-NEXT: vmovdqa64 %xmm0, %xmm0 {%k1} {z}
60 ; AVX512VLBW-NEXT: vpsrlq $63, %xmm0, %xmm0
61 ; AVX512VLBW-NEXT: retq
62 %1 = bitcast i2 %a0 to <2 x i1>
63 %2 = zext <2 x i1> %1 to <2 x i64>
67 define <4 x i32> @ext_i4_4i32(i4 %a0) {
68 ; SSE2-SSSE3-LABEL: ext_i4_4i32:
69 ; SSE2-SSSE3: # %bb.0:
70 ; SSE2-SSSE3-NEXT: movd %edi, %xmm0
71 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,0,0,0]
72 ; SSE2-SSSE3-NEXT: movdqa {{.*#+}} xmm1 = [1,2,4,8]
73 ; SSE2-SSSE3-NEXT: pand %xmm1, %xmm0
74 ; SSE2-SSSE3-NEXT: pcmpeqd %xmm1, %xmm0
75 ; SSE2-SSSE3-NEXT: psrld $31, %xmm0
76 ; SSE2-SSSE3-NEXT: retq
78 ; AVX1-LABEL: ext_i4_4i32:
80 ; AVX1-NEXT: vmovd %edi, %xmm0
81 ; AVX1-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[0,0,0,0]
82 ; AVX1-NEXT: vmovdqa {{.*#+}} xmm1 = [1,2,4,8]
83 ; AVX1-NEXT: vpand %xmm1, %xmm0, %xmm0
84 ; AVX1-NEXT: vpcmpeqd %xmm1, %xmm0, %xmm0
85 ; AVX1-NEXT: vpsrld $31, %xmm0, %xmm0
88 ; AVX2-LABEL: ext_i4_4i32:
90 ; AVX2-NEXT: vmovd %edi, %xmm0
91 ; AVX2-NEXT: vpbroadcastd %xmm0, %xmm0
92 ; AVX2-NEXT: vmovdqa {{.*#+}} xmm1 = [1,2,4,8]
93 ; AVX2-NEXT: vpand %xmm1, %xmm0, %xmm0
94 ; AVX2-NEXT: vpcmpeqd %xmm1, %xmm0, %xmm0
95 ; AVX2-NEXT: vpsrld $31, %xmm0, %xmm0
98 ; AVX512F-LABEL: ext_i4_4i32:
100 ; AVX512F-NEXT: kmovw %edi, %k1
101 ; AVX512F-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
102 ; AVX512F-NEXT: vpsrld $31, %xmm0, %xmm0
103 ; AVX512F-NEXT: vzeroupper
106 ; AVX512VLBW-LABEL: ext_i4_4i32:
107 ; AVX512VLBW: # %bb.0:
108 ; AVX512VLBW-NEXT: kmovd %edi, %k1
109 ; AVX512VLBW-NEXT: vpcmpeqd %xmm0, %xmm0, %xmm0
110 ; AVX512VLBW-NEXT: vmovdqa32 %xmm0, %xmm0 {%k1} {z}
111 ; AVX512VLBW-NEXT: vpsrld $31, %xmm0, %xmm0
112 ; AVX512VLBW-NEXT: retq
113 %1 = bitcast i4 %a0 to <4 x i1>
114 %2 = zext <4 x i1> %1 to <4 x i32>
118 define <8 x i16> @ext_i8_8i16(i8 %a0) {
119 ; SSE2-SSSE3-LABEL: ext_i8_8i16:
120 ; SSE2-SSSE3: # %bb.0:
121 ; SSE2-SSSE3-NEXT: movd %edi, %xmm0
122 ; SSE2-SSSE3-NEXT: pshuflw {{.*#+}} xmm0 = xmm0[0,0,2,3,4,5,6,7]
123 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,0,0,0]
124 ; SSE2-SSSE3-NEXT: movdqa {{.*#+}} xmm1 = [1,2,4,8,16,32,64,128]
125 ; SSE2-SSSE3-NEXT: pand %xmm1, %xmm0
126 ; SSE2-SSSE3-NEXT: pcmpeqw %xmm1, %xmm0
127 ; SSE2-SSSE3-NEXT: psrlw $15, %xmm0
128 ; SSE2-SSSE3-NEXT: retq
130 ; AVX1-LABEL: ext_i8_8i16:
132 ; AVX1-NEXT: vmovd %edi, %xmm0
133 ; AVX1-NEXT: vpshuflw {{.*#+}} xmm0 = xmm0[0,0,2,3,4,5,6,7]
134 ; AVX1-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[0,0,0,0]
135 ; AVX1-NEXT: vmovdqa {{.*#+}} xmm1 = [1,2,4,8,16,32,64,128]
136 ; AVX1-NEXT: vpand %xmm1, %xmm0, %xmm0
137 ; AVX1-NEXT: vpcmpeqw %xmm1, %xmm0, %xmm0
138 ; AVX1-NEXT: vpsrlw $15, %xmm0, %xmm0
141 ; AVX2-LABEL: ext_i8_8i16:
143 ; AVX2-NEXT: vmovd %edi, %xmm0
144 ; AVX2-NEXT: vpbroadcastw %xmm0, %xmm0
145 ; AVX2-NEXT: vmovdqa {{.*#+}} xmm1 = [1,2,4,8,16,32,64,128]
146 ; AVX2-NEXT: vpand %xmm1, %xmm0, %xmm0
147 ; AVX2-NEXT: vpcmpeqw %xmm1, %xmm0, %xmm0
148 ; AVX2-NEXT: vpsrlw $15, %xmm0, %xmm0
151 ; AVX512F-LABEL: ext_i8_8i16:
153 ; AVX512F-NEXT: kmovw %edi, %k1
154 ; AVX512F-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
155 ; AVX512F-NEXT: vpmovdw %zmm0, %ymm0
156 ; AVX512F-NEXT: vpsrlw $15, %xmm0, %xmm0
157 ; AVX512F-NEXT: vzeroupper
160 ; AVX512VLBW-LABEL: ext_i8_8i16:
161 ; AVX512VLBW: # %bb.0:
162 ; AVX512VLBW-NEXT: kmovd %edi, %k0
163 ; AVX512VLBW-NEXT: vpmovm2w %k0, %xmm0
164 ; AVX512VLBW-NEXT: vpsrlw $15, %xmm0, %xmm0
165 ; AVX512VLBW-NEXT: retq
166 %1 = bitcast i8 %a0 to <8 x i1>
167 %2 = zext <8 x i1> %1 to <8 x i16>
171 define <16 x i8> @ext_i16_16i8(i16 %a0) {
172 ; SSE2-LABEL: ext_i16_16i8:
174 ; SSE2-NEXT: movd %edi, %xmm0
175 ; SSE2-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
176 ; SSE2-NEXT: pshuflw {{.*#+}} xmm0 = xmm0[0,0,1,1,4,5,6,7]
177 ; SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,0,1,1]
178 ; SSE2-NEXT: movdqa {{.*#+}} xmm1 = [1,2,4,8,16,32,64,128,1,2,4,8,16,32,64,128]
179 ; SSE2-NEXT: pand %xmm1, %xmm0
180 ; SSE2-NEXT: pcmpeqb %xmm1, %xmm0
181 ; SSE2-NEXT: psrlw $7, %xmm0
182 ; SSE2-NEXT: pand {{.*}}(%rip), %xmm0
185 ; SSSE3-LABEL: ext_i16_16i8:
187 ; SSSE3-NEXT: movd %edi, %xmm0
188 ; SSSE3-NEXT: pshufb {{.*#+}} xmm0 = xmm0[0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1]
189 ; SSSE3-NEXT: movdqa {{.*#+}} xmm1 = [1,2,4,8,16,32,64,128,1,2,4,8,16,32,64,128]
190 ; SSSE3-NEXT: pand %xmm1, %xmm0
191 ; SSSE3-NEXT: pcmpeqb %xmm1, %xmm0
192 ; SSSE3-NEXT: psrlw $7, %xmm0
193 ; SSSE3-NEXT: pand {{.*}}(%rip), %xmm0
196 ; AVX1-LABEL: ext_i16_16i8:
198 ; AVX1-NEXT: vmovd %edi, %xmm0
199 ; AVX1-NEXT: vpshufb {{.*#+}} xmm0 = xmm0[0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1]
200 ; AVX1-NEXT: vmovddup {{.*#+}} xmm1 = [-1.7939930131212661E-307,-1.7939930131212661E-307]
201 ; AVX1-NEXT: # xmm1 = mem[0,0]
202 ; AVX1-NEXT: vpand %xmm1, %xmm0, %xmm0
203 ; AVX1-NEXT: vpcmpeqb %xmm1, %xmm0, %xmm0
204 ; AVX1-NEXT: vpsrlw $7, %xmm0, %xmm0
205 ; AVX1-NEXT: vpand {{.*}}(%rip), %xmm0, %xmm0
208 ; AVX2-LABEL: ext_i16_16i8:
210 ; AVX2-NEXT: vmovd %edi, %xmm0
211 ; AVX2-NEXT: vpshufb {{.*#+}} xmm0 = xmm0[0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1]
212 ; AVX2-NEXT: vpbroadcastq {{.*#+}} xmm1 = [9241421688590303745,9241421688590303745]
213 ; AVX2-NEXT: vpand %xmm1, %xmm0, %xmm0
214 ; AVX2-NEXT: vpcmpeqb %xmm1, %xmm0, %xmm0
215 ; AVX2-NEXT: vpsrlw $7, %xmm0, %xmm0
216 ; AVX2-NEXT: vpand {{.*}}(%rip), %xmm0, %xmm0
219 ; AVX512F-LABEL: ext_i16_16i8:
221 ; AVX512F-NEXT: kmovw %edi, %k1
222 ; AVX512F-NEXT: vpbroadcastd {{.*}}(%rip), %zmm0 {%k1} {z}
223 ; AVX512F-NEXT: vpmovdb %zmm0, %xmm0
224 ; AVX512F-NEXT: vzeroupper
227 ; AVX512VLBW-LABEL: ext_i16_16i8:
228 ; AVX512VLBW: # %bb.0:
229 ; AVX512VLBW-NEXT: kmovd %edi, %k1
230 ; AVX512VLBW-NEXT: vmovdqu8 {{.*}}(%rip), %xmm0 {%k1} {z}
231 ; AVX512VLBW-NEXT: retq
232 %1 = bitcast i16 %a0 to <16 x i1>
233 %2 = zext <16 x i1> %1 to <16 x i8>
241 define <4 x i64> @ext_i4_4i64(i4 %a0) {
242 ; SSE2-SSSE3-LABEL: ext_i4_4i64:
243 ; SSE2-SSSE3: # %bb.0:
244 ; SSE2-SSSE3-NEXT: movd %edi, %xmm0
245 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm2 = xmm0[0,1,0,1]
246 ; SSE2-SSSE3-NEXT: movdqa {{.*#+}} xmm0 = [1,2]
247 ; SSE2-SSSE3-NEXT: movdqa %xmm2, %xmm1
248 ; SSE2-SSSE3-NEXT: pand %xmm0, %xmm1
249 ; SSE2-SSSE3-NEXT: pcmpeqd %xmm0, %xmm1
250 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,0,3,2]
251 ; SSE2-SSSE3-NEXT: pand %xmm1, %xmm0
252 ; SSE2-SSSE3-NEXT: psrlq $63, %xmm0
253 ; SSE2-SSSE3-NEXT: movdqa {{.*#+}} xmm1 = [4,8]
254 ; SSE2-SSSE3-NEXT: pand %xmm1, %xmm2
255 ; SSE2-SSSE3-NEXT: pcmpeqd %xmm1, %xmm2
256 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm1 = xmm2[1,0,3,2]
257 ; SSE2-SSSE3-NEXT: pand %xmm2, %xmm1
258 ; SSE2-SSSE3-NEXT: psrlq $63, %xmm1
259 ; SSE2-SSSE3-NEXT: retq
261 ; AVX1-LABEL: ext_i4_4i64:
263 ; AVX1-NEXT: vmovd %edi, %xmm0
264 ; AVX1-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[0,1,0,1]
265 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
266 ; AVX1-NEXT: vandps {{.*}}(%rip), %ymm0, %ymm0
267 ; AVX1-NEXT: vpxor %xmm1, %xmm1, %xmm1
268 ; AVX1-NEXT: vpcmpeqq %xmm1, %xmm0, %xmm2
269 ; AVX1-NEXT: vpcmpeqd %xmm3, %xmm3, %xmm3
270 ; AVX1-NEXT: vpxor %xmm3, %xmm2, %xmm2
271 ; AVX1-NEXT: vpsrlq $63, %xmm2, %xmm2
272 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm0
273 ; AVX1-NEXT: vpcmpeqq %xmm1, %xmm0, %xmm0
274 ; AVX1-NEXT: vpxor %xmm3, %xmm0, %xmm0
275 ; AVX1-NEXT: vpsrlq $63, %xmm0, %xmm0
276 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm2, %ymm0
279 ; AVX2-LABEL: ext_i4_4i64:
281 ; AVX2-NEXT: # kill: def $edi killed $edi def $rdi
282 ; AVX2-NEXT: vmovq %rdi, %xmm0
283 ; AVX2-NEXT: vpbroadcastq %xmm0, %ymm0
284 ; AVX2-NEXT: vmovdqa {{.*#+}} ymm1 = [1,2,4,8]
285 ; AVX2-NEXT: vpand %ymm1, %ymm0, %ymm0
286 ; AVX2-NEXT: vpcmpeqq %ymm1, %ymm0, %ymm0
287 ; AVX2-NEXT: vpsrlq $63, %ymm0, %ymm0
290 ; AVX512F-LABEL: ext_i4_4i64:
292 ; AVX512F-NEXT: kmovw %edi, %k1
293 ; AVX512F-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
294 ; AVX512F-NEXT: vpsrlq $63, %ymm0, %ymm0
297 ; AVX512VLBW-LABEL: ext_i4_4i64:
298 ; AVX512VLBW: # %bb.0:
299 ; AVX512VLBW-NEXT: kmovd %edi, %k1
300 ; AVX512VLBW-NEXT: vpcmpeqd %ymm0, %ymm0, %ymm0
301 ; AVX512VLBW-NEXT: vmovdqa64 %ymm0, %ymm0 {%k1} {z}
302 ; AVX512VLBW-NEXT: vpsrlq $63, %ymm0, %ymm0
303 ; AVX512VLBW-NEXT: retq
304 %1 = bitcast i4 %a0 to <4 x i1>
305 %2 = zext <4 x i1> %1 to <4 x i64>
309 define <8 x i32> @ext_i8_8i32(i8 %a0) {
310 ; SSE2-SSSE3-LABEL: ext_i8_8i32:
311 ; SSE2-SSSE3: # %bb.0:
312 ; SSE2-SSSE3-NEXT: movd %edi, %xmm0
313 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm1 = xmm0[0,0,0,0]
314 ; SSE2-SSSE3-NEXT: movdqa {{.*#+}} xmm2 = [1,2,4,8]
315 ; SSE2-SSSE3-NEXT: movdqa %xmm1, %xmm0
316 ; SSE2-SSSE3-NEXT: pand %xmm2, %xmm0
317 ; SSE2-SSSE3-NEXT: pcmpeqd %xmm2, %xmm0
318 ; SSE2-SSSE3-NEXT: psrld $31, %xmm0
319 ; SSE2-SSSE3-NEXT: movdqa {{.*#+}} xmm2 = [16,32,64,128]
320 ; SSE2-SSSE3-NEXT: pand %xmm2, %xmm1
321 ; SSE2-SSSE3-NEXT: pcmpeqd %xmm2, %xmm1
322 ; SSE2-SSSE3-NEXT: psrld $31, %xmm1
323 ; SSE2-SSSE3-NEXT: retq
325 ; AVX1-LABEL: ext_i8_8i32:
327 ; AVX1-NEXT: vmovd %edi, %xmm0
328 ; AVX1-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[0,0,0,0]
329 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
330 ; AVX1-NEXT: vandps {{.*}}(%rip), %ymm0, %ymm0
331 ; AVX1-NEXT: vpxor %xmm1, %xmm1, %xmm1
332 ; AVX1-NEXT: vpcmpeqd %xmm1, %xmm0, %xmm2
333 ; AVX1-NEXT: vpcmpeqd %xmm3, %xmm3, %xmm3
334 ; AVX1-NEXT: vpxor %xmm3, %xmm2, %xmm2
335 ; AVX1-NEXT: vpsrld $31, %xmm2, %xmm2
336 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm0
337 ; AVX1-NEXT: vpcmpeqd %xmm1, %xmm0, %xmm0
338 ; AVX1-NEXT: vpxor %xmm3, %xmm0, %xmm0
339 ; AVX1-NEXT: vpsrld $31, %xmm0, %xmm0
340 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm2, %ymm0
343 ; AVX2-LABEL: ext_i8_8i32:
345 ; AVX2-NEXT: vmovd %edi, %xmm0
346 ; AVX2-NEXT: vpbroadcastd %xmm0, %ymm0
347 ; AVX2-NEXT: vmovdqa {{.*#+}} ymm1 = [1,2,4,8,16,32,64,128]
348 ; AVX2-NEXT: vpand %ymm1, %ymm0, %ymm0
349 ; AVX2-NEXT: vpcmpeqd %ymm1, %ymm0, %ymm0
350 ; AVX2-NEXT: vpsrld $31, %ymm0, %ymm0
353 ; AVX512F-LABEL: ext_i8_8i32:
355 ; AVX512F-NEXT: kmovw %edi, %k1
356 ; AVX512F-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
357 ; AVX512F-NEXT: vpsrld $31, %ymm0, %ymm0
360 ; AVX512VLBW-LABEL: ext_i8_8i32:
361 ; AVX512VLBW: # %bb.0:
362 ; AVX512VLBW-NEXT: kmovd %edi, %k1
363 ; AVX512VLBW-NEXT: vpcmpeqd %ymm0, %ymm0, %ymm0
364 ; AVX512VLBW-NEXT: vmovdqa32 %ymm0, %ymm0 {%k1} {z}
365 ; AVX512VLBW-NEXT: vpsrld $31, %ymm0, %ymm0
366 ; AVX512VLBW-NEXT: retq
367 %1 = bitcast i8 %a0 to <8 x i1>
368 %2 = zext <8 x i1> %1 to <8 x i32>
372 define <16 x i16> @ext_i16_16i16(i16 %a0) {
373 ; SSE2-SSSE3-LABEL: ext_i16_16i16:
374 ; SSE2-SSSE3: # %bb.0:
375 ; SSE2-SSSE3-NEXT: movd %edi, %xmm0
376 ; SSE2-SSSE3-NEXT: pshuflw {{.*#+}} xmm0 = xmm0[0,0,2,3,4,5,6,7]
377 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm1 = xmm0[0,0,0,0]
378 ; SSE2-SSSE3-NEXT: movdqa {{.*#+}} xmm2 = [1,2,4,8,16,32,64,128]
379 ; SSE2-SSSE3-NEXT: movdqa %xmm1, %xmm0
380 ; SSE2-SSSE3-NEXT: pand %xmm2, %xmm0
381 ; SSE2-SSSE3-NEXT: pcmpeqw %xmm2, %xmm0
382 ; SSE2-SSSE3-NEXT: psrlw $15, %xmm0
383 ; SSE2-SSSE3-NEXT: movdqa {{.*#+}} xmm2 = [256,512,1024,2048,4096,8192,16384,32768]
384 ; SSE2-SSSE3-NEXT: pand %xmm2, %xmm1
385 ; SSE2-SSSE3-NEXT: pcmpeqw %xmm2, %xmm1
386 ; SSE2-SSSE3-NEXT: psrlw $15, %xmm1
387 ; SSE2-SSSE3-NEXT: retq
389 ; AVX1-LABEL: ext_i16_16i16:
391 ; AVX1-NEXT: vmovd %edi, %xmm0
392 ; AVX1-NEXT: vpshuflw {{.*#+}} xmm0 = xmm0[0,0,2,3,4,5,6,7]
393 ; AVX1-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[0,0,0,0]
394 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
395 ; AVX1-NEXT: vandps {{.*}}(%rip), %ymm0, %ymm0
396 ; AVX1-NEXT: vpxor %xmm1, %xmm1, %xmm1
397 ; AVX1-NEXT: vpcmpeqw %xmm1, %xmm0, %xmm2
398 ; AVX1-NEXT: vpcmpeqd %xmm3, %xmm3, %xmm3
399 ; AVX1-NEXT: vpxor %xmm3, %xmm2, %xmm2
400 ; AVX1-NEXT: vpsrlw $15, %xmm2, %xmm2
401 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm0
402 ; AVX1-NEXT: vpcmpeqw %xmm1, %xmm0, %xmm0
403 ; AVX1-NEXT: vpxor %xmm3, %xmm0, %xmm0
404 ; AVX1-NEXT: vpsrlw $15, %xmm0, %xmm0
405 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm2, %ymm0
408 ; AVX2-LABEL: ext_i16_16i16:
410 ; AVX2-NEXT: vmovd %edi, %xmm0
411 ; AVX2-NEXT: vpbroadcastw %xmm0, %ymm0
412 ; AVX2-NEXT: vmovdqa {{.*#+}} ymm1 = [1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768]
413 ; AVX2-NEXT: vpand %ymm1, %ymm0, %ymm0
414 ; AVX2-NEXT: vpcmpeqw %ymm1, %ymm0, %ymm0
415 ; AVX2-NEXT: vpsrlw $15, %ymm0, %ymm0
418 ; AVX512F-LABEL: ext_i16_16i16:
420 ; AVX512F-NEXT: kmovw %edi, %k1
421 ; AVX512F-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
422 ; AVX512F-NEXT: vpmovdw %zmm0, %ymm0
423 ; AVX512F-NEXT: vpsrlw $15, %ymm0, %ymm0
426 ; AVX512VLBW-LABEL: ext_i16_16i16:
427 ; AVX512VLBW: # %bb.0:
428 ; AVX512VLBW-NEXT: kmovd %edi, %k0
429 ; AVX512VLBW-NEXT: vpmovm2w %k0, %ymm0
430 ; AVX512VLBW-NEXT: vpsrlw $15, %ymm0, %ymm0
431 ; AVX512VLBW-NEXT: retq
432 %1 = bitcast i16 %a0 to <16 x i1>
433 %2 = zext <16 x i1> %1 to <16 x i16>
437 define <32 x i8> @ext_i32_32i8(i32 %a0) {
438 ; SSE2-SSSE3-LABEL: ext_i32_32i8:
439 ; SSE2-SSSE3: # %bb.0:
440 ; SSE2-SSSE3-NEXT: movd %edi, %xmm1
441 ; SSE2-SSSE3-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
442 ; SSE2-SSSE3-NEXT: pshuflw {{.*#+}} xmm0 = xmm1[0,0,1,1,4,5,6,7]
443 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,0,1,1]
444 ; SSE2-SSSE3-NEXT: movdqa {{.*#+}} xmm2 = [1,2,4,8,16,32,64,128,1,2,4,8,16,32,64,128]
445 ; SSE2-SSSE3-NEXT: pand %xmm2, %xmm0
446 ; SSE2-SSSE3-NEXT: pcmpeqb %xmm2, %xmm0
447 ; SSE2-SSSE3-NEXT: psrlw $7, %xmm0
448 ; SSE2-SSSE3-NEXT: movdqa {{.*#+}} xmm3 = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
449 ; SSE2-SSSE3-NEXT: pand %xmm3, %xmm0
450 ; SSE2-SSSE3-NEXT: pshuflw {{.*#+}} xmm1 = xmm1[2,2,3,3,4,5,6,7]
451 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,0,1,1]
452 ; SSE2-SSSE3-NEXT: pand %xmm2, %xmm1
453 ; SSE2-SSSE3-NEXT: pcmpeqb %xmm2, %xmm1
454 ; SSE2-SSSE3-NEXT: psrlw $7, %xmm1
455 ; SSE2-SSSE3-NEXT: pand %xmm3, %xmm1
456 ; SSE2-SSSE3-NEXT: retq
458 ; AVX1-LABEL: ext_i32_32i8:
460 ; AVX1-NEXT: vmovd %edi, %xmm0
461 ; AVX1-NEXT: vpunpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
462 ; AVX1-NEXT: vpshuflw {{.*#+}} xmm1 = xmm0[0,0,1,1,4,5,6,7]
463 ; AVX1-NEXT: vpshuflw {{.*#+}} xmm0 = xmm0[2,2,3,3,4,5,6,7]
464 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0
465 ; AVX1-NEXT: vpermilps {{.*#+}} ymm0 = ymm0[0,0,1,1,4,4,5,5]
466 ; AVX1-NEXT: vandps {{.*}}(%rip), %ymm0, %ymm0
467 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
468 ; AVX1-NEXT: vpxor %xmm2, %xmm2, %xmm2
469 ; AVX1-NEXT: vpcmpeqb %xmm2, %xmm1, %xmm1
470 ; AVX1-NEXT: vpcmpeqd %xmm3, %xmm3, %xmm3
471 ; AVX1-NEXT: vpxor %xmm3, %xmm1, %xmm1
472 ; AVX1-NEXT: vpsrlw $7, %xmm1, %xmm1
473 ; AVX1-NEXT: vmovdqa {{.*#+}} xmm4 = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
474 ; AVX1-NEXT: vpand %xmm4, %xmm1, %xmm1
475 ; AVX1-NEXT: vpcmpeqb %xmm2, %xmm0, %xmm0
476 ; AVX1-NEXT: vpxor %xmm3, %xmm0, %xmm0
477 ; AVX1-NEXT: vpsrlw $7, %xmm0, %xmm0
478 ; AVX1-NEXT: vpand %xmm4, %xmm0, %xmm0
479 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
482 ; AVX2-LABEL: ext_i32_32i8:
484 ; AVX2-NEXT: vmovd %edi, %xmm0
485 ; AVX2-NEXT: vpermq {{.*#+}} ymm0 = ymm0[0,1,0,1]
486 ; AVX2-NEXT: vpshufb {{.*#+}} ymm0 = ymm0[0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19]
487 ; AVX2-NEXT: vpbroadcastq {{.*#+}} ymm1 = [9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745]
488 ; AVX2-NEXT: vpand %ymm1, %ymm0, %ymm0
489 ; AVX2-NEXT: vpcmpeqb %ymm1, %ymm0, %ymm0
490 ; AVX2-NEXT: vpsrlw $7, %ymm0, %ymm0
491 ; AVX2-NEXT: vpand {{.*}}(%rip), %ymm0, %ymm0
494 ; AVX512F-LABEL: ext_i32_32i8:
496 ; AVX512F-NEXT: kmovw %edi, %k1
497 ; AVX512F-NEXT: shrl $16, %edi
498 ; AVX512F-NEXT: kmovw %edi, %k2
499 ; AVX512F-NEXT: movl {{.*}}(%rip), %eax
500 ; AVX512F-NEXT: vpbroadcastd %eax, %zmm0 {%k1} {z}
501 ; AVX512F-NEXT: vpmovdb %zmm0, %xmm0
502 ; AVX512F-NEXT: vpbroadcastd %eax, %zmm1 {%k2} {z}
503 ; AVX512F-NEXT: vpmovdb %zmm1, %xmm1
504 ; AVX512F-NEXT: vinserti128 $1, %xmm1, %ymm0, %ymm0
507 ; AVX512VLBW-LABEL: ext_i32_32i8:
508 ; AVX512VLBW: # %bb.0:
509 ; AVX512VLBW-NEXT: kmovd %edi, %k1
510 ; AVX512VLBW-NEXT: vmovdqu8 {{.*}}(%rip), %ymm0 {%k1} {z}
511 ; AVX512VLBW-NEXT: retq
512 %1 = bitcast i32 %a0 to <32 x i1>
513 %2 = zext <32 x i1> %1 to <32 x i8>
521 define <8 x i64> @ext_i8_8i64(i8 %a0) {
522 ; SSE2-SSSE3-LABEL: ext_i8_8i64:
523 ; SSE2-SSSE3: # %bb.0:
524 ; SSE2-SSSE3-NEXT: movd %edi, %xmm0
525 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm4 = xmm0[0,1,0,1]
526 ; SSE2-SSSE3-NEXT: movdqa {{.*#+}} xmm0 = [1,2]
527 ; SSE2-SSSE3-NEXT: movdqa %xmm4, %xmm1
528 ; SSE2-SSSE3-NEXT: pand %xmm0, %xmm1
529 ; SSE2-SSSE3-NEXT: pcmpeqd %xmm0, %xmm1
530 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,0,3,2]
531 ; SSE2-SSSE3-NEXT: pand %xmm1, %xmm0
532 ; SSE2-SSSE3-NEXT: psrlq $63, %xmm0
533 ; SSE2-SSSE3-NEXT: movdqa {{.*#+}} xmm1 = [4,8]
534 ; SSE2-SSSE3-NEXT: movdqa %xmm4, %xmm2
535 ; SSE2-SSSE3-NEXT: pand %xmm1, %xmm2
536 ; SSE2-SSSE3-NEXT: pcmpeqd %xmm1, %xmm2
537 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm1 = xmm2[1,0,3,2]
538 ; SSE2-SSSE3-NEXT: pand %xmm2, %xmm1
539 ; SSE2-SSSE3-NEXT: psrlq $63, %xmm1
540 ; SSE2-SSSE3-NEXT: movdqa {{.*#+}} xmm2 = [16,32]
541 ; SSE2-SSSE3-NEXT: movdqa %xmm4, %xmm3
542 ; SSE2-SSSE3-NEXT: pand %xmm2, %xmm3
543 ; SSE2-SSSE3-NEXT: pcmpeqd %xmm2, %xmm3
544 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm2 = xmm3[1,0,3,2]
545 ; SSE2-SSSE3-NEXT: pand %xmm3, %xmm2
546 ; SSE2-SSSE3-NEXT: psrlq $63, %xmm2
547 ; SSE2-SSSE3-NEXT: movdqa {{.*#+}} xmm3 = [64,128]
548 ; SSE2-SSSE3-NEXT: pand %xmm3, %xmm4
549 ; SSE2-SSSE3-NEXT: pcmpeqd %xmm3, %xmm4
550 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm3 = xmm4[1,0,3,2]
551 ; SSE2-SSSE3-NEXT: pand %xmm4, %xmm3
552 ; SSE2-SSSE3-NEXT: psrlq $63, %xmm3
553 ; SSE2-SSSE3-NEXT: retq
555 ; AVX1-LABEL: ext_i8_8i64:
557 ; AVX1-NEXT: vmovd %edi, %xmm0
558 ; AVX1-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[0,1,0,1]
559 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm1
560 ; AVX1-NEXT: vandps {{.*}}(%rip), %ymm1, %ymm0
561 ; AVX1-NEXT: vpxor %xmm2, %xmm2, %xmm2
562 ; AVX1-NEXT: vpcmpeqq %xmm2, %xmm0, %xmm3
563 ; AVX1-NEXT: vpcmpeqd %xmm4, %xmm4, %xmm4
564 ; AVX1-NEXT: vpxor %xmm4, %xmm3, %xmm3
565 ; AVX1-NEXT: vpsrlq $63, %xmm3, %xmm3
566 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm0
567 ; AVX1-NEXT: vpcmpeqq %xmm2, %xmm0, %xmm0
568 ; AVX1-NEXT: vpxor %xmm4, %xmm0, %xmm0
569 ; AVX1-NEXT: vpsrlq $63, %xmm0, %xmm0
570 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm3, %ymm0
571 ; AVX1-NEXT: vandps {{.*}}(%rip), %ymm1, %ymm1
572 ; AVX1-NEXT: vpcmpeqq %xmm2, %xmm1, %xmm3
573 ; AVX1-NEXT: vpxor %xmm4, %xmm3, %xmm3
574 ; AVX1-NEXT: vpsrlq $63, %xmm3, %xmm3
575 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm1
576 ; AVX1-NEXT: vpcmpeqq %xmm2, %xmm1, %xmm1
577 ; AVX1-NEXT: vpxor %xmm4, %xmm1, %xmm1
578 ; AVX1-NEXT: vpsrlq $63, %xmm1, %xmm1
579 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm3, %ymm1
582 ; AVX2-LABEL: ext_i8_8i64:
584 ; AVX2-NEXT: # kill: def $edi killed $edi def $rdi
585 ; AVX2-NEXT: vmovq %rdi, %xmm0
586 ; AVX2-NEXT: vpbroadcastq %xmm0, %ymm1
587 ; AVX2-NEXT: vmovdqa {{.*#+}} ymm0 = [1,2,4,8]
588 ; AVX2-NEXT: vpand %ymm0, %ymm1, %ymm2
589 ; AVX2-NEXT: vpcmpeqq %ymm0, %ymm2, %ymm0
590 ; AVX2-NEXT: vpsrlq $63, %ymm0, %ymm0
591 ; AVX2-NEXT: vmovdqa {{.*#+}} ymm2 = [16,32,64,128]
592 ; AVX2-NEXT: vpand %ymm2, %ymm1, %ymm1
593 ; AVX2-NEXT: vpcmpeqq %ymm2, %ymm1, %ymm1
594 ; AVX2-NEXT: vpsrlq $63, %ymm1, %ymm1
597 ; AVX512F-LABEL: ext_i8_8i64:
599 ; AVX512F-NEXT: kmovw %edi, %k1
600 ; AVX512F-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
601 ; AVX512F-NEXT: vpsrlq $63, %zmm0, %zmm0
604 ; AVX512VLBW-LABEL: ext_i8_8i64:
605 ; AVX512VLBW: # %bb.0:
606 ; AVX512VLBW-NEXT: kmovd %edi, %k1
607 ; AVX512VLBW-NEXT: vpternlogq $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
608 ; AVX512VLBW-NEXT: vpsrlq $63, %zmm0, %zmm0
609 ; AVX512VLBW-NEXT: retq
610 %1 = bitcast i8 %a0 to <8 x i1>
611 %2 = zext <8 x i1> %1 to <8 x i64>
615 define <16 x i32> @ext_i16_16i32(i16 %a0) {
616 ; SSE2-SSSE3-LABEL: ext_i16_16i32:
617 ; SSE2-SSSE3: # %bb.0:
618 ; SSE2-SSSE3-NEXT: movd %edi, %xmm0
619 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm3 = xmm0[0,0,0,0]
620 ; SSE2-SSSE3-NEXT: movdqa {{.*#+}} xmm1 = [1,2,4,8]
621 ; SSE2-SSSE3-NEXT: movdqa %xmm3, %xmm0
622 ; SSE2-SSSE3-NEXT: pand %xmm1, %xmm0
623 ; SSE2-SSSE3-NEXT: pcmpeqd %xmm1, %xmm0
624 ; SSE2-SSSE3-NEXT: psrld $31, %xmm0
625 ; SSE2-SSSE3-NEXT: movdqa {{.*#+}} xmm2 = [16,32,64,128]
626 ; SSE2-SSSE3-NEXT: movdqa %xmm3, %xmm1
627 ; SSE2-SSSE3-NEXT: pand %xmm2, %xmm1
628 ; SSE2-SSSE3-NEXT: pcmpeqd %xmm2, %xmm1
629 ; SSE2-SSSE3-NEXT: psrld $31, %xmm1
630 ; SSE2-SSSE3-NEXT: movdqa {{.*#+}} xmm4 = [256,512,1024,2048]
631 ; SSE2-SSSE3-NEXT: movdqa %xmm3, %xmm2
632 ; SSE2-SSSE3-NEXT: pand %xmm4, %xmm2
633 ; SSE2-SSSE3-NEXT: pcmpeqd %xmm4, %xmm2
634 ; SSE2-SSSE3-NEXT: psrld $31, %xmm2
635 ; SSE2-SSSE3-NEXT: movdqa {{.*#+}} xmm4 = [4096,8192,16384,32768]
636 ; SSE2-SSSE3-NEXT: pand %xmm4, %xmm3
637 ; SSE2-SSSE3-NEXT: pcmpeqd %xmm4, %xmm3
638 ; SSE2-SSSE3-NEXT: psrld $31, %xmm3
639 ; SSE2-SSSE3-NEXT: retq
641 ; AVX1-LABEL: ext_i16_16i32:
643 ; AVX1-NEXT: vmovd %edi, %xmm0
644 ; AVX1-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[0,0,0,0]
645 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm1
646 ; AVX1-NEXT: vandps {{.*}}(%rip), %ymm1, %ymm0
647 ; AVX1-NEXT: vpxor %xmm2, %xmm2, %xmm2
648 ; AVX1-NEXT: vpcmpeqd %xmm2, %xmm0, %xmm3
649 ; AVX1-NEXT: vpcmpeqd %xmm4, %xmm4, %xmm4
650 ; AVX1-NEXT: vpxor %xmm4, %xmm3, %xmm3
651 ; AVX1-NEXT: vpsrld $31, %xmm3, %xmm3
652 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm0
653 ; AVX1-NEXT: vpcmpeqd %xmm2, %xmm0, %xmm0
654 ; AVX1-NEXT: vpxor %xmm4, %xmm0, %xmm0
655 ; AVX1-NEXT: vpsrld $31, %xmm0, %xmm0
656 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm3, %ymm0
657 ; AVX1-NEXT: vandps {{.*}}(%rip), %ymm1, %ymm1
658 ; AVX1-NEXT: vpcmpeqd %xmm2, %xmm1, %xmm3
659 ; AVX1-NEXT: vpxor %xmm4, %xmm3, %xmm3
660 ; AVX1-NEXT: vpsrld $31, %xmm3, %xmm3
661 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm1
662 ; AVX1-NEXT: vpcmpeqd %xmm2, %xmm1, %xmm1
663 ; AVX1-NEXT: vpxor %xmm4, %xmm1, %xmm1
664 ; AVX1-NEXT: vpsrld $31, %xmm1, %xmm1
665 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm3, %ymm1
668 ; AVX2-LABEL: ext_i16_16i32:
670 ; AVX2-NEXT: vmovd %edi, %xmm0
671 ; AVX2-NEXT: vpbroadcastd %xmm0, %ymm1
672 ; AVX2-NEXT: vmovdqa {{.*#+}} ymm0 = [1,2,4,8,16,32,64,128]
673 ; AVX2-NEXT: vpand %ymm0, %ymm1, %ymm2
674 ; AVX2-NEXT: vpcmpeqd %ymm0, %ymm2, %ymm0
675 ; AVX2-NEXT: vpsrld $31, %ymm0, %ymm0
676 ; AVX2-NEXT: vmovdqa {{.*#+}} ymm2 = [256,512,1024,2048,4096,8192,16384,32768]
677 ; AVX2-NEXT: vpand %ymm2, %ymm1, %ymm1
678 ; AVX2-NEXT: vpcmpeqd %ymm2, %ymm1, %ymm1
679 ; AVX2-NEXT: vpsrld $31, %ymm1, %ymm1
682 ; AVX512F-LABEL: ext_i16_16i32:
684 ; AVX512F-NEXT: kmovw %edi, %k1
685 ; AVX512F-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
686 ; AVX512F-NEXT: vpsrld $31, %zmm0, %zmm0
689 ; AVX512VLBW-LABEL: ext_i16_16i32:
690 ; AVX512VLBW: # %bb.0:
691 ; AVX512VLBW-NEXT: kmovd %edi, %k1
692 ; AVX512VLBW-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
693 ; AVX512VLBW-NEXT: vpsrld $31, %zmm0, %zmm0
694 ; AVX512VLBW-NEXT: retq
695 %1 = bitcast i16 %a0 to <16 x i1>
696 %2 = zext <16 x i1> %1 to <16 x i32>
700 define <32 x i16> @ext_i32_32i16(i32 %a0) {
701 ; SSE2-SSSE3-LABEL: ext_i32_32i16:
702 ; SSE2-SSSE3: # %bb.0:
703 ; SSE2-SSSE3-NEXT: movd %edi, %xmm2
704 ; SSE2-SSSE3-NEXT: pshuflw {{.*#+}} xmm0 = xmm2[0,0,2,3,4,5,6,7]
705 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm1 = xmm0[0,0,0,0]
706 ; SSE2-SSSE3-NEXT: movdqa {{.*#+}} xmm4 = [1,2,4,8,16,32,64,128]
707 ; SSE2-SSSE3-NEXT: movdqa %xmm1, %xmm0
708 ; SSE2-SSSE3-NEXT: pand %xmm4, %xmm0
709 ; SSE2-SSSE3-NEXT: pcmpeqw %xmm4, %xmm0
710 ; SSE2-SSSE3-NEXT: psrlw $15, %xmm0
711 ; SSE2-SSSE3-NEXT: movdqa {{.*#+}} xmm5 = [256,512,1024,2048,4096,8192,16384,32768]
712 ; SSE2-SSSE3-NEXT: pand %xmm5, %xmm1
713 ; SSE2-SSSE3-NEXT: pcmpeqw %xmm5, %xmm1
714 ; SSE2-SSSE3-NEXT: psrlw $15, %xmm1
715 ; SSE2-SSSE3-NEXT: pshuflw {{.*#+}} xmm2 = xmm2[1,1,2,3,4,5,6,7]
716 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm3 = xmm2[0,0,0,0]
717 ; SSE2-SSSE3-NEXT: movdqa %xmm3, %xmm2
718 ; SSE2-SSSE3-NEXT: pand %xmm4, %xmm2
719 ; SSE2-SSSE3-NEXT: pcmpeqw %xmm4, %xmm2
720 ; SSE2-SSSE3-NEXT: psrlw $15, %xmm2
721 ; SSE2-SSSE3-NEXT: pand %xmm5, %xmm3
722 ; SSE2-SSSE3-NEXT: pcmpeqw %xmm5, %xmm3
723 ; SSE2-SSSE3-NEXT: psrlw $15, %xmm3
724 ; SSE2-SSSE3-NEXT: retq
726 ; AVX1-LABEL: ext_i32_32i16:
728 ; AVX1-NEXT: vmovd %edi, %xmm1
729 ; AVX1-NEXT: vpshuflw {{.*#+}} xmm0 = xmm1[0,0,2,3,4,5,6,7]
730 ; AVX1-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[0,0,0,0]
731 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
732 ; AVX1-NEXT: vmovaps {{.*#+}} ymm2 = [1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768]
733 ; AVX1-NEXT: vandps %ymm2, %ymm0, %ymm0
734 ; AVX1-NEXT: vpxor %xmm3, %xmm3, %xmm3
735 ; AVX1-NEXT: vpcmpeqw %xmm3, %xmm0, %xmm4
736 ; AVX1-NEXT: vpcmpeqd %xmm5, %xmm5, %xmm5
737 ; AVX1-NEXT: vpxor %xmm5, %xmm4, %xmm4
738 ; AVX1-NEXT: vpsrlw $15, %xmm4, %xmm4
739 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm0
740 ; AVX1-NEXT: vpcmpeqw %xmm3, %xmm0, %xmm0
741 ; AVX1-NEXT: vpxor %xmm5, %xmm0, %xmm0
742 ; AVX1-NEXT: vpsrlw $15, %xmm0, %xmm0
743 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm4, %ymm0
744 ; AVX1-NEXT: vpshuflw {{.*#+}} xmm1 = xmm1[1,1,2,3,4,5,6,7]
745 ; AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[0,0,0,0]
746 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm1, %ymm1
747 ; AVX1-NEXT: vandps %ymm2, %ymm1, %ymm1
748 ; AVX1-NEXT: vpcmpeqw %xmm3, %xmm1, %xmm2
749 ; AVX1-NEXT: vpxor %xmm5, %xmm2, %xmm2
750 ; AVX1-NEXT: vpsrlw $15, %xmm2, %xmm2
751 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm1
752 ; AVX1-NEXT: vpcmpeqw %xmm3, %xmm1, %xmm1
753 ; AVX1-NEXT: vpxor %xmm5, %xmm1, %xmm1
754 ; AVX1-NEXT: vpsrlw $15, %xmm1, %xmm1
755 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm2, %ymm1
758 ; AVX2-LABEL: ext_i32_32i16:
760 ; AVX2-NEXT: vmovd %edi, %xmm0
761 ; AVX2-NEXT: vpbroadcastw %xmm0, %ymm0
762 ; AVX2-NEXT: vmovdqa {{.*#+}} ymm1 = [1,2,4,8,16,32,64,128,256,512,1024,2048,4096,8192,16384,32768]
763 ; AVX2-NEXT: vpand %ymm1, %ymm0, %ymm0
764 ; AVX2-NEXT: vpcmpeqw %ymm1, %ymm0, %ymm0
765 ; AVX2-NEXT: vpsrlw $15, %ymm0, %ymm0
766 ; AVX2-NEXT: shrl $16, %edi
767 ; AVX2-NEXT: vmovd %edi, %xmm2
768 ; AVX2-NEXT: vpbroadcastw %xmm2, %ymm2
769 ; AVX2-NEXT: vpand %ymm1, %ymm2, %ymm2
770 ; AVX2-NEXT: vpcmpeqw %ymm1, %ymm2, %ymm1
771 ; AVX2-NEXT: vpsrlw $15, %ymm1, %ymm1
774 ; AVX512F-LABEL: ext_i32_32i16:
776 ; AVX512F-NEXT: kmovw %edi, %k1
777 ; AVX512F-NEXT: shrl $16, %edi
778 ; AVX512F-NEXT: kmovw %edi, %k2
779 ; AVX512F-NEXT: vpternlogd $255, %zmm0, %zmm0, %zmm0 {%k1} {z}
780 ; AVX512F-NEXT: vpmovdw %zmm0, %ymm0
781 ; AVX512F-NEXT: vpsrlw $15, %ymm0, %ymm0
782 ; AVX512F-NEXT: vpternlogd $255, %zmm1, %zmm1, %zmm1 {%k2} {z}
783 ; AVX512F-NEXT: vpmovdw %zmm1, %ymm1
784 ; AVX512F-NEXT: vpsrlw $15, %ymm1, %ymm1
787 ; AVX512VLBW-LABEL: ext_i32_32i16:
788 ; AVX512VLBW: # %bb.0:
789 ; AVX512VLBW-NEXT: kmovd %edi, %k0
790 ; AVX512VLBW-NEXT: vpmovm2w %k0, %zmm0
791 ; AVX512VLBW-NEXT: vpsrlw $15, %zmm0, %zmm0
792 ; AVX512VLBW-NEXT: retq
793 %1 = bitcast i32 %a0 to <32 x i1>
794 %2 = zext <32 x i1> %1 to <32 x i16>
798 define <64 x i8> @ext_i64_64i8(i64 %a0) {
799 ; SSE2-SSSE3-LABEL: ext_i64_64i8:
800 ; SSE2-SSSE3: # %bb.0:
801 ; SSE2-SSSE3-NEXT: movq %rdi, %xmm3
802 ; SSE2-SSSE3-NEXT: punpcklbw {{.*#+}} xmm3 = xmm3[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
803 ; SSE2-SSSE3-NEXT: pshuflw {{.*#+}} xmm0 = xmm3[0,0,1,1,4,5,6,7]
804 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,0,1,1]
805 ; SSE2-SSSE3-NEXT: movdqa {{.*#+}} xmm4 = [1,2,4,8,16,32,64,128,1,2,4,8,16,32,64,128]
806 ; SSE2-SSSE3-NEXT: pand %xmm4, %xmm0
807 ; SSE2-SSSE3-NEXT: pcmpeqb %xmm4, %xmm0
808 ; SSE2-SSSE3-NEXT: psrlw $7, %xmm0
809 ; SSE2-SSSE3-NEXT: movdqa {{.*#+}} xmm5 = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
810 ; SSE2-SSSE3-NEXT: pand %xmm5, %xmm0
811 ; SSE2-SSSE3-NEXT: pshuflw {{.*#+}} xmm1 = xmm3[2,2,3,3,4,5,6,7]
812 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,0,1,1]
813 ; SSE2-SSSE3-NEXT: pand %xmm4, %xmm1
814 ; SSE2-SSSE3-NEXT: pcmpeqb %xmm4, %xmm1
815 ; SSE2-SSSE3-NEXT: psrlw $7, %xmm1
816 ; SSE2-SSSE3-NEXT: pand %xmm5, %xmm1
817 ; SSE2-SSSE3-NEXT: pshufhw {{.*#+}} xmm2 = xmm3[0,1,2,3,4,4,5,5]
818 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm2 = xmm2[2,2,3,3]
819 ; SSE2-SSSE3-NEXT: pand %xmm4, %xmm2
820 ; SSE2-SSSE3-NEXT: pcmpeqb %xmm4, %xmm2
821 ; SSE2-SSSE3-NEXT: psrlw $7, %xmm2
822 ; SSE2-SSSE3-NEXT: pand %xmm5, %xmm2
823 ; SSE2-SSSE3-NEXT: pshufhw {{.*#+}} xmm3 = xmm3[0,1,2,3,6,6,7,7]
824 ; SSE2-SSSE3-NEXT: pshufd {{.*#+}} xmm3 = xmm3[2,2,3,3]
825 ; SSE2-SSSE3-NEXT: pand %xmm4, %xmm3
826 ; SSE2-SSSE3-NEXT: pcmpeqb %xmm4, %xmm3
827 ; SSE2-SSSE3-NEXT: psrlw $7, %xmm3
828 ; SSE2-SSSE3-NEXT: pand %xmm5, %xmm3
829 ; SSE2-SSSE3-NEXT: retq
831 ; AVX1-LABEL: ext_i64_64i8:
833 ; AVX1-NEXT: vmovq %rdi, %xmm0
834 ; AVX1-NEXT: vpunpcklbw {{.*#+}} xmm1 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
835 ; AVX1-NEXT: vpshuflw {{.*#+}} xmm0 = xmm1[0,0,1,1,4,5,6,7]
836 ; AVX1-NEXT: vpshuflw {{.*#+}} xmm2 = xmm1[2,2,3,3,4,5,6,7]
837 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
838 ; AVX1-NEXT: vpermilps {{.*#+}} ymm0 = ymm0[0,0,1,1,4,4,5,5]
839 ; AVX1-NEXT: vbroadcastsd {{.*#+}} ymm2 = [-1.7939930131212661E-307,-1.7939930131212661E-307,-1.7939930131212661E-307,-1.7939930131212661E-307]
840 ; AVX1-NEXT: vandps %ymm2, %ymm0, %ymm0
841 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
842 ; AVX1-NEXT: vpxor %xmm4, %xmm4, %xmm4
843 ; AVX1-NEXT: vpcmpeqb %xmm4, %xmm3, %xmm3
844 ; AVX1-NEXT: vpcmpeqd %xmm5, %xmm5, %xmm5
845 ; AVX1-NEXT: vpxor %xmm5, %xmm3, %xmm3
846 ; AVX1-NEXT: vpsrlw $7, %xmm3, %xmm3
847 ; AVX1-NEXT: vmovdqa {{.*#+}} xmm6 = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
848 ; AVX1-NEXT: vpand %xmm6, %xmm3, %xmm3
849 ; AVX1-NEXT: vpcmpeqb %xmm4, %xmm0, %xmm0
850 ; AVX1-NEXT: vpxor %xmm5, %xmm0, %xmm0
851 ; AVX1-NEXT: vpsrlw $7, %xmm0, %xmm0
852 ; AVX1-NEXT: vpand %xmm6, %xmm0, %xmm0
853 ; AVX1-NEXT: vinsertf128 $1, %xmm3, %ymm0, %ymm0
854 ; AVX1-NEXT: vpshufhw {{.*#+}} xmm3 = xmm1[0,1,2,3,4,4,5,5]
855 ; AVX1-NEXT: vpshufhw {{.*#+}} xmm1 = xmm1[0,1,2,3,6,6,7,7]
856 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm3, %ymm1
857 ; AVX1-NEXT: vpermilps {{.*#+}} ymm1 = ymm1[2,2,3,3,6,6,7,7]
858 ; AVX1-NEXT: vandps %ymm2, %ymm1, %ymm1
859 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
860 ; AVX1-NEXT: vpcmpeqb %xmm4, %xmm2, %xmm2
861 ; AVX1-NEXT: vpxor %xmm5, %xmm2, %xmm2
862 ; AVX1-NEXT: vpsrlw $7, %xmm2, %xmm2
863 ; AVX1-NEXT: vpand %xmm6, %xmm2, %xmm2
864 ; AVX1-NEXT: vpcmpeqb %xmm4, %xmm1, %xmm1
865 ; AVX1-NEXT: vpxor %xmm5, %xmm1, %xmm1
866 ; AVX1-NEXT: vpsrlw $7, %xmm1, %xmm1
867 ; AVX1-NEXT: vpand %xmm6, %xmm1, %xmm1
868 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm1, %ymm1
871 ; AVX2-LABEL: ext_i64_64i8:
873 ; AVX2-NEXT: vmovq %rdi, %xmm0
874 ; AVX2-NEXT: vpermq {{.*#+}} ymm1 = ymm0[0,1,0,1]
875 ; AVX2-NEXT: vpshufb {{.*#+}} ymm0 = ymm1[0,0,0,0,0,0,0,0,1,1,1,1,1,1,1,1,18,18,18,18,18,18,18,18,19,19,19,19,19,19,19,19]
876 ; AVX2-NEXT: vpbroadcastq {{.*#+}} ymm2 = [9241421688590303745,9241421688590303745,9241421688590303745,9241421688590303745]
877 ; AVX2-NEXT: vpand %ymm2, %ymm0, %ymm0
878 ; AVX2-NEXT: vpcmpeqb %ymm2, %ymm0, %ymm0
879 ; AVX2-NEXT: vpsrlw $7, %ymm0, %ymm0
880 ; AVX2-NEXT: vmovdqa {{.*#+}} ymm3 = [1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
881 ; AVX2-NEXT: vpand %ymm3, %ymm0, %ymm0
882 ; AVX2-NEXT: vpshufb {{.*#+}} ymm1 = ymm1[4,4,4,4,4,4,4,4,5,5,5,5,5,5,5,5,22,22,22,22,22,22,22,22,23,23,23,23,23,23,23,23]
883 ; AVX2-NEXT: vpand %ymm2, %ymm1, %ymm1
884 ; AVX2-NEXT: vpcmpeqb %ymm2, %ymm1, %ymm1
885 ; AVX2-NEXT: vpsrlw $7, %ymm1, %ymm1
886 ; AVX2-NEXT: vpand %ymm3, %ymm1, %ymm1
889 ; AVX512F-LABEL: ext_i64_64i8:
891 ; AVX512F-NEXT: movq %rdi, %rax
892 ; AVX512F-NEXT: movq %rdi, %rcx
893 ; AVX512F-NEXT: kmovw %edi, %k1
894 ; AVX512F-NEXT: movl %edi, %edx
895 ; AVX512F-NEXT: shrl $16, %edx
896 ; AVX512F-NEXT: shrq $32, %rax
897 ; AVX512F-NEXT: shrq $48, %rcx
898 ; AVX512F-NEXT: kmovw %ecx, %k2
899 ; AVX512F-NEXT: kmovw %eax, %k3
900 ; AVX512F-NEXT: kmovw %edx, %k4
901 ; AVX512F-NEXT: movl {{.*}}(%rip), %eax
902 ; AVX512F-NEXT: vpbroadcastd %eax, %zmm0 {%k1} {z}
903 ; AVX512F-NEXT: vpmovdb %zmm0, %xmm0
904 ; AVX512F-NEXT: vpbroadcastd %eax, %zmm1 {%k4} {z}
905 ; AVX512F-NEXT: vpmovdb %zmm1, %xmm1
906 ; AVX512F-NEXT: vinserti128 $1, %xmm1, %ymm0, %ymm0
907 ; AVX512F-NEXT: vpbroadcastd %eax, %zmm1 {%k3} {z}
908 ; AVX512F-NEXT: vpmovdb %zmm1, %xmm1
909 ; AVX512F-NEXT: vpbroadcastd %eax, %zmm2 {%k2} {z}
910 ; AVX512F-NEXT: vpmovdb %zmm2, %xmm2
911 ; AVX512F-NEXT: vinserti128 $1, %xmm2, %ymm1, %ymm1
914 ; AVX512VLBW-LABEL: ext_i64_64i8:
915 ; AVX512VLBW: # %bb.0:
916 ; AVX512VLBW-NEXT: kmovq %rdi, %k1
917 ; AVX512VLBW-NEXT: vmovdqu8 {{.*}}(%rip), %zmm0 {%k1} {z}
918 ; AVX512VLBW-NEXT: retq
919 %1 = bitcast i64 %a0 to <64 x i1>
920 %2 = zext <64 x i1> %1 to <64 x i8>