1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-- -mattr=+sse2 | FileCheck %s --check-prefixes=SSE,SSE2
3 ; RUN: llc < %s -mtriple=x86_64-- -mattr=+sse4.1 | FileCheck %s --check-prefixes=SSE,SSE41
4 ; RUN: llc < %s -mtriple=x86_64-- -mattr=+avx | FileCheck %s --check-prefix=AVX
6 define <2 x i64> @extract0_i32_zext_insert0_i64_undef(<4 x i32> %x) {
7 ; SSE2-LABEL: extract0_i32_zext_insert0_i64_undef:
9 ; SSE2-NEXT: xorps %xmm1, %xmm1
10 ; SSE2-NEXT: unpcklps {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
13 ; SSE41-LABEL: extract0_i32_zext_insert0_i64_undef:
15 ; SSE41-NEXT: pmovzxdq {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero
18 ; AVX-LABEL: extract0_i32_zext_insert0_i64_undef:
20 ; AVX-NEXT: vpmovzxdq {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero
22 %e = extractelement <4 x i32> %x, i32 0
23 %z = zext i32 %e to i64
24 %r = insertelement <2 x i64> undef, i64 %z, i32 0
28 define <2 x i64> @extract0_i32_zext_insert0_i64_zero(<4 x i32> %x) {
29 ; SSE2-LABEL: extract0_i32_zext_insert0_i64_zero:
31 ; SSE2-NEXT: xorps %xmm1, %xmm1
32 ; SSE2-NEXT: movss {{.*#+}} xmm1 = xmm0[0],xmm1[1,2,3]
33 ; SSE2-NEXT: movaps %xmm1, %xmm0
36 ; SSE41-LABEL: extract0_i32_zext_insert0_i64_zero:
38 ; SSE41-NEXT: xorps %xmm1, %xmm1
39 ; SSE41-NEXT: blendps {{.*#+}} xmm0 = xmm0[0],xmm1[1,2,3]
42 ; AVX-LABEL: extract0_i32_zext_insert0_i64_zero:
44 ; AVX-NEXT: vxorps %xmm1, %xmm1, %xmm1
45 ; AVX-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0],xmm1[1,2,3]
47 %e = extractelement <4 x i32> %x, i32 0
48 %z = zext i32 %e to i64
49 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 0
53 define <2 x i64> @extract1_i32_zext_insert0_i64_undef(<4 x i32> %x) {
54 ; SSE-LABEL: extract1_i32_zext_insert0_i64_undef:
56 ; SSE-NEXT: psrlq $32, %xmm0
59 ; AVX-LABEL: extract1_i32_zext_insert0_i64_undef:
61 ; AVX-NEXT: vpsrlq $32, %xmm0, %xmm0
63 %e = extractelement <4 x i32> %x, i32 1
64 %z = zext i32 %e to i64
65 %r = insertelement <2 x i64> undef, i64 %z, i32 0
69 define <2 x i64> @extract1_i32_zext_insert0_i64_zero(<4 x i32> %x) {
70 ; SSE2-LABEL: extract1_i32_zext_insert0_i64_zero:
72 ; SSE2-NEXT: xorps %xmm1, %xmm1
73 ; SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[1,0],xmm1[1,0]
74 ; SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,2],xmm1[2,3]
77 ; SSE41-LABEL: extract1_i32_zext_insert0_i64_zero:
79 ; SSE41-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
80 ; SSE41-NEXT: pxor %xmm0, %xmm0
81 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm1[0,1],xmm0[2,3,4,5,6,7]
84 ; AVX-LABEL: extract1_i32_zext_insert0_i64_zero:
86 ; AVX-NEXT: vshufps {{.*#+}} xmm0 = xmm0[1,1,1,1]
87 ; AVX-NEXT: vxorps %xmm1, %xmm1, %xmm1
88 ; AVX-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0],xmm1[1,2,3]
90 %e = extractelement <4 x i32> %x, i32 1
91 %z = zext i32 %e to i64
92 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 0
96 define <2 x i64> @extract2_i32_zext_insert0_i64_undef(<4 x i32> %x) {
97 ; SSE-LABEL: extract2_i32_zext_insert0_i64_undef:
99 ; SSE-NEXT: xorps %xmm1, %xmm1
100 ; SSE-NEXT: unpckhps {{.*#+}} xmm0 = xmm0[2],xmm1[2],xmm0[3],xmm1[3]
103 ; AVX-LABEL: extract2_i32_zext_insert0_i64_undef:
105 ; AVX-NEXT: vxorps %xmm1, %xmm1, %xmm1
106 ; AVX-NEXT: vunpckhps {{.*#+}} xmm0 = xmm0[2],xmm1[2],xmm0[3],xmm1[3]
108 %e = extractelement <4 x i32> %x, i32 2
109 %z = zext i32 %e to i64
110 %r = insertelement <2 x i64> undef, i64 %z, i32 0
114 define <2 x i64> @extract2_i32_zext_insert0_i64_zero(<4 x i32> %x) {
115 ; SSE2-LABEL: extract2_i32_zext_insert0_i64_zero:
117 ; SSE2-NEXT: psrldq {{.*#+}} xmm0 = xmm0[8,9,10,11,12,13,14,15],zero,zero,zero,zero,zero,zero,zero,zero
118 ; SSE2-NEXT: xorps %xmm1, %xmm1
119 ; SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,2],xmm1[2,3]
122 ; SSE41-LABEL: extract2_i32_zext_insert0_i64_zero:
124 ; SSE41-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
125 ; SSE41-NEXT: pxor %xmm0, %xmm0
126 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm1[0,1],xmm0[2,3,4,5,6,7]
129 ; AVX-LABEL: extract2_i32_zext_insert0_i64_zero:
131 ; AVX-NEXT: vshufps {{.*#+}} xmm0 = xmm0[2,3,2,3]
132 ; AVX-NEXT: vxorps %xmm1, %xmm1, %xmm1
133 ; AVX-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0],xmm1[1,2,3]
135 %e = extractelement <4 x i32> %x, i32 2
136 %z = zext i32 %e to i64
137 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 0
141 define <2 x i64> @extract3_i32_zext_insert0_i64_undef(<4 x i32> %x) {
142 ; SSE-LABEL: extract3_i32_zext_insert0_i64_undef:
144 ; SSE-NEXT: psrldq {{.*#+}} xmm0 = xmm0[12,13,14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
147 ; AVX-LABEL: extract3_i32_zext_insert0_i64_undef:
149 ; AVX-NEXT: vpsrldq {{.*#+}} xmm0 = xmm0[12,13,14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
151 %e = extractelement <4 x i32> %x, i32 3
152 %z = zext i32 %e to i64
153 %r = insertelement <2 x i64> undef, i64 %z, i32 0
157 define <2 x i64> @extract3_i32_zext_insert0_i64_zero(<4 x i32> %x) {
158 ; SSE-LABEL: extract3_i32_zext_insert0_i64_zero:
160 ; SSE-NEXT: psrldq {{.*#+}} xmm0 = xmm0[12,13,14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
163 ; AVX-LABEL: extract3_i32_zext_insert0_i64_zero:
165 ; AVX-NEXT: vpsrldq {{.*#+}} xmm0 = xmm0[12,13,14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
167 %e = extractelement <4 x i32> %x, i32 3
168 %z = zext i32 %e to i64
169 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 0
173 define <2 x i64> @extract0_i32_zext_insert1_i64_undef(<4 x i32> %x) {
174 ; SSE2-LABEL: extract0_i32_zext_insert1_i64_undef:
176 ; SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,0,1,1]
177 ; SSE2-NEXT: pxor %xmm1, %xmm1
178 ; SSE2-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
181 ; SSE41-LABEL: extract0_i32_zext_insert1_i64_undef:
183 ; SSE41-NEXT: pshufd {{.*#+}} xmm1 = xmm0[0,1,0,1]
184 ; SSE41-NEXT: pxor %xmm0, %xmm0
185 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm1[0,1,2,3,4,5],xmm0[6,7]
188 ; AVX-LABEL: extract0_i32_zext_insert1_i64_undef:
190 ; AVX-NEXT: vshufps {{.*#+}} xmm0 = xmm0[0,1,0,1]
191 ; AVX-NEXT: vxorps %xmm1, %xmm1, %xmm1
192 ; AVX-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0,1,2],xmm1[3]
194 %e = extractelement <4 x i32> %x, i32 0
195 %z = zext i32 %e to i64
196 %r = insertelement <2 x i64> undef, i64 %z, i32 1
200 define <2 x i64> @extract0_i32_zext_insert1_i64_zero(<4 x i32> %x) {
201 ; SSE2-LABEL: extract0_i32_zext_insert1_i64_zero:
203 ; SSE2-NEXT: xorps %xmm1, %xmm1
204 ; SSE2-NEXT: movss {{.*#+}} xmm1 = xmm0[0],xmm1[1,2,3]
205 ; SSE2-NEXT: pslldq {{.*#+}} xmm1 = zero,zero,zero,zero,zero,zero,zero,zero,xmm1[0,1,2,3,4,5,6,7]
206 ; SSE2-NEXT: movdqa %xmm1, %xmm0
209 ; SSE41-LABEL: extract0_i32_zext_insert1_i64_zero:
211 ; SSE41-NEXT: pxor %xmm1, %xmm1
212 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm0[0,1],xmm1[2,3,4,5,6,7]
213 ; SSE41-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
216 ; AVX-LABEL: extract0_i32_zext_insert1_i64_zero:
218 ; AVX-NEXT: vpxor %xmm1, %xmm1, %xmm1
219 ; AVX-NEXT: vpblendw {{.*#+}} xmm0 = xmm0[0,1],xmm1[2,3,4,5,6,7]
220 ; AVX-NEXT: vpslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
222 %e = extractelement <4 x i32> %x, i32 0
223 %z = zext i32 %e to i64
224 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 1
228 define <2 x i64> @extract1_i32_zext_insert1_i64_undef(<4 x i32> %x) {
229 ; SSE2-LABEL: extract1_i32_zext_insert1_i64_undef:
231 ; SSE2-NEXT: xorps %xmm1, %xmm1
232 ; SSE2-NEXT: unpcklps {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
235 ; SSE41-LABEL: extract1_i32_zext_insert1_i64_undef:
237 ; SSE41-NEXT: pmovzxdq {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero
240 ; AVX-LABEL: extract1_i32_zext_insert1_i64_undef:
242 ; AVX-NEXT: vpmovzxdq {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero
244 %e = extractelement <4 x i32> %x, i32 1
245 %z = zext i32 %e to i64
246 %r = insertelement <2 x i64> undef, i64 %z, i32 1
250 define <2 x i64> @extract1_i32_zext_insert1_i64_zero(<4 x i32> %x) {
251 ; SSE2-LABEL: extract1_i32_zext_insert1_i64_zero:
253 ; SSE2-NEXT: psrlq $32, %xmm0
254 ; SSE2-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
257 ; SSE41-LABEL: extract1_i32_zext_insert1_i64_zero:
259 ; SSE41-NEXT: pshufb {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[4,5,6,7],zero,zero,zero,zero
262 ; AVX-LABEL: extract1_i32_zext_insert1_i64_zero:
264 ; AVX-NEXT: vpshufb {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[4,5,6,7],zero,zero,zero,zero
266 %e = extractelement <4 x i32> %x, i32 1
267 %z = zext i32 %e to i64
268 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 1
272 define <2 x i64> @extract2_i32_zext_insert1_i64_undef(<4 x i32> %x) {
273 ; SSE2-LABEL: extract2_i32_zext_insert1_i64_undef:
275 ; SSE2-NEXT: andps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
278 ; SSE41-LABEL: extract2_i32_zext_insert1_i64_undef:
280 ; SSE41-NEXT: xorps %xmm1, %xmm1
281 ; SSE41-NEXT: blendps {{.*#+}} xmm0 = xmm0[0,1,2],xmm1[3]
284 ; AVX-LABEL: extract2_i32_zext_insert1_i64_undef:
286 ; AVX-NEXT: vxorps %xmm1, %xmm1, %xmm1
287 ; AVX-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0,1,2],xmm1[3]
289 %e = extractelement <4 x i32> %x, i32 2
290 %z = zext i32 %e to i64
291 %r = insertelement <2 x i64> undef, i64 %z, i32 1
295 define <2 x i64> @extract2_i32_zext_insert1_i64_zero(<4 x i32> %x) {
296 ; SSE2-LABEL: extract2_i32_zext_insert1_i64_zero:
298 ; SSE2-NEXT: andps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
301 ; SSE41-LABEL: extract2_i32_zext_insert1_i64_zero:
303 ; SSE41-NEXT: xorps %xmm1, %xmm1
304 ; SSE41-NEXT: blendps {{.*#+}} xmm0 = xmm1[0,1],xmm0[2],xmm1[3]
307 ; AVX-LABEL: extract2_i32_zext_insert1_i64_zero:
309 ; AVX-NEXT: vxorps %xmm1, %xmm1, %xmm1
310 ; AVX-NEXT: vblendps {{.*#+}} xmm0 = xmm1[0,1],xmm0[2],xmm1[3]
312 %e = extractelement <4 x i32> %x, i32 2
313 %z = zext i32 %e to i64
314 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 1
318 define <2 x i64> @extract3_i32_zext_insert1_i64_undef(<4 x i32> %x) {
319 ; SSE-LABEL: extract3_i32_zext_insert1_i64_undef:
321 ; SSE-NEXT: psrlq $32, %xmm0
324 ; AVX-LABEL: extract3_i32_zext_insert1_i64_undef:
326 ; AVX-NEXT: vpsrlq $32, %xmm0, %xmm0
328 %e = extractelement <4 x i32> %x, i32 3
329 %z = zext i32 %e to i64
330 %r = insertelement <2 x i64> undef, i64 %z, i32 1
334 define <2 x i64> @extract3_i32_zext_insert1_i64_zero(<4 x i32> %x) {
335 ; SSE-LABEL: extract3_i32_zext_insert1_i64_zero:
337 ; SSE-NEXT: psrldq {{.*#+}} xmm0 = xmm0[12,13,14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
338 ; SSE-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
341 ; AVX-LABEL: extract3_i32_zext_insert1_i64_zero:
343 ; AVX-NEXT: vpsrldq {{.*#+}} xmm0 = xmm0[12,13,14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
344 ; AVX-NEXT: vpslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
346 %e = extractelement <4 x i32> %x, i32 3
347 %z = zext i32 %e to i64
348 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 1
352 define <2 x i64> @extract0_i16_zext_insert0_i64_undef(<8 x i16> %x) {
353 ; SSE2-LABEL: extract0_i16_zext_insert0_i64_undef:
355 ; SSE2-NEXT: pxor %xmm1, %xmm1
356 ; SSE2-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3]
357 ; SSE2-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
360 ; SSE41-LABEL: extract0_i16_zext_insert0_i64_undef:
362 ; SSE41-NEXT: pmovzxwq {{.*#+}} xmm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero
365 ; AVX-LABEL: extract0_i16_zext_insert0_i64_undef:
367 ; AVX-NEXT: vpmovzxwq {{.*#+}} xmm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero
369 %e = extractelement <8 x i16> %x, i32 0
370 %z = zext i16 %e to i64
371 %r = insertelement <2 x i64> undef, i64 %z, i32 0
375 define <2 x i64> @extract0_i16_zext_insert0_i64_zero(<8 x i16> %x) {
376 ; SSE2-LABEL: extract0_i16_zext_insert0_i64_zero:
378 ; SSE2-NEXT: andps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
381 ; SSE41-LABEL: extract0_i16_zext_insert0_i64_zero:
383 ; SSE41-NEXT: pxor %xmm1, %xmm1
384 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm0[0],xmm1[1,2,3,4,5,6,7]
387 ; AVX-LABEL: extract0_i16_zext_insert0_i64_zero:
389 ; AVX-NEXT: vpxor %xmm1, %xmm1, %xmm1
390 ; AVX-NEXT: vpblendw {{.*#+}} xmm0 = xmm0[0],xmm1[1,2,3,4,5,6,7]
392 %e = extractelement <8 x i16> %x, i32 0
393 %z = zext i16 %e to i64
394 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 0
398 define <2 x i64> @extract1_i16_zext_insert0_i64_undef(<8 x i16> %x) {
399 ; SSE-LABEL: extract1_i16_zext_insert0_i64_undef:
401 ; SSE-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,0,0,0]
402 ; SSE-NEXT: psrldq {{.*#+}} xmm0 = xmm0[14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
405 ; AVX-LABEL: extract1_i16_zext_insert0_i64_undef:
407 ; AVX-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[0,0,0,0]
408 ; AVX-NEXT: vpsrldq {{.*#+}} xmm0 = xmm0[14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
410 %e = extractelement <8 x i16> %x, i32 1
411 %z = zext i16 %e to i64
412 %r = insertelement <2 x i64> undef, i64 %z, i32 0
416 define <2 x i64> @extract1_i16_zext_insert0_i64_zero(<8 x i16> %x) {
417 ; SSE-LABEL: extract1_i16_zext_insert0_i64_zero:
419 ; SSE-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,0,0,0]
420 ; SSE-NEXT: psrldq {{.*#+}} xmm0 = xmm0[14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
423 ; AVX-LABEL: extract1_i16_zext_insert0_i64_zero:
425 ; AVX-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[0,0,0,0]
426 ; AVX-NEXT: vpsrldq {{.*#+}} xmm0 = xmm0[14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
428 %e = extractelement <8 x i16> %x, i32 1
429 %z = zext i16 %e to i64
430 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 0
434 define <2 x i64> @extract2_i16_zext_insert0_i64_undef(<8 x i16> %x) {
435 ; SSE-LABEL: extract2_i16_zext_insert0_i64_undef:
437 ; SSE-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5]
438 ; SSE-NEXT: psrldq {{.*#+}} xmm0 = xmm0[14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
441 ; AVX-LABEL: extract2_i16_zext_insert0_i64_undef:
443 ; AVX-NEXT: vpslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5]
444 ; AVX-NEXT: vpsrldq {{.*#+}} xmm0 = xmm0[14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
446 %e = extractelement <8 x i16> %x, i32 2
447 %z = zext i16 %e to i64
448 %r = insertelement <2 x i64> undef, i64 %z, i32 0
452 define <2 x i64> @extract2_i16_zext_insert0_i64_zero(<8 x i16> %x) {
453 ; SSE-LABEL: extract2_i16_zext_insert0_i64_zero:
455 ; SSE-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5]
456 ; SSE-NEXT: psrldq {{.*#+}} xmm0 = xmm0[14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
459 ; AVX-LABEL: extract2_i16_zext_insert0_i64_zero:
461 ; AVX-NEXT: vpslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5]
462 ; AVX-NEXT: vpsrldq {{.*#+}} xmm0 = xmm0[14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
464 %e = extractelement <8 x i16> %x, i32 2
465 %z = zext i16 %e to i64
466 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 0
470 define <2 x i64> @extract3_i16_zext_insert0_i64_undef(<8 x i16> %x) {
471 ; SSE-LABEL: extract3_i16_zext_insert0_i64_undef:
473 ; SSE-NEXT: psrlq $48, %xmm0
476 ; AVX-LABEL: extract3_i16_zext_insert0_i64_undef:
478 ; AVX-NEXT: vpsrlq $48, %xmm0, %xmm0
480 %e = extractelement <8 x i16> %x, i32 3
481 %z = zext i16 %e to i64
482 %r = insertelement <2 x i64> undef, i64 %z, i32 0
486 define <2 x i64> @extract3_i16_zext_insert0_i64_zero(<8 x i16> %x) {
487 ; SSE-LABEL: extract3_i16_zext_insert0_i64_zero:
489 ; SSE-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,1,0,1]
490 ; SSE-NEXT: psrldq {{.*#+}} xmm0 = xmm0[14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
493 ; AVX-LABEL: extract3_i16_zext_insert0_i64_zero:
495 ; AVX-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[0,1,0,1]
496 ; AVX-NEXT: vpsrldq {{.*#+}} xmm0 = xmm0[14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
498 %e = extractelement <8 x i16> %x, i32 3
499 %z = zext i16 %e to i64
500 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 0
504 define <2 x i64> @extract0_i16_zext_insert1_i64_undef(<8 x i16> %x) {
505 ; SSE2-LABEL: extract0_i16_zext_insert1_i64_undef:
507 ; SSE2-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1]
508 ; SSE2-NEXT: psrldq {{.*#+}} xmm0 = xmm0[14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
509 ; SSE2-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
512 ; SSE41-LABEL: extract0_i16_zext_insert1_i64_undef:
514 ; SSE41-NEXT: pshufd {{.*#+}} xmm1 = xmm0[0,1,0,1]
515 ; SSE41-NEXT: pxor %xmm0, %xmm0
516 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm0[0,1,2,3],xmm1[4],xmm0[5,6,7]
519 ; AVX-LABEL: extract0_i16_zext_insert1_i64_undef:
521 ; AVX-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[0,1,0,1]
522 ; AVX-NEXT: vpxor %xmm1, %xmm1, %xmm1
523 ; AVX-NEXT: vpblendw {{.*#+}} xmm0 = xmm1[0,1,2,3],xmm0[4],xmm1[5,6,7]
525 %e = extractelement <8 x i16> %x, i32 0
526 %z = zext i16 %e to i64
527 %r = insertelement <2 x i64> undef, i64 %z, i32 1
531 define <2 x i64> @extract0_i16_zext_insert1_i64_zero(<8 x i16> %x) {
532 ; SSE2-LABEL: extract0_i16_zext_insert1_i64_zero:
534 ; SSE2-NEXT: pextrw $0, %xmm0, %eax
535 ; SSE2-NEXT: movd %eax, %xmm0
536 ; SSE2-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
539 ; SSE41-LABEL: extract0_i16_zext_insert1_i64_zero:
541 ; SSE41-NEXT: pmovzxwq {{.*#+}} xmm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero
542 ; SSE41-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
545 ; AVX-LABEL: extract0_i16_zext_insert1_i64_zero:
547 ; AVX-NEXT: vpmovzxwq {{.*#+}} xmm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero
548 ; AVX-NEXT: vpslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
550 %e = extractelement <8 x i16> %x, i32 0
551 %z = zext i16 %e to i64
552 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 1
556 define <2 x i64> @extract1_i16_zext_insert1_i64_undef(<8 x i16> %x) {
557 ; SSE2-LABEL: extract1_i16_zext_insert1_i64_undef:
559 ; SSE2-NEXT: pxor %xmm1, %xmm1
560 ; SSE2-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3]
561 ; SSE2-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
564 ; SSE41-LABEL: extract1_i16_zext_insert1_i64_undef:
566 ; SSE41-NEXT: pmovzxwq {{.*#+}} xmm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero
569 ; AVX-LABEL: extract1_i16_zext_insert1_i64_undef:
571 ; AVX-NEXT: vpmovzxwq {{.*#+}} xmm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero
573 %e = extractelement <8 x i16> %x, i32 1
574 %z = zext i16 %e to i64
575 %r = insertelement <2 x i64> undef, i64 %z, i32 1
579 define <2 x i64> @extract1_i16_zext_insert1_i64_zero(<8 x i16> %x) {
580 ; SSE2-LABEL: extract1_i16_zext_insert1_i64_zero:
582 ; SSE2-NEXT: pextrw $1, %xmm0, %eax
583 ; SSE2-NEXT: movd %eax, %xmm0
584 ; SSE2-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
587 ; SSE41-LABEL: extract1_i16_zext_insert1_i64_zero:
589 ; SSE41-NEXT: pshufb {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[2,3],zero,zero,zero,zero,zero,zero
592 ; AVX-LABEL: extract1_i16_zext_insert1_i64_zero:
594 ; AVX-NEXT: vpshufb {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[2,3],zero,zero,zero,zero,zero,zero
596 %e = extractelement <8 x i16> %x, i32 1
597 %z = zext i16 %e to i64
598 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 1
602 define <2 x i64> @extract2_i16_zext_insert1_i64_undef(<8 x i16> %x) {
603 ; SSE2-LABEL: extract2_i16_zext_insert1_i64_undef:
605 ; SSE2-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5]
606 ; SSE2-NEXT: psrldq {{.*#+}} xmm0 = xmm0[14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
607 ; SSE2-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
610 ; SSE41-LABEL: extract2_i16_zext_insert1_i64_undef:
612 ; SSE41-NEXT: pmovzxdq {{.*#+}} xmm1 = xmm0[0],zero,xmm0[1],zero
613 ; SSE41-NEXT: pxor %xmm0, %xmm0
614 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm0[0,1,2,3],xmm1[4],xmm0[5,6,7]
617 ; AVX-LABEL: extract2_i16_zext_insert1_i64_undef:
619 ; AVX-NEXT: vpmovzxdq {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero
620 ; AVX-NEXT: vpxor %xmm1, %xmm1, %xmm1
621 ; AVX-NEXT: vpblendw {{.*#+}} xmm0 = xmm1[0,1,2,3],xmm0[4],xmm1[5,6,7]
623 %e = extractelement <8 x i16> %x, i32 2
624 %z = zext i16 %e to i64
625 %r = insertelement <2 x i64> undef, i64 %z, i32 1
629 define <2 x i64> @extract2_i16_zext_insert1_i64_zero(<8 x i16> %x) {
630 ; SSE2-LABEL: extract2_i16_zext_insert1_i64_zero:
632 ; SSE2-NEXT: pextrw $2, %xmm0, %eax
633 ; SSE2-NEXT: movd %eax, %xmm0
634 ; SSE2-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
637 ; SSE41-LABEL: extract2_i16_zext_insert1_i64_zero:
639 ; SSE41-NEXT: pshufb {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[4,5],zero,zero,zero,zero,zero,zero
642 ; AVX-LABEL: extract2_i16_zext_insert1_i64_zero:
644 ; AVX-NEXT: vpshufb {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[4,5],zero,zero,zero,zero,zero,zero
646 %e = extractelement <8 x i16> %x, i32 2
647 %z = zext i16 %e to i64
648 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 1
652 define <2 x i64> @extract3_i16_zext_insert1_i64_undef(<8 x i16> %x) {
653 ; SSE2-LABEL: extract3_i16_zext_insert1_i64_undef:
655 ; SSE2-NEXT: psrlq $48, %xmm0
656 ; SSE2-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
659 ; SSE41-LABEL: extract3_i16_zext_insert1_i64_undef:
661 ; SSE41-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,xmm0[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
662 ; SSE41-NEXT: pxor %xmm1, %xmm1
663 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm1[0,1,2,3],xmm0[4],xmm1[5,6,7]
666 ; AVX-LABEL: extract3_i16_zext_insert1_i64_undef:
668 ; AVX-NEXT: vpslldq {{.*#+}} xmm0 = zero,zero,xmm0[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
669 ; AVX-NEXT: vpxor %xmm1, %xmm1, %xmm1
670 ; AVX-NEXT: vpblendw {{.*#+}} xmm0 = xmm1[0,1,2,3],xmm0[4],xmm1[5,6,7]
672 %e = extractelement <8 x i16> %x, i32 3
673 %z = zext i16 %e to i64
674 %r = insertelement <2 x i64> undef, i64 %z, i32 1
678 define <2 x i64> @extract3_i16_zext_insert1_i64_zero(<8 x i16> %x) {
679 ; SSE2-LABEL: extract3_i16_zext_insert1_i64_zero:
681 ; SSE2-NEXT: psrlq $48, %xmm0
682 ; SSE2-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
685 ; SSE41-LABEL: extract3_i16_zext_insert1_i64_zero:
687 ; SSE41-NEXT: pshufb {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[6,7],zero,zero,zero,zero,zero,zero
690 ; AVX-LABEL: extract3_i16_zext_insert1_i64_zero:
692 ; AVX-NEXT: vpshufb {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[6,7],zero,zero,zero,zero,zero,zero
694 %e = extractelement <8 x i16> %x, i32 3
695 %z = zext i16 %e to i64
696 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 1