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=ANY,SSE,SSE2
3 ; RUN: llc < %s -mtriple=x86_64-- -mattr=+sse4.1 | FileCheck %s --check-prefixes=ANY,SSE,SSE41
4 ; RUN: llc < %s -mtriple=x86_64-- -mattr=+avx | FileCheck %s --check-prefixes=ANY,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 ; SSE-LABEL: extract0_i32_zext_insert0_i64_zero:
31 ; SSE-NEXT: movd %xmm0, %eax
32 ; SSE-NEXT: movq %rax, %xmm0
35 ; AVX-LABEL: extract0_i32_zext_insert0_i64_zero:
37 ; AVX-NEXT: vmovd %xmm0, %eax
38 ; AVX-NEXT: vmovq %rax, %xmm0
40 %e = extractelement <4 x i32> %x, i32 0
41 %z = zext i32 %e to i64
42 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 0
46 define <2 x i64> @extract1_i32_zext_insert0_i64_undef(<4 x i32> %x) {
47 ; SSE-LABEL: extract1_i32_zext_insert0_i64_undef:
49 ; SSE-NEXT: psrlq $32, %xmm0
52 ; AVX-LABEL: extract1_i32_zext_insert0_i64_undef:
54 ; AVX-NEXT: vpsrlq $32, %xmm0, %xmm0
56 %e = extractelement <4 x i32> %x, i32 1
57 %z = zext i32 %e to i64
58 %r = insertelement <2 x i64> undef, i64 %z, i32 0
62 define <2 x i64> @extract1_i32_zext_insert0_i64_zero(<4 x i32> %x) {
63 ; SSE2-LABEL: extract1_i32_zext_insert0_i64_zero:
65 ; SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
66 ; SSE2-NEXT: movd %xmm0, %eax
67 ; SSE2-NEXT: movq %rax, %xmm0
70 ; SSE41-LABEL: extract1_i32_zext_insert0_i64_zero:
72 ; SSE41-NEXT: extractps $1, %xmm0, %eax
73 ; SSE41-NEXT: movq %rax, %xmm0
76 ; AVX-LABEL: extract1_i32_zext_insert0_i64_zero:
78 ; AVX-NEXT: vextractps $1, %xmm0, %eax
79 ; AVX-NEXT: vmovq %rax, %xmm0
81 %e = extractelement <4 x i32> %x, i32 1
82 %z = zext i32 %e to i64
83 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 0
87 define <2 x i64> @extract2_i32_zext_insert0_i64_undef(<4 x i32> %x) {
88 ; SSE-LABEL: extract2_i32_zext_insert0_i64_undef:
90 ; SSE-NEXT: xorps %xmm1, %xmm1
91 ; SSE-NEXT: unpckhps {{.*#+}} xmm0 = xmm0[2],xmm1[2],xmm0[3],xmm1[3]
94 ; AVX-LABEL: extract2_i32_zext_insert0_i64_undef:
96 ; AVX-NEXT: vxorps %xmm1, %xmm1, %xmm1
97 ; AVX-NEXT: vunpckhps {{.*#+}} xmm0 = xmm0[2],xmm1[2],xmm0[3],xmm1[3]
99 %e = extractelement <4 x i32> %x, i32 2
100 %z = zext i32 %e to i64
101 %r = insertelement <2 x i64> undef, i64 %z, i32 0
105 define <2 x i64> @extract2_i32_zext_insert0_i64_zero(<4 x i32> %x) {
106 ; SSE2-LABEL: extract2_i32_zext_insert0_i64_zero:
108 ; SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
109 ; SSE2-NEXT: movd %xmm0, %eax
110 ; SSE2-NEXT: movq %rax, %xmm0
113 ; SSE41-LABEL: extract2_i32_zext_insert0_i64_zero:
115 ; SSE41-NEXT: extractps $2, %xmm0, %eax
116 ; SSE41-NEXT: movq %rax, %xmm0
119 ; AVX-LABEL: extract2_i32_zext_insert0_i64_zero:
121 ; AVX-NEXT: vextractps $2, %xmm0, %eax
122 ; AVX-NEXT: vmovq %rax, %xmm0
124 %e = extractelement <4 x i32> %x, i32 2
125 %z = zext i32 %e to i64
126 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 0
130 define <2 x i64> @extract3_i32_zext_insert0_i64_undef(<4 x i32> %x) {
131 ; SSE-LABEL: extract3_i32_zext_insert0_i64_undef:
133 ; SSE-NEXT: psrldq {{.*#+}} xmm0 = xmm0[12,13,14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
136 ; AVX-LABEL: extract3_i32_zext_insert0_i64_undef:
138 ; AVX-NEXT: vpsrldq {{.*#+}} xmm0 = xmm0[12,13,14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
140 %e = extractelement <4 x i32> %x, i32 3
141 %z = zext i32 %e to i64
142 %r = insertelement <2 x i64> undef, i64 %z, i32 0
146 define <2 x i64> @extract3_i32_zext_insert0_i64_zero(<4 x i32> %x) {
147 ; SSE2-LABEL: extract3_i32_zext_insert0_i64_zero:
149 ; SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[3,1,2,3]
150 ; SSE2-NEXT: movd %xmm0, %eax
151 ; SSE2-NEXT: movq %rax, %xmm0
154 ; SSE41-LABEL: extract3_i32_zext_insert0_i64_zero:
156 ; SSE41-NEXT: extractps $3, %xmm0, %eax
157 ; SSE41-NEXT: movq %rax, %xmm0
160 ; AVX-LABEL: extract3_i32_zext_insert0_i64_zero:
162 ; AVX-NEXT: vextractps $3, %xmm0, %eax
163 ; AVX-NEXT: vmovq %rax, %xmm0
165 %e = extractelement <4 x i32> %x, i32 3
166 %z = zext i32 %e to i64
167 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 0
171 define <2 x i64> @extract0_i32_zext_insert1_i64_undef(<4 x i32> %x) {
172 ; SSE2-LABEL: extract0_i32_zext_insert1_i64_undef:
174 ; SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,0,1,1]
175 ; SSE2-NEXT: pxor %xmm1, %xmm1
176 ; SSE2-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
179 ; SSE41-LABEL: extract0_i32_zext_insert1_i64_undef:
181 ; SSE41-NEXT: pshufd {{.*#+}} xmm1 = xmm0[0,1,0,1]
182 ; SSE41-NEXT: pxor %xmm0, %xmm0
183 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm1[0,1,2,3,4,5],xmm0[6,7]
186 ; AVX-LABEL: extract0_i32_zext_insert1_i64_undef:
188 ; AVX-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[0,1,0,1]
189 ; AVX-NEXT: vxorps %xmm1, %xmm1, %xmm1
190 ; AVX-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0,1,2],xmm1[3]
192 %e = extractelement <4 x i32> %x, i32 0
193 %z = zext i32 %e to i64
194 %r = insertelement <2 x i64> undef, i64 %z, i32 1
198 define <2 x i64> @extract0_i32_zext_insert1_i64_zero(<4 x i32> %x) {
199 ; SSE-LABEL: extract0_i32_zext_insert1_i64_zero:
201 ; SSE-NEXT: movd %xmm0, %eax
202 ; SSE-NEXT: movq %rax, %xmm0
203 ; SSE-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
206 ; AVX-LABEL: extract0_i32_zext_insert1_i64_zero:
208 ; AVX-NEXT: vmovd %xmm0, %eax
209 ; AVX-NEXT: vmovq %rax, %xmm0
210 ; AVX-NEXT: vpslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
212 %e = extractelement <4 x i32> %x, i32 0
213 %z = zext i32 %e to i64
214 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 1
218 define <2 x i64> @extract1_i32_zext_insert1_i64_undef(<4 x i32> %x) {
219 ; SSE2-LABEL: extract1_i32_zext_insert1_i64_undef:
221 ; SSE2-NEXT: xorps %xmm1, %xmm1
222 ; SSE2-NEXT: unpcklps {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
225 ; SSE41-LABEL: extract1_i32_zext_insert1_i64_undef:
227 ; SSE41-NEXT: pmovzxdq {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero
230 ; AVX-LABEL: extract1_i32_zext_insert1_i64_undef:
232 ; AVX-NEXT: vpmovzxdq {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero
234 %e = extractelement <4 x i32> %x, i32 1
235 %z = zext i32 %e to i64
236 %r = insertelement <2 x i64> undef, i64 %z, i32 1
240 define <2 x i64> @extract1_i32_zext_insert1_i64_zero(<4 x i32> %x) {
241 ; SSE2-LABEL: extract1_i32_zext_insert1_i64_zero:
243 ; SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
244 ; SSE2-NEXT: movd %xmm0, %eax
245 ; SSE2-NEXT: movq %rax, %xmm0
246 ; SSE2-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
249 ; SSE41-LABEL: extract1_i32_zext_insert1_i64_zero:
251 ; SSE41-NEXT: extractps $1, %xmm0, %eax
252 ; SSE41-NEXT: movq %rax, %xmm0
253 ; SSE41-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
256 ; AVX-LABEL: extract1_i32_zext_insert1_i64_zero:
258 ; AVX-NEXT: vextractps $1, %xmm0, %eax
259 ; AVX-NEXT: vmovq %rax, %xmm0
260 ; AVX-NEXT: vpslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
262 %e = extractelement <4 x i32> %x, i32 1
263 %z = zext i32 %e to i64
264 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 1
268 define <2 x i64> @extract2_i32_zext_insert1_i64_undef(<4 x i32> %x) {
269 ; SSE2-LABEL: extract2_i32_zext_insert1_i64_undef:
271 ; SSE2-NEXT: andps {{.*}}(%rip), %xmm0
274 ; SSE41-LABEL: extract2_i32_zext_insert1_i64_undef:
276 ; SSE41-NEXT: xorps %xmm1, %xmm1
277 ; SSE41-NEXT: blendps {{.*#+}} xmm0 = xmm0[0,1,2],xmm1[3]
280 ; AVX-LABEL: extract2_i32_zext_insert1_i64_undef:
282 ; AVX-NEXT: vxorps %xmm1, %xmm1, %xmm1
283 ; AVX-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0,1,2],xmm1[3]
285 %e = extractelement <4 x i32> %x, i32 2
286 %z = zext i32 %e to i64
287 %r = insertelement <2 x i64> undef, i64 %z, i32 1
291 define <2 x i64> @extract2_i32_zext_insert1_i64_zero(<4 x i32> %x) {
292 ; SSE2-LABEL: extract2_i32_zext_insert1_i64_zero:
294 ; SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[2,3,0,1]
295 ; SSE2-NEXT: movd %xmm0, %eax
296 ; SSE2-NEXT: movq %rax, %xmm0
297 ; SSE2-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
300 ; SSE41-LABEL: extract2_i32_zext_insert1_i64_zero:
302 ; SSE41-NEXT: extractps $2, %xmm0, %eax
303 ; SSE41-NEXT: movq %rax, %xmm0
304 ; SSE41-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
307 ; AVX-LABEL: extract2_i32_zext_insert1_i64_zero:
309 ; AVX-NEXT: vextractps $2, %xmm0, %eax
310 ; AVX-NEXT: vmovq %rax, %xmm0
311 ; AVX-NEXT: vpslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
313 %e = extractelement <4 x i32> %x, i32 2
314 %z = zext i32 %e to i64
315 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 1
319 define <2 x i64> @extract3_i32_zext_insert1_i64_undef(<4 x i32> %x) {
320 ; SSE-LABEL: extract3_i32_zext_insert1_i64_undef:
322 ; SSE-NEXT: psrlq $32, %xmm0
325 ; AVX-LABEL: extract3_i32_zext_insert1_i64_undef:
327 ; AVX-NEXT: vpsrlq $32, %xmm0, %xmm0
329 %e = extractelement <4 x i32> %x, i32 3
330 %z = zext i32 %e to i64
331 %r = insertelement <2 x i64> undef, i64 %z, i32 1
335 define <2 x i64> @extract3_i32_zext_insert1_i64_zero(<4 x i32> %x) {
336 ; SSE2-LABEL: extract3_i32_zext_insert1_i64_zero:
338 ; SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[3,1,2,3]
339 ; SSE2-NEXT: movd %xmm0, %eax
340 ; SSE2-NEXT: movq %rax, %xmm0
341 ; SSE2-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
344 ; SSE41-LABEL: extract3_i32_zext_insert1_i64_zero:
346 ; SSE41-NEXT: extractps $3, %xmm0, %eax
347 ; SSE41-NEXT: movq %rax, %xmm0
348 ; SSE41-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
351 ; AVX-LABEL: extract3_i32_zext_insert1_i64_zero:
353 ; AVX-NEXT: vextractps $3, %xmm0, %eax
354 ; AVX-NEXT: vmovq %rax, %xmm0
355 ; AVX-NEXT: vpslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
357 %e = extractelement <4 x i32> %x, i32 3
358 %z = zext i32 %e to i64
359 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 1
363 define <2 x i64> @extract0_i16_zext_insert0_i64_undef(<8 x i16> %x) {
364 ; SSE2-LABEL: extract0_i16_zext_insert0_i64_undef:
366 ; SSE2-NEXT: pxor %xmm1, %xmm1
367 ; SSE2-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3]
368 ; SSE2-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
371 ; SSE41-LABEL: extract0_i16_zext_insert0_i64_undef:
373 ; SSE41-NEXT: pmovzxwq {{.*#+}} xmm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero
376 ; AVX-LABEL: extract0_i16_zext_insert0_i64_undef:
378 ; AVX-NEXT: vpmovzxwq {{.*#+}} xmm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero
380 %e = extractelement <8 x i16> %x, i32 0
381 %z = zext i16 %e to i64
382 %r = insertelement <2 x i64> undef, i64 %z, i32 0
386 define <2 x i64> @extract0_i16_zext_insert0_i64_zero(<8 x i16> %x) {
387 ; SSE-LABEL: extract0_i16_zext_insert0_i64_zero:
389 ; SSE-NEXT: pextrw $0, %xmm0, %eax
390 ; SSE-NEXT: movq %rax, %xmm0
393 ; AVX-LABEL: extract0_i16_zext_insert0_i64_zero:
395 ; AVX-NEXT: vpextrw $0, %xmm0, %eax
396 ; AVX-NEXT: vmovq %rax, %xmm0
398 %e = extractelement <8 x i16> %x, i32 0
399 %z = zext i16 %e to i64
400 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 0
404 define <2 x i64> @extract1_i16_zext_insert0_i64_undef(<8 x i16> %x) {
405 ; SSE-LABEL: extract1_i16_zext_insert0_i64_undef:
407 ; SSE-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3]
408 ; SSE-NEXT: psrldq {{.*#+}} xmm0 = xmm0[14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
411 ; AVX-LABEL: extract1_i16_zext_insert0_i64_undef:
413 ; AVX-NEXT: vpslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3]
414 ; AVX-NEXT: vpsrldq {{.*#+}} xmm0 = xmm0[14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
416 %e = extractelement <8 x i16> %x, i32 1
417 %z = zext i16 %e to i64
418 %r = insertelement <2 x i64> undef, i64 %z, i32 0
422 define <2 x i64> @extract1_i16_zext_insert0_i64_zero(<8 x i16> %x) {
423 ; SSE-LABEL: extract1_i16_zext_insert0_i64_zero:
425 ; SSE-NEXT: pextrw $1, %xmm0, %eax
426 ; SSE-NEXT: movq %rax, %xmm0
429 ; AVX-LABEL: extract1_i16_zext_insert0_i64_zero:
431 ; AVX-NEXT: vpextrw $1, %xmm0, %eax
432 ; AVX-NEXT: vmovq %rax, %xmm0
434 %e = extractelement <8 x i16> %x, i32 1
435 %z = zext i16 %e to i64
436 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 0
440 define <2 x i64> @extract2_i16_zext_insert0_i64_undef(<8 x i16> %x) {
441 ; SSE-LABEL: extract2_i16_zext_insert0_i64_undef:
443 ; SSE-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5]
444 ; SSE-NEXT: psrldq {{.*#+}} xmm0 = xmm0[14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
447 ; AVX-LABEL: extract2_i16_zext_insert0_i64_undef:
449 ; AVX-NEXT: vpslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5]
450 ; AVX-NEXT: vpsrldq {{.*#+}} xmm0 = xmm0[14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
452 %e = extractelement <8 x i16> %x, i32 2
453 %z = zext i16 %e to i64
454 %r = insertelement <2 x i64> undef, i64 %z, i32 0
458 define <2 x i64> @extract2_i16_zext_insert0_i64_zero(<8 x i16> %x) {
459 ; SSE-LABEL: extract2_i16_zext_insert0_i64_zero:
461 ; SSE-NEXT: pextrw $2, %xmm0, %eax
462 ; SSE-NEXT: movq %rax, %xmm0
465 ; AVX-LABEL: extract2_i16_zext_insert0_i64_zero:
467 ; AVX-NEXT: vpextrw $2, %xmm0, %eax
468 ; AVX-NEXT: vmovq %rax, %xmm0
470 %e = extractelement <8 x i16> %x, i32 2
471 %z = zext i16 %e to i64
472 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 0
476 define <2 x i64> @extract3_i16_zext_insert0_i64_undef(<8 x i16> %x) {
477 ; SSE-LABEL: extract3_i16_zext_insert0_i64_undef:
479 ; SSE-NEXT: psrlq $48, %xmm0
482 ; AVX-LABEL: extract3_i16_zext_insert0_i64_undef:
484 ; AVX-NEXT: vpsrlq $48, %xmm0, %xmm0
486 %e = extractelement <8 x i16> %x, i32 3
487 %z = zext i16 %e to i64
488 %r = insertelement <2 x i64> undef, i64 %z, i32 0
492 define <2 x i64> @extract3_i16_zext_insert0_i64_zero(<8 x i16> %x) {
493 ; SSE-LABEL: extract3_i16_zext_insert0_i64_zero:
495 ; SSE-NEXT: pextrw $3, %xmm0, %eax
496 ; SSE-NEXT: movq %rax, %xmm0
499 ; AVX-LABEL: extract3_i16_zext_insert0_i64_zero:
501 ; AVX-NEXT: vpextrw $3, %xmm0, %eax
502 ; AVX-NEXT: vmovq %rax, %xmm0
504 %e = extractelement <8 x i16> %x, i32 3
505 %z = zext i16 %e to i64
506 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 0
510 define <2 x i64> @extract0_i16_zext_insert1_i64_undef(<8 x i16> %x) {
511 ; SSE2-LABEL: extract0_i16_zext_insert1_i64_undef:
513 ; SSE2-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1]
514 ; SSE2-NEXT: psrldq {{.*#+}} xmm0 = xmm0[14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
515 ; SSE2-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
518 ; SSE41-LABEL: extract0_i16_zext_insert1_i64_undef:
520 ; SSE41-NEXT: pshufd {{.*#+}} xmm1 = xmm0[0,1,0,1]
521 ; SSE41-NEXT: pxor %xmm0, %xmm0
522 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm0[0,1,2,3],xmm1[4],xmm0[5,6,7]
525 ; AVX-LABEL: extract0_i16_zext_insert1_i64_undef:
527 ; AVX-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[0,1,0,1]
528 ; AVX-NEXT: vpxor %xmm1, %xmm1, %xmm1
529 ; AVX-NEXT: vpblendw {{.*#+}} xmm0 = xmm1[0,1,2,3],xmm0[4],xmm1[5,6,7]
531 %e = extractelement <8 x i16> %x, i32 0
532 %z = zext i16 %e to i64
533 %r = insertelement <2 x i64> undef, i64 %z, i32 1
537 define <2 x i64> @extract0_i16_zext_insert1_i64_zero(<8 x i16> %x) {
538 ; SSE-LABEL: extract0_i16_zext_insert1_i64_zero:
540 ; SSE-NEXT: pextrw $0, %xmm0, %eax
541 ; SSE-NEXT: movq %rax, %xmm0
542 ; SSE-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: vpextrw $0, %xmm0, %eax
548 ; AVX-NEXT: vmovq %rax, %xmm0
549 ; AVX-NEXT: vpslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
551 %e = extractelement <8 x i16> %x, i32 0
552 %z = zext i16 %e to i64
553 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 1
557 define <2 x i64> @extract1_i16_zext_insert1_i64_undef(<8 x i16> %x) {
558 ; SSE2-LABEL: extract1_i16_zext_insert1_i64_undef:
560 ; SSE2-NEXT: pxor %xmm1, %xmm1
561 ; SSE2-NEXT: punpcklwd {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3]
562 ; SSE2-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
565 ; SSE41-LABEL: extract1_i16_zext_insert1_i64_undef:
567 ; SSE41-NEXT: pmovzxwq {{.*#+}} xmm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero
570 ; AVX-LABEL: extract1_i16_zext_insert1_i64_undef:
572 ; AVX-NEXT: vpmovzxwq {{.*#+}} xmm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero
574 %e = extractelement <8 x i16> %x, i32 1
575 %z = zext i16 %e to i64
576 %r = insertelement <2 x i64> undef, i64 %z, i32 1
580 define <2 x i64> @extract1_i16_zext_insert1_i64_zero(<8 x i16> %x) {
581 ; SSE-LABEL: extract1_i16_zext_insert1_i64_zero:
583 ; SSE-NEXT: pextrw $1, %xmm0, %eax
584 ; SSE-NEXT: movq %rax, %xmm0
585 ; SSE-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
588 ; AVX-LABEL: extract1_i16_zext_insert1_i64_zero:
590 ; AVX-NEXT: vpextrw $1, %xmm0, %eax
591 ; AVX-NEXT: vmovq %rax, %xmm0
592 ; AVX-NEXT: vpslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
594 %e = extractelement <8 x i16> %x, i32 1
595 %z = zext i16 %e to i64
596 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 1
600 define <2 x i64> @extract2_i16_zext_insert1_i64_undef(<8 x i16> %x) {
601 ; SSE2-LABEL: extract2_i16_zext_insert1_i64_undef:
603 ; SSE2-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5]
604 ; SSE2-NEXT: psrldq {{.*#+}} xmm0 = xmm0[14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
605 ; SSE2-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
608 ; SSE41-LABEL: extract2_i16_zext_insert1_i64_undef:
610 ; SSE41-NEXT: pmovzxdq {{.*#+}} xmm1 = xmm0[0],zero,xmm0[1],zero
611 ; SSE41-NEXT: pxor %xmm0, %xmm0
612 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm0[0,1,2,3],xmm1[4],xmm0[5,6,7]
615 ; AVX-LABEL: extract2_i16_zext_insert1_i64_undef:
617 ; AVX-NEXT: vpmovzxdq {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero
618 ; AVX-NEXT: vpxor %xmm1, %xmm1, %xmm1
619 ; AVX-NEXT: vpblendw {{.*#+}} xmm0 = xmm1[0,1,2,3],xmm0[4],xmm1[5,6,7]
621 %e = extractelement <8 x i16> %x, i32 2
622 %z = zext i16 %e to i64
623 %r = insertelement <2 x i64> undef, i64 %z, i32 1
627 define <2 x i64> @extract2_i16_zext_insert1_i64_zero(<8 x i16> %x) {
628 ; SSE-LABEL: extract2_i16_zext_insert1_i64_zero:
630 ; SSE-NEXT: pextrw $2, %xmm0, %eax
631 ; SSE-NEXT: movq %rax, %xmm0
632 ; SSE-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
635 ; AVX-LABEL: extract2_i16_zext_insert1_i64_zero:
637 ; AVX-NEXT: vpextrw $2, %xmm0, %eax
638 ; AVX-NEXT: vmovq %rax, %xmm0
639 ; AVX-NEXT: vpslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
641 %e = extractelement <8 x i16> %x, i32 2
642 %z = zext i16 %e to i64
643 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 1
647 define <2 x i64> @extract3_i16_zext_insert1_i64_undef(<8 x i16> %x) {
648 ; SSE2-LABEL: extract3_i16_zext_insert1_i64_undef:
650 ; SSE2-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
651 ; SSE2-NEXT: psrldq {{.*#+}} xmm0 = xmm0[14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
652 ; SSE2-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
655 ; SSE41-LABEL: extract3_i16_zext_insert1_i64_undef:
657 ; SSE41-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,xmm0[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
658 ; SSE41-NEXT: pxor %xmm1, %xmm1
659 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm1[0,1,2,3],xmm0[4],xmm1[5,6,7]
662 ; AVX-LABEL: extract3_i16_zext_insert1_i64_undef:
664 ; AVX-NEXT: vpslldq {{.*#+}} xmm0 = zero,zero,xmm0[0,1,2,3,4,5,6,7,8,9,10,11,12,13]
665 ; AVX-NEXT: vpxor %xmm1, %xmm1, %xmm1
666 ; AVX-NEXT: vpblendw {{.*#+}} xmm0 = xmm1[0,1,2,3],xmm0[4],xmm1[5,6,7]
668 %e = extractelement <8 x i16> %x, i32 3
669 %z = zext i16 %e to i64
670 %r = insertelement <2 x i64> undef, i64 %z, i32 1
674 define <2 x i64> @extract3_i16_zext_insert1_i64_zero(<8 x i16> %x) {
675 ; SSE-LABEL: extract3_i16_zext_insert1_i64_zero:
677 ; SSE-NEXT: pextrw $3, %xmm0, %eax
678 ; SSE-NEXT: movq %rax, %xmm0
679 ; SSE-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
682 ; AVX-LABEL: extract3_i16_zext_insert1_i64_zero:
684 ; AVX-NEXT: vpextrw $3, %xmm0, %eax
685 ; AVX-NEXT: vmovq %rax, %xmm0
686 ; AVX-NEXT: vpslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3,4,5,6,7]
688 %e = extractelement <8 x i16> %x, i32 3
689 %z = zext i16 %e to i64
690 %r = insertelement <2 x i64> zeroinitializer, i64 %z, i32 1