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: pshufd {{.*#+}} xmm1 = xmm0[1,1,1,1]
73 ; SSE2-NEXT: pxor %xmm0, %xmm0
74 ; SSE2-NEXT: movss {{.*#+}} xmm0 = xmm1[0],xmm0[1,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: vpermilps {{.*#+}} 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: pshufd {{.*#+}} xmm1 = xmm0[2,3,2,3]
118 ; SSE2-NEXT: pxor %xmm0, %xmm0
119 ; SSE2-NEXT: movss {{.*#+}} xmm0 = xmm1[0],xmm0[1,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: vpermilps {{.*#+}} 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: vpermilps {{.*#+}} 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 ; SSE-LABEL: extract0_i32_zext_insert1_i64_zero:
203 ; SSE-NEXT: movd %xmm0, %eax
204 ; SSE-NEXT: movq %rax, %xmm0
205 ; SSE-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
208 ; AVX-LABEL: extract0_i32_zext_insert1_i64_zero:
210 ; AVX-NEXT: vmovd %xmm0, %eax
211 ; AVX-NEXT: vmovq %rax, %xmm0
212 ; AVX-NEXT: vpslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
214 %e = extractelement <4 x i32> %x, i32 0
215 %z = zext i32 %e to i64
216 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 1
220 define <2 x i64> @extract1_i32_zext_insert1_i64_undef(<4 x i32> %x) {
221 ; SSE2-LABEL: extract1_i32_zext_insert1_i64_undef:
223 ; SSE2-NEXT: xorps %xmm1, %xmm1
224 ; SSE2-NEXT: unpcklps {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
227 ; SSE41-LABEL: extract1_i32_zext_insert1_i64_undef:
229 ; SSE41-NEXT: pmovzxdq {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero
232 ; AVX-LABEL: extract1_i32_zext_insert1_i64_undef:
234 ; AVX-NEXT: vpmovzxdq {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero
236 %e = extractelement <4 x i32> %x, i32 1
237 %z = zext i32 %e to i64
238 %r = insertelement <2 x i64> undef, i64 %z, i32 1
242 define <2 x i64> @extract1_i32_zext_insert1_i64_zero(<4 x i32> %x) {
243 ; SSE2-LABEL: extract1_i32_zext_insert1_i64_zero:
245 ; SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,1,1]
246 ; SSE2-NEXT: movd %xmm0, %eax
247 ; SSE2-NEXT: movq %rax, %xmm0
248 ; SSE2-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
251 ; SSE41-LABEL: extract1_i32_zext_insert1_i64_zero:
253 ; SSE41-NEXT: extractps $1, %xmm0, %eax
254 ; SSE41-NEXT: movq %rax, %xmm0
255 ; SSE41-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
258 ; AVX-LABEL: extract1_i32_zext_insert1_i64_zero:
260 ; AVX-NEXT: vextractps $1, %xmm0, %eax
261 ; AVX-NEXT: vmovq %rax, %xmm0
262 ; AVX-NEXT: vpslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
264 %e = extractelement <4 x i32> %x, i32 1
265 %z = zext i32 %e to i64
266 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 1
270 define <2 x i64> @extract2_i32_zext_insert1_i64_undef(<4 x i32> %x) {
271 ; SSE2-LABEL: extract2_i32_zext_insert1_i64_undef:
273 ; SSE2-NEXT: andps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
276 ; SSE41-LABEL: extract2_i32_zext_insert1_i64_undef:
278 ; SSE41-NEXT: xorps %xmm1, %xmm1
279 ; SSE41-NEXT: blendps {{.*#+}} xmm0 = xmm0[0,1,2],xmm1[3]
282 ; AVX-LABEL: extract2_i32_zext_insert1_i64_undef:
284 ; AVX-NEXT: vxorps %xmm1, %xmm1, %xmm1
285 ; AVX-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0,1,2],xmm1[3]
287 %e = extractelement <4 x i32> %x, i32 2
288 %z = zext i32 %e to i64
289 %r = insertelement <2 x i64> undef, i64 %z, i32 1
293 define <2 x i64> @extract2_i32_zext_insert1_i64_zero(<4 x i32> %x) {
294 ; SSE2-LABEL: extract2_i32_zext_insert1_i64_zero:
296 ; SSE2-NEXT: andps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
299 ; SSE41-LABEL: extract2_i32_zext_insert1_i64_zero:
301 ; SSE41-NEXT: xorps %xmm1, %xmm1
302 ; SSE41-NEXT: blendps {{.*#+}} xmm0 = xmm1[0,1],xmm0[2],xmm1[3]
305 ; AVX-LABEL: extract2_i32_zext_insert1_i64_zero:
307 ; AVX-NEXT: vxorps %xmm1, %xmm1, %xmm1
308 ; AVX-NEXT: vblendps {{.*#+}} xmm0 = xmm1[0,1],xmm0[2],xmm1[3]
310 %e = extractelement <4 x i32> %x, i32 2
311 %z = zext i32 %e to i64
312 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 1
316 define <2 x i64> @extract3_i32_zext_insert1_i64_undef(<4 x i32> %x) {
317 ; SSE-LABEL: extract3_i32_zext_insert1_i64_undef:
319 ; SSE-NEXT: psrlq $32, %xmm0
322 ; AVX-LABEL: extract3_i32_zext_insert1_i64_undef:
324 ; AVX-NEXT: vpsrlq $32, %xmm0, %xmm0
326 %e = extractelement <4 x i32> %x, i32 3
327 %z = zext i32 %e to i64
328 %r = insertelement <2 x i64> undef, i64 %z, i32 1
332 define <2 x i64> @extract3_i32_zext_insert1_i64_zero(<4 x i32> %x) {
333 ; SSE2-LABEL: extract3_i32_zext_insert1_i64_zero:
335 ; SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[3,3,3,3]
336 ; SSE2-NEXT: movd %xmm0, %eax
337 ; SSE2-NEXT: movq %rax, %xmm0
338 ; SSE2-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
341 ; SSE41-LABEL: extract3_i32_zext_insert1_i64_zero:
343 ; SSE41-NEXT: extractps $3, %xmm0, %eax
344 ; SSE41-NEXT: movq %rax, %xmm0
345 ; SSE41-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
348 ; AVX-LABEL: extract3_i32_zext_insert1_i64_zero:
350 ; AVX-NEXT: vextractps $3, %xmm0, %eax
351 ; AVX-NEXT: vmovq %rax, %xmm0
352 ; AVX-NEXT: vpslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
354 %e = extractelement <4 x i32> %x, i32 3
355 %z = zext i32 %e to i64
356 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 1
360 define <2 x i64> @extract0_i16_zext_insert0_i64_undef(<8 x i16> %x) {
361 ; SSE2-LABEL: extract0_i16_zext_insert0_i64_undef:
363 ; SSE2-NEXT: pxor %xmm1, %xmm1
364 ; SSE2-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3]
365 ; SSE2-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
368 ; SSE41-LABEL: extract0_i16_zext_insert0_i64_undef:
370 ; SSE41-NEXT: pmovzxwq {{.*#+}} xmm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero
373 ; AVX-LABEL: extract0_i16_zext_insert0_i64_undef:
375 ; AVX-NEXT: vpmovzxwq {{.*#+}} xmm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero
377 %e = extractelement <8 x i16> %x, i32 0
378 %z = zext i16 %e to i64
379 %r = insertelement <2 x i64> undef, i64 %z, i32 0
383 define <2 x i64> @extract0_i16_zext_insert0_i64_zero(<8 x i16> %x) {
384 ; SSE2-LABEL: extract0_i16_zext_insert0_i64_zero:
386 ; SSE2-NEXT: pextrw $0, %xmm0, %eax
387 ; SSE2-NEXT: movd %eax, %xmm0
390 ; SSE41-LABEL: extract0_i16_zext_insert0_i64_zero:
392 ; SSE41-NEXT: pxor %xmm1, %xmm1
393 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm0[0],xmm1[1,2,3,4,5,6,7]
396 ; AVX-LABEL: extract0_i16_zext_insert0_i64_zero:
398 ; AVX-NEXT: vpxor %xmm1, %xmm1, %xmm1
399 ; AVX-NEXT: vpblendw {{.*#+}} xmm0 = xmm0[0],xmm1[1,2,3,4,5,6,7]
401 %e = extractelement <8 x i16> %x, i32 0
402 %z = zext i16 %e to i64
403 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 0
407 define <2 x i64> @extract1_i16_zext_insert0_i64_undef(<8 x i16> %x) {
408 ; SSE-LABEL: extract1_i16_zext_insert0_i64_undef:
410 ; SSE-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,0,0,0]
411 ; SSE-NEXT: psrldq {{.*#+}} xmm0 = xmm0[14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
414 ; AVX-LABEL: extract1_i16_zext_insert0_i64_undef:
416 ; AVX-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[0,0,0,0]
417 ; AVX-NEXT: vpsrldq {{.*#+}} xmm0 = xmm0[14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
419 %e = extractelement <8 x i16> %x, i32 1
420 %z = zext i16 %e to i64
421 %r = insertelement <2 x i64> undef, i64 %z, i32 0
425 define <2 x i64> @extract1_i16_zext_insert0_i64_zero(<8 x i16> %x) {
426 ; SSE-LABEL: extract1_i16_zext_insert0_i64_zero:
428 ; SSE-NEXT: pextrw $1, %xmm0, %eax
429 ; SSE-NEXT: movd %eax, %xmm0
432 ; AVX-LABEL: extract1_i16_zext_insert0_i64_zero:
434 ; AVX-NEXT: vpextrw $1, %xmm0, %eax
435 ; AVX-NEXT: vmovd %eax, %xmm0
437 %e = extractelement <8 x i16> %x, i32 1
438 %z = zext i16 %e to i64
439 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 0
443 define <2 x i64> @extract2_i16_zext_insert0_i64_undef(<8 x i16> %x) {
444 ; SSE-LABEL: extract2_i16_zext_insert0_i64_undef:
446 ; SSE-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5]
447 ; SSE-NEXT: psrldq {{.*#+}} xmm0 = xmm0[14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
450 ; AVX-LABEL: extract2_i16_zext_insert0_i64_undef:
452 ; AVX-NEXT: vpslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5]
453 ; AVX-NEXT: vpsrldq {{.*#+}} xmm0 = xmm0[14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
455 %e = extractelement <8 x i16> %x, i32 2
456 %z = zext i16 %e to i64
457 %r = insertelement <2 x i64> undef, i64 %z, i32 0
461 define <2 x i64> @extract2_i16_zext_insert0_i64_zero(<8 x i16> %x) {
462 ; SSE-LABEL: extract2_i16_zext_insert0_i64_zero:
464 ; SSE-NEXT: pextrw $2, %xmm0, %eax
465 ; SSE-NEXT: movd %eax, %xmm0
468 ; AVX-LABEL: extract2_i16_zext_insert0_i64_zero:
470 ; AVX-NEXT: vpextrw $2, %xmm0, %eax
471 ; AVX-NEXT: vmovd %eax, %xmm0
473 %e = extractelement <8 x i16> %x, i32 2
474 %z = zext i16 %e to i64
475 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 0
479 define <2 x i64> @extract3_i16_zext_insert0_i64_undef(<8 x i16> %x) {
480 ; SSE-LABEL: extract3_i16_zext_insert0_i64_undef:
482 ; SSE-NEXT: psrlq $48, %xmm0
485 ; AVX-LABEL: extract3_i16_zext_insert0_i64_undef:
487 ; AVX-NEXT: vpsrlq $48, %xmm0, %xmm0
489 %e = extractelement <8 x i16> %x, i32 3
490 %z = zext i16 %e to i64
491 %r = insertelement <2 x i64> undef, i64 %z, i32 0
495 define <2 x i64> @extract3_i16_zext_insert0_i64_zero(<8 x i16> %x) {
496 ; SSE-LABEL: extract3_i16_zext_insert0_i64_zero:
498 ; SSE-NEXT: pextrw $3, %xmm0, %eax
499 ; SSE-NEXT: movd %eax, %xmm0
502 ; AVX-LABEL: extract3_i16_zext_insert0_i64_zero:
504 ; AVX-NEXT: vpextrw $3, %xmm0, %eax
505 ; AVX-NEXT: vmovd %eax, %xmm0
507 %e = extractelement <8 x i16> %x, i32 3
508 %z = zext i16 %e to i64
509 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 0
513 define <2 x i64> @extract0_i16_zext_insert1_i64_undef(<8 x i16> %x) {
514 ; SSE2-LABEL: extract0_i16_zext_insert1_i64_undef:
516 ; SSE2-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1]
517 ; SSE2-NEXT: psrldq {{.*#+}} xmm0 = xmm0[14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
518 ; SSE2-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
521 ; SSE41-LABEL: extract0_i16_zext_insert1_i64_undef:
523 ; SSE41-NEXT: pshufd {{.*#+}} xmm1 = xmm0[0,1,0,1]
524 ; SSE41-NEXT: pxor %xmm0, %xmm0
525 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm0[0,1,2,3],xmm1[4],xmm0[5,6,7]
528 ; AVX-LABEL: extract0_i16_zext_insert1_i64_undef:
530 ; AVX-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[0,1,0,1]
531 ; AVX-NEXT: vpxor %xmm1, %xmm1, %xmm1
532 ; AVX-NEXT: vpblendw {{.*#+}} xmm0 = xmm1[0,1,2,3],xmm0[4],xmm1[5,6,7]
534 %e = extractelement <8 x i16> %x, i32 0
535 %z = zext i16 %e to i64
536 %r = insertelement <2 x i64> undef, i64 %z, i32 1
540 define <2 x i64> @extract0_i16_zext_insert1_i64_zero(<8 x i16> %x) {
541 ; SSE-LABEL: extract0_i16_zext_insert1_i64_zero:
543 ; SSE-NEXT: pextrw $0, %xmm0, %eax
544 ; SSE-NEXT: movq %rax, %xmm0
545 ; SSE-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
548 ; AVX-LABEL: extract0_i16_zext_insert1_i64_zero:
550 ; AVX-NEXT: vpextrw $0, %xmm0, %eax
551 ; AVX-NEXT: vmovq %rax, %xmm0
552 ; AVX-NEXT: vpslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
554 %e = extractelement <8 x i16> %x, i32 0
555 %z = zext i16 %e to i64
556 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 1
560 define <2 x i64> @extract1_i16_zext_insert1_i64_undef(<8 x i16> %x) {
561 ; SSE2-LABEL: extract1_i16_zext_insert1_i64_undef:
563 ; SSE2-NEXT: pxor %xmm1, %xmm1
564 ; SSE2-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3]
565 ; SSE2-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
568 ; SSE41-LABEL: extract1_i16_zext_insert1_i64_undef:
570 ; SSE41-NEXT: pmovzxwq {{.*#+}} xmm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero
573 ; AVX-LABEL: extract1_i16_zext_insert1_i64_undef:
575 ; AVX-NEXT: vpmovzxwq {{.*#+}} xmm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero
577 %e = extractelement <8 x i16> %x, i32 1
578 %z = zext i16 %e to i64
579 %r = insertelement <2 x i64> undef, i64 %z, i32 1
583 define <2 x i64> @extract1_i16_zext_insert1_i64_zero(<8 x i16> %x) {
584 ; SSE-LABEL: extract1_i16_zext_insert1_i64_zero:
586 ; SSE-NEXT: pextrw $1, %xmm0, %eax
587 ; SSE-NEXT: movq %rax, %xmm0
588 ; SSE-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
591 ; AVX-LABEL: extract1_i16_zext_insert1_i64_zero:
593 ; AVX-NEXT: vpextrw $1, %xmm0, %eax
594 ; AVX-NEXT: vmovq %rax, %xmm0
595 ; AVX-NEXT: vpslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
597 %e = extractelement <8 x i16> %x, i32 1
598 %z = zext i16 %e to i64
599 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 1
603 define <2 x i64> @extract2_i16_zext_insert1_i64_undef(<8 x i16> %x) {
604 ; SSE2-LABEL: extract2_i16_zext_insert1_i64_undef:
606 ; SSE2-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5]
607 ; SSE2-NEXT: psrldq {{.*#+}} xmm0 = xmm0[14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
608 ; SSE2-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
611 ; SSE41-LABEL: extract2_i16_zext_insert1_i64_undef:
613 ; SSE41-NEXT: pmovzxdq {{.*#+}} xmm1 = xmm0[0],zero,xmm0[1],zero
614 ; SSE41-NEXT: pxor %xmm0, %xmm0
615 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm0[0,1,2,3],xmm1[4],xmm0[5,6,7]
618 ; AVX-LABEL: extract2_i16_zext_insert1_i64_undef:
620 ; AVX-NEXT: vpmovzxdq {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero
621 ; AVX-NEXT: vpxor %xmm1, %xmm1, %xmm1
622 ; AVX-NEXT: vpblendw {{.*#+}} xmm0 = xmm1[0,1,2,3],xmm0[4],xmm1[5,6,7]
624 %e = extractelement <8 x i16> %x, i32 2
625 %z = zext i16 %e to i64
626 %r = insertelement <2 x i64> undef, i64 %z, i32 1
630 define <2 x i64> @extract2_i16_zext_insert1_i64_zero(<8 x i16> %x) {
631 ; SSE-LABEL: extract2_i16_zext_insert1_i64_zero:
633 ; SSE-NEXT: pextrw $2, %xmm0, %eax
634 ; SSE-NEXT: movq %rax, %xmm0
635 ; SSE-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
638 ; AVX-LABEL: extract2_i16_zext_insert1_i64_zero:
640 ; AVX-NEXT: vpextrw $2, %xmm0, %eax
641 ; AVX-NEXT: vmovq %rax, %xmm0
642 ; AVX-NEXT: vpslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
644 %e = extractelement <8 x i16> %x, i32 2
645 %z = zext i16 %e to i64
646 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 1
650 define <2 x i64> @extract3_i16_zext_insert1_i64_undef(<8 x i16> %x) {
651 ; SSE2-LABEL: extract3_i16_zext_insert1_i64_undef:
653 ; SSE2-NEXT: psrlq $48, %xmm0
654 ; SSE2-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
657 ; SSE41-LABEL: extract3_i16_zext_insert1_i64_undef:
659 ; SSE41-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,xmm0[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
660 ; SSE41-NEXT: pxor %xmm1, %xmm1
661 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm1[0,1,2,3],xmm0[4],xmm1[5,6,7]
664 ; AVX-LABEL: extract3_i16_zext_insert1_i64_undef:
666 ; AVX-NEXT: vpslldq {{.*#+}} xmm0 = zero,zero,xmm0[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
667 ; AVX-NEXT: vpxor %xmm1, %xmm1, %xmm1
668 ; AVX-NEXT: vpblendw {{.*#+}} xmm0 = xmm1[0,1,2,3],xmm0[4],xmm1[5,6,7]
670 %e = extractelement <8 x i16> %x, i32 3
671 %z = zext i16 %e to i64
672 %r = insertelement <2 x i64> undef, i64 %z, i32 1
676 define <2 x i64> @extract3_i16_zext_insert1_i64_zero(<8 x i16> %x) {
677 ; SSE-LABEL: extract3_i16_zext_insert1_i64_zero:
679 ; SSE-NEXT: pextrw $3, %xmm0, %eax
680 ; SSE-NEXT: movq %rax, %xmm0
681 ; SSE-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
684 ; AVX-LABEL: extract3_i16_zext_insert1_i64_zero:
686 ; AVX-NEXT: vpextrw $3, %xmm0, %eax
687 ; AVX-NEXT: vmovq %rax, %xmm0
688 ; AVX-NEXT: vpslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
690 %e = extractelement <8 x i16> %x, i32 3
691 %z = zext i16 %e to i64
692 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 1