1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -disable-peephole -mtriple=x86_64-unknown-unknown | FileCheck %s --check-prefix=ALL --check-prefix=SSE --check-prefix=SSE2
3 ; RUN: llc < %s -disable-peephole -mtriple=x86_64-unknown-unknown -mattr=+sse3 | FileCheck %s --check-prefix=ALL --check-prefix=SSE --check-prefix=SSE3
4 ; RUN: llc < %s -disable-peephole -mtriple=x86_64-unknown-unknown -mattr=+ssse3 | FileCheck %s --check-prefix=ALL --check-prefix=SSE --check-prefix=SSSE3
5 ; RUN: llc < %s -disable-peephole -mtriple=x86_64-unknown-unknown -mattr=+sse4.1 | FileCheck %s --check-prefix=ALL --check-prefix=SSE --check-prefix=SSE41
6 ; RUN: llc < %s -disable-peephole -mtriple=x86_64-unknown-unknown -mattr=+avx | FileCheck %s --check-prefix=ALL --check-prefix=AVX --check-prefix=AVX1OR2 --check-prefix=AVX1
7 ; RUN: llc < %s -disable-peephole -mtriple=x86_64-unknown-unknown -mattr=+avx2 | FileCheck %s --check-prefixes=ALL,AVX,AVX1OR2,AVX2OR512VL,AVX2,AVX2-SLOW
8 ; RUN: llc < %s -disable-peephole -mtriple=x86_64-unknown-unknown -mattr=+avx2,+fast-variable-shuffle | FileCheck %s --check-prefixes=ALL,AVX,AVX1OR2,AVX2OR512VL,AVX2,AVX2-FAST
9 ; RUN: llc < %s -disable-peephole -mtriple=x86_64-unknown-unknown -mattr=+avx512vl,+avx512dq,+fast-variable-shuffle | FileCheck %s --check-prefixes=ALL,AVX,AVX2OR512VL,AVX512VL
11 define <4 x i32> @shuffle_v4i32_0001(<4 x i32> %a, <4 x i32> %b) {
12 ; SSE-LABEL: shuffle_v4i32_0001:
14 ; SSE-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,0,0,1]
17 ; AVX-LABEL: shuffle_v4i32_0001:
19 ; AVX-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[0,0,0,1]
21 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 0, i32 0, i32 1>
22 ret <4 x i32> %shuffle
24 define <4 x i32> @shuffle_v4i32_0020(<4 x i32> %a, <4 x i32> %b) {
25 ; SSE-LABEL: shuffle_v4i32_0020:
27 ; SSE-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,0,2,0]
30 ; AVX-LABEL: shuffle_v4i32_0020:
32 ; AVX-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[0,0,2,0]
34 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 0, i32 2, i32 0>
35 ret <4 x i32> %shuffle
37 define <4 x i32> @shuffle_v4i32_0112(<4 x i32> %a, <4 x i32> %b) {
38 ; SSE-LABEL: shuffle_v4i32_0112:
40 ; SSE-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,1,1,2]
43 ; AVX-LABEL: shuffle_v4i32_0112:
45 ; AVX-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[0,1,1,2]
47 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 1, i32 1, i32 2>
48 ret <4 x i32> %shuffle
50 define <4 x i32> @shuffle_v4i32_0300(<4 x i32> %a, <4 x i32> %b) {
51 ; SSE-LABEL: shuffle_v4i32_0300:
53 ; SSE-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,3,0,0]
56 ; AVX-LABEL: shuffle_v4i32_0300:
58 ; AVX-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[0,3,0,0]
60 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 3, i32 0, i32 0>
61 ret <4 x i32> %shuffle
63 define <4 x i32> @shuffle_v4i32_1000(<4 x i32> %a, <4 x i32> %b) {
64 ; SSE-LABEL: shuffle_v4i32_1000:
66 ; SSE-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,0,0,0]
69 ; AVX-LABEL: shuffle_v4i32_1000:
71 ; AVX-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[1,0,0,0]
73 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 1, i32 0, i32 0, i32 0>
74 ret <4 x i32> %shuffle
76 define <4 x i32> @shuffle_v4i32_2200(<4 x i32> %a, <4 x i32> %b) {
77 ; SSE-LABEL: shuffle_v4i32_2200:
79 ; SSE-NEXT: pshufd {{.*#+}} xmm0 = xmm0[2,2,0,0]
82 ; AVX-LABEL: shuffle_v4i32_2200:
84 ; AVX-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[2,2,0,0]
86 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 2, i32 2, i32 0, i32 0>
87 ret <4 x i32> %shuffle
89 define <4 x i32> @shuffle_v4i32_3330(<4 x i32> %a, <4 x i32> %b) {
90 ; SSE-LABEL: shuffle_v4i32_3330:
92 ; SSE-NEXT: pshufd {{.*#+}} xmm0 = xmm0[3,3,3,0]
95 ; AVX-LABEL: shuffle_v4i32_3330:
97 ; AVX-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[3,3,3,0]
99 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 3, i32 3, i32 3, i32 0>
100 ret <4 x i32> %shuffle
102 define <4 x i32> @shuffle_v4i32_3210(<4 x i32> %a, <4 x i32> %b) {
103 ; SSE-LABEL: shuffle_v4i32_3210:
105 ; SSE-NEXT: pshufd {{.*#+}} xmm0 = xmm0[3,2,1,0]
108 ; AVX-LABEL: shuffle_v4i32_3210:
110 ; AVX-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[3,2,1,0]
112 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
113 ret <4 x i32> %shuffle
116 define <4 x i32> @shuffle_v4i32_2121(<4 x i32> %a, <4 x i32> %b) {
117 ; SSE-LABEL: shuffle_v4i32_2121:
119 ; SSE-NEXT: pshufd {{.*#+}} xmm0 = xmm0[2,1,2,1]
122 ; AVX-LABEL: shuffle_v4i32_2121:
124 ; AVX-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[2,1,2,1]
126 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 2, i32 1, i32 2, i32 1>
127 ret <4 x i32> %shuffle
130 define <4 x float> @shuffle_v4f32_0001(<4 x float> %a, <4 x float> %b) {
131 ; SSE-LABEL: shuffle_v4f32_0001:
133 ; SSE-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,0,0,1]
136 ; AVX-LABEL: shuffle_v4f32_0001:
138 ; AVX-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[0,0,0,1]
140 %shuffle = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 0, i32 0, i32 0, i32 1>
141 ret <4 x float> %shuffle
143 define <4 x float> @shuffle_v4f32_0020(<4 x float> %a, <4 x float> %b) {
144 ; SSE-LABEL: shuffle_v4f32_0020:
146 ; SSE-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,0,2,0]
149 ; AVX-LABEL: shuffle_v4f32_0020:
151 ; AVX-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[0,0,2,0]
153 %shuffle = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 0, i32 0, i32 2, i32 0>
154 ret <4 x float> %shuffle
156 define <4 x float> @shuffle_v4f32_0300(<4 x float> %a, <4 x float> %b) {
157 ; SSE-LABEL: shuffle_v4f32_0300:
159 ; SSE-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,3,0,0]
162 ; AVX-LABEL: shuffle_v4f32_0300:
164 ; AVX-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[0,3,0,0]
166 %shuffle = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 0, i32 3, i32 0, i32 0>
167 ret <4 x float> %shuffle
169 define <4 x float> @shuffle_v4f32_1000(<4 x float> %a, <4 x float> %b) {
170 ; SSE-LABEL: shuffle_v4f32_1000:
172 ; SSE-NEXT: shufps {{.*#+}} xmm0 = xmm0[1,0,0,0]
175 ; AVX-LABEL: shuffle_v4f32_1000:
177 ; AVX-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[1,0,0,0]
179 %shuffle = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 1, i32 0, i32 0, i32 0>
180 ret <4 x float> %shuffle
182 define <4 x float> @shuffle_v4f32_2200(<4 x float> %a, <4 x float> %b) {
183 ; SSE-LABEL: shuffle_v4f32_2200:
185 ; SSE-NEXT: shufps {{.*#+}} xmm0 = xmm0[2,2,0,0]
188 ; AVX-LABEL: shuffle_v4f32_2200:
190 ; AVX-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[2,2,0,0]
192 %shuffle = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 2, i32 2, i32 0, i32 0>
193 ret <4 x float> %shuffle
195 define <4 x float> @shuffle_v4f32_3330(<4 x float> %a, <4 x float> %b) {
196 ; SSE-LABEL: shuffle_v4f32_3330:
198 ; SSE-NEXT: shufps {{.*#+}} xmm0 = xmm0[3,3,3,0]
201 ; AVX-LABEL: shuffle_v4f32_3330:
203 ; AVX-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[3,3,3,0]
205 %shuffle = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 3, i32 3, i32 3, i32 0>
206 ret <4 x float> %shuffle
208 define <4 x float> @shuffle_v4f32_3210(<4 x float> %a, <4 x float> %b) {
209 ; SSE-LABEL: shuffle_v4f32_3210:
211 ; SSE-NEXT: shufps {{.*#+}} xmm0 = xmm0[3,2,1,0]
214 ; AVX-LABEL: shuffle_v4f32_3210:
216 ; AVX-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[3,2,1,0]
218 %shuffle = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
219 ret <4 x float> %shuffle
221 define <4 x float> @shuffle_v4f32_0011(<4 x float> %a, <4 x float> %b) {
222 ; SSE-LABEL: shuffle_v4f32_0011:
224 ; SSE-NEXT: unpcklps {{.*#+}} xmm0 = xmm0[0,0,1,1]
227 ; AVX-LABEL: shuffle_v4f32_0011:
229 ; AVX-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[0,0,1,1]
231 %shuffle = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 0, i32 0, i32 1, i32 1>
232 ret <4 x float> %shuffle
234 define <4 x float> @shuffle_v4f32_2233(<4 x float> %a, <4 x float> %b) {
235 ; SSE-LABEL: shuffle_v4f32_2233:
237 ; SSE-NEXT: unpckhps {{.*#+}} xmm0 = xmm0[2,2,3,3]
240 ; AVX-LABEL: shuffle_v4f32_2233:
242 ; AVX-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[2,2,3,3]
244 %shuffle = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 2, i32 2, i32 3, i32 3>
245 ret <4 x float> %shuffle
247 define <4 x float> @shuffle_v4f32_0022(<4 x float> %a, <4 x float> %b) {
248 ; SSE2-LABEL: shuffle_v4f32_0022:
250 ; SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,0,2,2]
253 ; SSE3-LABEL: shuffle_v4f32_0022:
255 ; SSE3-NEXT: movsldup {{.*#+}} xmm0 = xmm0[0,0,2,2]
258 ; SSSE3-LABEL: shuffle_v4f32_0022:
260 ; SSSE3-NEXT: movsldup {{.*#+}} xmm0 = xmm0[0,0,2,2]
263 ; SSE41-LABEL: shuffle_v4f32_0022:
265 ; SSE41-NEXT: movsldup {{.*#+}} xmm0 = xmm0[0,0,2,2]
268 ; AVX-LABEL: shuffle_v4f32_0022:
270 ; AVX-NEXT: vmovsldup {{.*#+}} xmm0 = xmm0[0,0,2,2]
272 %shuffle = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 0, i32 0, i32 2, i32 2>
273 ret <4 x float> %shuffle
275 define <4 x float> @shuffle_v4f32_1133(<4 x float> %a, <4 x float> %b) {
276 ; SSE2-LABEL: shuffle_v4f32_1133:
278 ; SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[1,1,3,3]
281 ; SSE3-LABEL: shuffle_v4f32_1133:
283 ; SSE3-NEXT: movshdup {{.*#+}} xmm0 = xmm0[1,1,3,3]
286 ; SSSE3-LABEL: shuffle_v4f32_1133:
288 ; SSSE3-NEXT: movshdup {{.*#+}} xmm0 = xmm0[1,1,3,3]
291 ; SSE41-LABEL: shuffle_v4f32_1133:
293 ; SSE41-NEXT: movshdup {{.*#+}} xmm0 = xmm0[1,1,3,3]
296 ; AVX-LABEL: shuffle_v4f32_1133:
298 ; AVX-NEXT: vmovshdup {{.*#+}} xmm0 = xmm0[1,1,3,3]
300 %shuffle = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 1, i32 1, i32 3, i32 3>
301 ret <4 x float> %shuffle
304 define <4 x float> @shuffle_v4f32_0145(<4 x float> %a, <4 x float> %b) {
305 ; SSE-LABEL: shuffle_v4f32_0145:
307 ; SSE-NEXT: movlhps {{.*#+}} xmm0 = xmm0[0],xmm1[0]
310 ; AVX-LABEL: shuffle_v4f32_0145:
312 ; AVX-NEXT: vmovlhps {{.*#+}} xmm0 = xmm0[0],xmm1[0]
314 %shuffle = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 0, i32 1, i32 4, i32 5>
315 ret <4 x float> %shuffle
318 define <4 x float> @shuffle_v4f32_6723(<4 x float> %a, <4 x float> %b) {
319 ; SSE-LABEL: shuffle_v4f32_6723:
321 ; SSE-NEXT: movhlps {{.*#+}} xmm0 = xmm1[1],xmm0[1]
324 ; AVX-LABEL: shuffle_v4f32_6723:
326 ; AVX-NEXT: vunpckhpd {{.*#+}} xmm0 = xmm1[1],xmm0[1]
328 %shuffle = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 6, i32 7, i32 2, i32 3>
329 ret <4 x float> %shuffle
332 define <4 x i32> @shuffle_v4i32_0124(<4 x i32> %a, <4 x i32> %b) {
333 ; SSE2-LABEL: shuffle_v4i32_0124:
335 ; SSE2-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,0],xmm0[2,0]
336 ; SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,1],xmm1[2,0]
339 ; SSE3-LABEL: shuffle_v4i32_0124:
341 ; SSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,0],xmm0[2,0]
342 ; SSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,1],xmm1[2,0]
345 ; SSSE3-LABEL: shuffle_v4i32_0124:
347 ; SSSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,0],xmm0[2,0]
348 ; SSSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,1],xmm1[2,0]
351 ; SSE41-LABEL: shuffle_v4i32_0124:
353 ; SSE41-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,1,2,0]
354 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm0[0,1,2,3,4,5],xmm1[6,7]
357 ; AVX1OR2-LABEL: shuffle_v4i32_0124:
359 ; AVX1OR2-NEXT: vpermilps {{.*#+}} xmm1 = xmm1[0,1,2,0]
360 ; AVX1OR2-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0,1,2],xmm1[3]
363 ; AVX512VL-LABEL: shuffle_v4i32_0124:
365 ; AVX512VL-NEXT: vmovdqa {{.*#+}} xmm2 = [0,1,2,4]
366 ; AVX512VL-NEXT: vpermt2d %xmm1, %xmm2, %xmm0
367 ; AVX512VL-NEXT: retq
368 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 1, i32 2, i32 4>
369 ret <4 x i32> %shuffle
371 define <4 x i32> @shuffle_v4i32_0142(<4 x i32> %a, <4 x i32> %b) {
372 ; SSE2-LABEL: shuffle_v4i32_0142:
374 ; SSE2-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,0],xmm0[2,0]
375 ; SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,1],xmm1[0,2]
378 ; SSE3-LABEL: shuffle_v4i32_0142:
380 ; SSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,0],xmm0[2,0]
381 ; SSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,1],xmm1[0,2]
384 ; SSSE3-LABEL: shuffle_v4i32_0142:
386 ; SSSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,0],xmm0[2,0]
387 ; SSSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,1],xmm1[0,2]
390 ; SSE41-LABEL: shuffle_v4i32_0142:
392 ; SSE41-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,1,0,1]
393 ; SSE41-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,1,2,2]
394 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm0[0,1,2,3],xmm1[4,5],xmm0[6,7]
397 ; AVX1-LABEL: shuffle_v4i32_0142:
399 ; AVX1-NEXT: vpermilps {{.*#+}} xmm1 = xmm1[0,1,0,1]
400 ; AVX1-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[0,1,2,2]
401 ; AVX1-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0,1],xmm1[2],xmm0[3]
404 ; AVX2-LABEL: shuffle_v4i32_0142:
406 ; AVX2-NEXT: vbroadcastss %xmm1, %xmm1
407 ; AVX2-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[0,1,2,2]
408 ; AVX2-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0,1],xmm1[2],xmm0[3]
411 ; AVX512VL-LABEL: shuffle_v4i32_0142:
413 ; AVX512VL-NEXT: vmovdqa {{.*#+}} xmm2 = [0,1,4,2]
414 ; AVX512VL-NEXT: vpermt2d %xmm1, %xmm2, %xmm0
415 ; AVX512VL-NEXT: retq
416 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 1, i32 4, i32 2>
417 ret <4 x i32> %shuffle
419 define <4 x i32> @shuffle_v4i32_0412(<4 x i32> %a, <4 x i32> %b) {
420 ; SSE2-LABEL: shuffle_v4i32_0412:
422 ; SSE2-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,0],xmm0[0,0]
423 ; SSE2-NEXT: shufps {{.*#+}} xmm1 = xmm1[2,0],xmm0[1,2]
424 ; SSE2-NEXT: movaps %xmm1, %xmm0
427 ; SSE3-LABEL: shuffle_v4i32_0412:
429 ; SSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,0],xmm0[0,0]
430 ; SSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[2,0],xmm0[1,2]
431 ; SSE3-NEXT: movaps %xmm1, %xmm0
434 ; SSSE3-LABEL: shuffle_v4i32_0412:
436 ; SSSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,0],xmm0[0,0]
437 ; SSSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[2,0],xmm0[1,2]
438 ; SSSE3-NEXT: movaps %xmm1, %xmm0
441 ; SSE41-LABEL: shuffle_v4i32_0412:
443 ; SSE41-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,0,1,1]
444 ; SSE41-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,1,1,2]
445 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm0[0,1],xmm1[2,3],xmm0[4,5,6,7]
448 ; AVX1OR2-LABEL: shuffle_v4i32_0412:
450 ; AVX1OR2-NEXT: vpermilps {{.*#+}} xmm1 = xmm1[0,0,1,1]
451 ; AVX1OR2-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[0,1,1,2]
452 ; AVX1OR2-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0],xmm1[1],xmm0[2,3]
455 ; AVX512VL-LABEL: shuffle_v4i32_0412:
457 ; AVX512VL-NEXT: vmovdqa {{.*#+}} xmm2 = [0,4,1,2]
458 ; AVX512VL-NEXT: vpermt2d %xmm1, %xmm2, %xmm0
459 ; AVX512VL-NEXT: retq
460 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 4, i32 1, i32 2>
461 ret <4 x i32> %shuffle
463 define <4 x i32> @shuffle_v4i32_4012(<4 x i32> %a, <4 x i32> %b) {
464 ; SSE2-LABEL: shuffle_v4i32_4012:
466 ; SSE2-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,0],xmm0[0,0]
467 ; SSE2-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,2],xmm0[1,2]
468 ; SSE2-NEXT: movaps %xmm1, %xmm0
471 ; SSE3-LABEL: shuffle_v4i32_4012:
473 ; SSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,0],xmm0[0,0]
474 ; SSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,2],xmm0[1,2]
475 ; SSE3-NEXT: movaps %xmm1, %xmm0
478 ; SSSE3-LABEL: shuffle_v4i32_4012:
480 ; SSSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,0],xmm0[0,0]
481 ; SSSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,2],xmm0[1,2]
482 ; SSSE3-NEXT: movaps %xmm1, %xmm0
485 ; SSE41-LABEL: shuffle_v4i32_4012:
487 ; SSE41-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,0,1,2]
488 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm1[0,1],xmm0[2,3,4,5,6,7]
491 ; AVX1OR2-LABEL: shuffle_v4i32_4012:
493 ; AVX1OR2-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[0,0,1,2]
494 ; AVX1OR2-NEXT: vblendps {{.*#+}} xmm0 = xmm1[0],xmm0[1,2,3]
497 ; AVX512VL-LABEL: shuffle_v4i32_4012:
499 ; AVX512VL-NEXT: vmovdqa {{.*#+}} xmm2 = [4,0,1,2]
500 ; AVX512VL-NEXT: vpermt2d %xmm1, %xmm2, %xmm0
501 ; AVX512VL-NEXT: retq
502 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 4, i32 0, i32 1, i32 2>
503 ret <4 x i32> %shuffle
505 define <4 x i32> @shuffle_v4i32_0145(<4 x i32> %a, <4 x i32> %b) {
506 ; SSE-LABEL: shuffle_v4i32_0145:
508 ; SSE-NEXT: movlhps {{.*#+}} xmm0 = xmm0[0],xmm1[0]
511 ; AVX-LABEL: shuffle_v4i32_0145:
513 ; AVX-NEXT: vmovlhps {{.*#+}} xmm0 = xmm0[0],xmm1[0]
515 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 1, i32 4, i32 5>
516 ret <4 x i32> %shuffle
518 define <4 x i32> @shuffle_v4i32_0451(<4 x i32> %a, <4 x i32> %b) {
519 ; SSE2-LABEL: shuffle_v4i32_0451:
521 ; SSE2-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
522 ; SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,1,3,2]
525 ; SSE3-LABEL: shuffle_v4i32_0451:
527 ; SSE3-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
528 ; SSE3-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,1,3,2]
531 ; SSSE3-LABEL: shuffle_v4i32_0451:
533 ; SSSE3-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
534 ; SSSE3-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,1,3,2]
537 ; SSE41-LABEL: shuffle_v4i32_0451:
539 ; SSE41-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,0,1,1]
540 ; SSE41-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,1,0,1]
541 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm0[0,1],xmm1[2,3,4,5],xmm0[6,7]
544 ; AVX1-LABEL: shuffle_v4i32_0451:
546 ; AVX1-NEXT: vpermilps {{.*#+}} xmm1 = xmm1[0,0,1,1]
547 ; AVX1-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[0,1,0,1]
548 ; AVX1-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0],xmm1[1,2],xmm0[3]
551 ; AVX2-LABEL: shuffle_v4i32_0451:
553 ; AVX2-NEXT: vpermilps {{.*#+}} xmm1 = xmm1[0,0,1,1]
554 ; AVX2-NEXT: vmovddup {{.*#+}} xmm0 = xmm0[0,0]
555 ; AVX2-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0],xmm1[1,2],xmm0[3]
558 ; AVX512VL-LABEL: shuffle_v4i32_0451:
560 ; AVX512VL-NEXT: vmovdqa {{.*#+}} xmm2 = [0,4,5,1]
561 ; AVX512VL-NEXT: vpermt2d %xmm1, %xmm2, %xmm0
562 ; AVX512VL-NEXT: retq
563 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 4, i32 5, i32 1>
564 ret <4 x i32> %shuffle
566 define <4 x i32> @shuffle_v4i32_4501(<4 x i32> %a, <4 x i32> %b) {
567 ; SSE-LABEL: shuffle_v4i32_4501:
569 ; SSE-NEXT: movlhps {{.*#+}} xmm1 = xmm1[0],xmm0[0]
570 ; SSE-NEXT: movaps %xmm1, %xmm0
573 ; AVX-LABEL: shuffle_v4i32_4501:
575 ; AVX-NEXT: vmovlhps {{.*#+}} xmm0 = xmm1[0],xmm0[0]
577 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 4, i32 5, i32 0, i32 1>
578 ret <4 x i32> %shuffle
580 define <4 x i32> @shuffle_v4i32_4015(<4 x i32> %a, <4 x i32> %b) {
581 ; SSE2-LABEL: shuffle_v4i32_4015:
583 ; SSE2-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
584 ; SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,0,2,3]
587 ; SSE3-LABEL: shuffle_v4i32_4015:
589 ; SSE3-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
590 ; SSE3-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,0,2,3]
593 ; SSSE3-LABEL: shuffle_v4i32_4015:
595 ; SSSE3-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
596 ; SSSE3-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,0,2,3]
599 ; SSE41-LABEL: shuffle_v4i32_4015:
601 ; SSE41-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,1,0,1]
602 ; SSE41-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,0,1,1]
603 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm1[0,1],xmm0[2,3,4,5],xmm1[6,7]
606 ; AVX1-LABEL: shuffle_v4i32_4015:
608 ; AVX1-NEXT: vpermilps {{.*#+}} xmm1 = xmm1[0,1,0,1]
609 ; AVX1-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[0,0,1,1]
610 ; AVX1-NEXT: vblendps {{.*#+}} xmm0 = xmm1[0],xmm0[1,2],xmm1[3]
613 ; AVX2-LABEL: shuffle_v4i32_4015:
615 ; AVX2-NEXT: vmovddup {{.*#+}} xmm1 = xmm1[0,0]
616 ; AVX2-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[0,0,1,1]
617 ; AVX2-NEXT: vblendps {{.*#+}} xmm0 = xmm1[0],xmm0[1,2],xmm1[3]
620 ; AVX512VL-LABEL: shuffle_v4i32_4015:
622 ; AVX512VL-NEXT: vmovdqa {{.*#+}} xmm2 = [4,0,1,5]
623 ; AVX512VL-NEXT: vpermt2d %xmm1, %xmm2, %xmm0
624 ; AVX512VL-NEXT: retq
625 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 4, i32 0, i32 1, i32 5>
626 ret <4 x i32> %shuffle
629 define <4 x float> @shuffle_v4f32_4zzz(<4 x float> %a) {
630 ; SSE2-LABEL: shuffle_v4f32_4zzz:
632 ; SSE2-NEXT: xorps %xmm1, %xmm1
633 ; SSE2-NEXT: movss {{.*#+}} xmm1 = xmm0[0],xmm1[1,2,3]
634 ; SSE2-NEXT: movaps %xmm1, %xmm0
637 ; SSE3-LABEL: shuffle_v4f32_4zzz:
639 ; SSE3-NEXT: xorps %xmm1, %xmm1
640 ; SSE3-NEXT: movss {{.*#+}} xmm1 = xmm0[0],xmm1[1,2,3]
641 ; SSE3-NEXT: movaps %xmm1, %xmm0
644 ; SSSE3-LABEL: shuffle_v4f32_4zzz:
646 ; SSSE3-NEXT: xorps %xmm1, %xmm1
647 ; SSSE3-NEXT: movss {{.*#+}} xmm1 = xmm0[0],xmm1[1,2,3]
648 ; SSSE3-NEXT: movaps %xmm1, %xmm0
651 ; SSE41-LABEL: shuffle_v4f32_4zzz:
653 ; SSE41-NEXT: xorps %xmm1, %xmm1
654 ; SSE41-NEXT: blendps {{.*#+}} xmm0 = xmm0[0],xmm1[1,2,3]
657 ; AVX-LABEL: shuffle_v4f32_4zzz:
659 ; AVX-NEXT: vxorps %xmm1, %xmm1, %xmm1
660 ; AVX-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0],xmm1[1,2,3]
662 %shuffle = shufflevector <4 x float> zeroinitializer, <4 x float> %a, <4 x i32> <i32 4, i32 1, i32 2, i32 3>
663 ret <4 x float> %shuffle
666 define <4 x float> @shuffle_v4f32_z4zz(<4 x float> %a) {
667 ; SSE2-LABEL: shuffle_v4f32_z4zz:
669 ; SSE2-NEXT: xorps %xmm1, %xmm1
670 ; SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,0],xmm1[0,0]
671 ; SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[2,0],xmm1[2,3]
674 ; SSE3-LABEL: shuffle_v4f32_z4zz:
676 ; SSE3-NEXT: xorps %xmm1, %xmm1
677 ; SSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,0],xmm1[0,0]
678 ; SSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[2,0],xmm1[2,3]
681 ; SSSE3-LABEL: shuffle_v4f32_z4zz:
683 ; SSSE3-NEXT: xorps %xmm1, %xmm1
684 ; SSSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,0],xmm1[0,0]
685 ; SSSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[2,0],xmm1[2,3]
688 ; SSE41-LABEL: shuffle_v4f32_z4zz:
690 ; SSE41-NEXT: insertps {{.*#+}} xmm0 = zero,xmm0[0],zero,zero
693 ; AVX-LABEL: shuffle_v4f32_z4zz:
695 ; AVX-NEXT: vinsertps {{.*#+}} xmm0 = zero,xmm0[0],zero,zero
697 %shuffle = shufflevector <4 x float> zeroinitializer, <4 x float> %a, <4 x i32> <i32 2, i32 4, i32 3, i32 0>
698 ret <4 x float> %shuffle
701 define <4 x float> @shuffle_v4f32_zz4z(<4 x float> %a) {
702 ; SSE2-LABEL: shuffle_v4f32_zz4z:
704 ; SSE2-NEXT: xorps %xmm1, %xmm1
705 ; SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,0],xmm1[3,0]
706 ; SSE2-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,1],xmm0[0,2]
707 ; SSE2-NEXT: movaps %xmm1, %xmm0
710 ; SSE3-LABEL: shuffle_v4f32_zz4z:
712 ; SSE3-NEXT: xorps %xmm1, %xmm1
713 ; SSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,0],xmm1[3,0]
714 ; SSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,1],xmm0[0,2]
715 ; SSE3-NEXT: movaps %xmm1, %xmm0
718 ; SSSE3-LABEL: shuffle_v4f32_zz4z:
720 ; SSSE3-NEXT: xorps %xmm1, %xmm1
721 ; SSSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,0],xmm1[3,0]
722 ; SSSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,1],xmm0[0,2]
723 ; SSSE3-NEXT: movaps %xmm1, %xmm0
726 ; SSE41-LABEL: shuffle_v4f32_zz4z:
728 ; SSE41-NEXT: insertps {{.*#+}} xmm0 = zero,zero,xmm0[0],zero
731 ; AVX-LABEL: shuffle_v4f32_zz4z:
733 ; AVX-NEXT: vinsertps {{.*#+}} xmm0 = zero,zero,xmm0[0],zero
735 %shuffle = shufflevector <4 x float> zeroinitializer, <4 x float> %a, <4 x i32> <i32 0, i32 0, i32 4, i32 0>
736 ret <4 x float> %shuffle
739 define <4 x float> @shuffle_v4f32_zuu4(<4 x float> %a) {
740 ; SSE2-LABEL: shuffle_v4f32_zuu4:
742 ; SSE2-NEXT: xorps %xmm1, %xmm1
743 ; SSE2-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,1],xmm0[2,0]
744 ; SSE2-NEXT: movaps %xmm1, %xmm0
747 ; SSE3-LABEL: shuffle_v4f32_zuu4:
749 ; SSE3-NEXT: xorps %xmm1, %xmm1
750 ; SSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,1],xmm0[2,0]
751 ; SSE3-NEXT: movaps %xmm1, %xmm0
754 ; SSSE3-LABEL: shuffle_v4f32_zuu4:
756 ; SSSE3-NEXT: xorps %xmm1, %xmm1
757 ; SSSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,1],xmm0[2,0]
758 ; SSSE3-NEXT: movaps %xmm1, %xmm0
761 ; SSE41-LABEL: shuffle_v4f32_zuu4:
763 ; SSE41-NEXT: insertps {{.*#+}} xmm0 = zero,zero,zero,xmm0[0]
766 ; AVX-LABEL: shuffle_v4f32_zuu4:
768 ; AVX-NEXT: vinsertps {{.*#+}} xmm0 = zero,zero,zero,xmm0[0]
770 %shuffle = shufflevector <4 x float> zeroinitializer, <4 x float> %a, <4 x i32> <i32 0, i32 undef, i32 undef, i32 4>
771 ret <4 x float> %shuffle
774 define <4 x float> @shuffle_v4f32_zzz7(<4 x float> %a) {
775 ; SSE2-LABEL: shuffle_v4f32_zzz7:
777 ; SSE2-NEXT: xorps %xmm1, %xmm1
778 ; SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[3,0],xmm1[2,0]
779 ; SSE2-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,1],xmm0[2,0]
780 ; SSE2-NEXT: movaps %xmm1, %xmm0
783 ; SSE3-LABEL: shuffle_v4f32_zzz7:
785 ; SSE3-NEXT: xorps %xmm1, %xmm1
786 ; SSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[3,0],xmm1[2,0]
787 ; SSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,1],xmm0[2,0]
788 ; SSE3-NEXT: movaps %xmm1, %xmm0
791 ; SSSE3-LABEL: shuffle_v4f32_zzz7:
793 ; SSSE3-NEXT: xorps %xmm1, %xmm1
794 ; SSSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[3,0],xmm1[2,0]
795 ; SSSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,1],xmm0[2,0]
796 ; SSSE3-NEXT: movaps %xmm1, %xmm0
799 ; SSE41-LABEL: shuffle_v4f32_zzz7:
801 ; SSE41-NEXT: xorps %xmm1, %xmm1
802 ; SSE41-NEXT: blendps {{.*#+}} xmm0 = xmm1[0,1,2],xmm0[3]
805 ; AVX-LABEL: shuffle_v4f32_zzz7:
807 ; AVX-NEXT: vxorps %xmm1, %xmm1, %xmm1
808 ; AVX-NEXT: vblendps {{.*#+}} xmm0 = xmm1[0,1,2],xmm0[3]
810 %shuffle = shufflevector <4 x float> zeroinitializer, <4 x float> %a, <4 x i32> <i32 0, i32 1, i32 2, i32 7>
811 ret <4 x float> %shuffle
814 define <4 x float> @shuffle_v4f32_z6zz(<4 x float> %a) {
815 ; SSE2-LABEL: shuffle_v4f32_z6zz:
817 ; SSE2-NEXT: xorps %xmm1, %xmm1
818 ; SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[2,0],xmm1[0,0]
819 ; SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[2,0],xmm1[2,3]
822 ; SSE3-LABEL: shuffle_v4f32_z6zz:
824 ; SSE3-NEXT: xorps %xmm1, %xmm1
825 ; SSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[2,0],xmm1[0,0]
826 ; SSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[2,0],xmm1[2,3]
829 ; SSSE3-LABEL: shuffle_v4f32_z6zz:
831 ; SSSE3-NEXT: xorps %xmm1, %xmm1
832 ; SSSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[2,0],xmm1[0,0]
833 ; SSSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[2,0],xmm1[2,3]
836 ; SSE41-LABEL: shuffle_v4f32_z6zz:
838 ; SSE41-NEXT: insertps {{.*#+}} xmm0 = zero,xmm0[2],zero,zero
841 ; AVX-LABEL: shuffle_v4f32_z6zz:
843 ; AVX-NEXT: vinsertps {{.*#+}} xmm0 = zero,xmm0[2],zero,zero
845 %shuffle = shufflevector <4 x float> zeroinitializer, <4 x float> %a, <4 x i32> <i32 0, i32 6, i32 2, i32 3>
846 ret <4 x float> %shuffle
849 define <4 x float> @shuffle_v4f32_0z23(<4 x float> %a) {
850 ; SSE2-LABEL: shuffle_v4f32_0z23:
852 ; SSE2-NEXT: xorps %xmm1, %xmm1
853 ; SSE2-NEXT: shufps {{.*#+}} xmm1 = xmm1[1,0],xmm0[0,0]
854 ; SSE2-NEXT: shufps {{.*#+}} xmm1 = xmm1[2,0],xmm0[2,3]
855 ; SSE2-NEXT: movaps %xmm1, %xmm0
858 ; SSE3-LABEL: shuffle_v4f32_0z23:
860 ; SSE3-NEXT: xorps %xmm1, %xmm1
861 ; SSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[1,0],xmm0[0,0]
862 ; SSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[2,0],xmm0[2,3]
863 ; SSE3-NEXT: movaps %xmm1, %xmm0
866 ; SSSE3-LABEL: shuffle_v4f32_0z23:
868 ; SSSE3-NEXT: xorps %xmm1, %xmm1
869 ; SSSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[1,0],xmm0[0,0]
870 ; SSSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[2,0],xmm0[2,3]
871 ; SSSE3-NEXT: movaps %xmm1, %xmm0
874 ; SSE41-LABEL: shuffle_v4f32_0z23:
876 ; SSE41-NEXT: xorps %xmm1, %xmm1
877 ; SSE41-NEXT: blendps {{.*#+}} xmm0 = xmm0[0],xmm1[1],xmm0[2,3]
880 ; AVX-LABEL: shuffle_v4f32_0z23:
882 ; AVX-NEXT: vxorps %xmm1, %xmm1, %xmm1
883 ; AVX-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0],xmm1[1],xmm0[2,3]
885 %shuffle = shufflevector <4 x float> %a, <4 x float> zeroinitializer, <4 x i32> <i32 0, i32 4, i32 2, i32 3>
886 ret <4 x float> %shuffle
889 define <4 x float> @shuffle_v4f32_01z3(<4 x float> %a) {
890 ; SSE2-LABEL: shuffle_v4f32_01z3:
892 ; SSE2-NEXT: xorps %xmm1, %xmm1
893 ; SSE2-NEXT: shufps {{.*#+}} xmm1 = xmm1[2,0],xmm0[3,0]
894 ; SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,1],xmm1[0,2]
897 ; SSE3-LABEL: shuffle_v4f32_01z3:
899 ; SSE3-NEXT: xorps %xmm1, %xmm1
900 ; SSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[2,0],xmm0[3,0]
901 ; SSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,1],xmm1[0,2]
904 ; SSSE3-LABEL: shuffle_v4f32_01z3:
906 ; SSSE3-NEXT: xorps %xmm1, %xmm1
907 ; SSSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[2,0],xmm0[3,0]
908 ; SSSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,1],xmm1[0,2]
911 ; SSE41-LABEL: shuffle_v4f32_01z3:
913 ; SSE41-NEXT: xorps %xmm1, %xmm1
914 ; SSE41-NEXT: blendps {{.*#+}} xmm0 = xmm0[0,1],xmm1[2],xmm0[3]
917 ; AVX-LABEL: shuffle_v4f32_01z3:
919 ; AVX-NEXT: vxorps %xmm1, %xmm1, %xmm1
920 ; AVX-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0,1],xmm1[2],xmm0[3]
922 %shuffle = shufflevector <4 x float> %a, <4 x float> zeroinitializer, <4 x i32> <i32 0, i32 1, i32 4, i32 3>
923 ret <4 x float> %shuffle
926 define <4 x float> @shuffle_v4f32_012z(<4 x float> %a) {
927 ; SSE2-LABEL: shuffle_v4f32_012z:
929 ; SSE2-NEXT: xorps %xmm1, %xmm1
930 ; SSE2-NEXT: shufps {{.*#+}} xmm1 = xmm1[3,0],xmm0[2,0]
931 ; SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,1],xmm1[2,0]
934 ; SSE3-LABEL: shuffle_v4f32_012z:
936 ; SSE3-NEXT: xorps %xmm1, %xmm1
937 ; SSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[3,0],xmm0[2,0]
938 ; SSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,1],xmm1[2,0]
941 ; SSSE3-LABEL: shuffle_v4f32_012z:
943 ; SSSE3-NEXT: xorps %xmm1, %xmm1
944 ; SSSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[3,0],xmm0[2,0]
945 ; SSSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,1],xmm1[2,0]
948 ; SSE41-LABEL: shuffle_v4f32_012z:
950 ; SSE41-NEXT: xorps %xmm1, %xmm1
951 ; SSE41-NEXT: blendps {{.*#+}} xmm0 = xmm0[0,1,2],xmm1[3]
954 ; AVX-LABEL: shuffle_v4f32_012z:
956 ; AVX-NEXT: vxorps %xmm1, %xmm1, %xmm1
957 ; AVX-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0,1,2],xmm1[3]
959 %shuffle = shufflevector <4 x float> %a, <4 x float> zeroinitializer, <4 x i32> <i32 0, i32 1, i32 2, i32 7>
960 ret <4 x float> %shuffle
963 define <4 x float> @shuffle_v4f32_0zz3(<4 x float> %a) {
964 ; SSE2-LABEL: shuffle_v4f32_0zz3:
966 ; SSE2-NEXT: xorps %xmm1, %xmm1
967 ; SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,3],xmm1[1,2]
968 ; SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,2,3,1]
971 ; SSE3-LABEL: shuffle_v4f32_0zz3:
973 ; SSE3-NEXT: xorps %xmm1, %xmm1
974 ; SSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,3],xmm1[1,2]
975 ; SSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,2,3,1]
978 ; SSSE3-LABEL: shuffle_v4f32_0zz3:
980 ; SSSE3-NEXT: xorps %xmm1, %xmm1
981 ; SSSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,3],xmm1[1,2]
982 ; SSSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,2,3,1]
985 ; SSE41-LABEL: shuffle_v4f32_0zz3:
987 ; SSE41-NEXT: xorps %xmm1, %xmm1
988 ; SSE41-NEXT: blendps {{.*#+}} xmm0 = xmm0[0],xmm1[1,2],xmm0[3]
991 ; AVX-LABEL: shuffle_v4f32_0zz3:
993 ; AVX-NEXT: vxorps %xmm1, %xmm1, %xmm1
994 ; AVX-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0],xmm1[1,2],xmm0[3]
996 %shuffle = shufflevector <4 x float> %a, <4 x float> zeroinitializer, <4 x i32> <i32 0, i32 4, i32 4, i32 3>
997 ret <4 x float> %shuffle
1000 define <4 x float> @shuffle_v4f32_0z2z(<4 x float> %v) {
1001 ; SSE2-LABEL: shuffle_v4f32_0z2z:
1003 ; SSE2-NEXT: xorps %xmm1, %xmm1
1004 ; SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,2],xmm1[0,0]
1005 ; SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,2,1,3]
1008 ; SSE3-LABEL: shuffle_v4f32_0z2z:
1010 ; SSE3-NEXT: xorps %xmm1, %xmm1
1011 ; SSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,2],xmm1[0,0]
1012 ; SSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,2,1,3]
1015 ; SSSE3-LABEL: shuffle_v4f32_0z2z:
1017 ; SSSE3-NEXT: xorps %xmm1, %xmm1
1018 ; SSSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,2],xmm1[0,0]
1019 ; SSSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,2,1,3]
1022 ; SSE41-LABEL: shuffle_v4f32_0z2z:
1024 ; SSE41-NEXT: xorps %xmm1, %xmm1
1025 ; SSE41-NEXT: blendps {{.*#+}} xmm0 = xmm0[0],xmm1[1],xmm0[2],xmm1[3]
1028 ; AVX-LABEL: shuffle_v4f32_0z2z:
1030 ; AVX-NEXT: vxorps %xmm1, %xmm1, %xmm1
1031 ; AVX-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0],xmm1[1],xmm0[2],xmm1[3]
1033 %shuffle = shufflevector <4 x float> %v, <4 x float> <float 0.000000e+00, float undef, float undef, float undef>, <4 x i32> <i32 0, i32 4, i32 2, i32 4>
1034 ret <4 x float> %shuffle
1037 define <4 x float> @shuffle_v4f32_u051(<4 x float> %a, <4 x float> %b) {
1038 ; SSE-LABEL: shuffle_v4f32_u051:
1040 ; SSE-NEXT: unpcklps {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
1041 ; SSE-NEXT: movaps %xmm1, %xmm0
1044 ; AVX-LABEL: shuffle_v4f32_u051:
1046 ; AVX-NEXT: vunpcklps {{.*#+}} xmm0 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
1048 %shuffle = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 undef, i32 0, i32 5, i32 1>
1049 ret <4 x float> %shuffle
1052 define <4 x float> @shuffle_v4f32_0zz4(<4 x float> %a, <4 x float> %b) {
1053 ; SSE2-LABEL: shuffle_v4f32_0zz4:
1055 ; SSE2-NEXT: xorps %xmm2, %xmm2
1056 ; SSE2-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,0],xmm2[2,0]
1057 ; SSE2-NEXT: shufps {{.*#+}} xmm2 = xmm2[0,1],xmm1[2,0]
1058 ; SSE2-NEXT: movss {{.*#+}} xmm2 = xmm0[0],xmm2[1,2,3]
1059 ; SSE2-NEXT: movaps %xmm2, %xmm0
1062 ; SSE3-LABEL: shuffle_v4f32_0zz4:
1064 ; SSE3-NEXT: xorps %xmm2, %xmm2
1065 ; SSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,0],xmm2[2,0]
1066 ; SSE3-NEXT: shufps {{.*#+}} xmm2 = xmm2[0,1],xmm1[2,0]
1067 ; SSE3-NEXT: movss {{.*#+}} xmm2 = xmm0[0],xmm2[1,2,3]
1068 ; SSE3-NEXT: movaps %xmm2, %xmm0
1071 ; SSSE3-LABEL: shuffle_v4f32_0zz4:
1073 ; SSSE3-NEXT: xorps %xmm2, %xmm2
1074 ; SSSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,0],xmm2[2,0]
1075 ; SSSE3-NEXT: shufps {{.*#+}} xmm2 = xmm2[0,1],xmm1[2,0]
1076 ; SSSE3-NEXT: movss {{.*#+}} xmm2 = xmm0[0],xmm2[1,2,3]
1077 ; SSSE3-NEXT: movaps %xmm2, %xmm0
1080 ; SSE41-LABEL: shuffle_v4f32_0zz4:
1082 ; SSE41-NEXT: insertps {{.*#+}} xmm0 = xmm0[0],zero,zero,xmm1[0]
1085 ; AVX-LABEL: shuffle_v4f32_0zz4:
1087 ; AVX-NEXT: vinsertps {{.*#+}} xmm0 = xmm0[0],zero,zero,xmm1[0]
1089 %shuffle = shufflevector <4 x float> %b, <4 x float> zeroinitializer, <4 x i32> <i32 undef, i32 5, i32 6, i32 0>
1090 %shuffle1 = shufflevector <4 x float> %a, <4 x float> %shuffle, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
1091 ret <4 x float> %shuffle1
1094 define <4 x float> @shuffle_v4f32_0zz6(<4 x float> %a, <4 x float> %b) {
1095 ; SSE2-LABEL: shuffle_v4f32_0zz6:
1097 ; SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,1],xmm1[2,2]
1098 ; SSE2-NEXT: xorps %xmm1, %xmm1
1099 ; SSE2-NEXT: shufps {{.*#+}} xmm1 = xmm1[1,2],xmm0[0,3]
1100 ; SSE2-NEXT: shufps {{.*#+}} xmm1 = xmm1[2,0,1,3]
1101 ; SSE2-NEXT: movaps %xmm1, %xmm0
1104 ; SSE3-LABEL: shuffle_v4f32_0zz6:
1106 ; SSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,1],xmm1[2,2]
1107 ; SSE3-NEXT: xorps %xmm1, %xmm1
1108 ; SSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[1,2],xmm0[0,3]
1109 ; SSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[2,0,1,3]
1110 ; SSE3-NEXT: movaps %xmm1, %xmm0
1113 ; SSSE3-LABEL: shuffle_v4f32_0zz6:
1115 ; SSSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,1],xmm1[2,2]
1116 ; SSSE3-NEXT: xorps %xmm1, %xmm1
1117 ; SSSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[1,2],xmm0[0,3]
1118 ; SSSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[2,0,1,3]
1119 ; SSSE3-NEXT: movaps %xmm1, %xmm0
1122 ; SSE41-LABEL: shuffle_v4f32_0zz6:
1124 ; SSE41-NEXT: insertps {{.*#+}} xmm0 = xmm0[0],zero,zero,xmm1[2]
1127 ; AVX-LABEL: shuffle_v4f32_0zz6:
1129 ; AVX-NEXT: vinsertps {{.*#+}} xmm0 = xmm0[0],zero,zero,xmm1[2]
1131 %shuffle = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 0, i32 undef, i32 undef, i32 6>
1132 %shuffle1 = shufflevector <4 x float> zeroinitializer, <4 x float> %shuffle, <4 x i32> <i32 4, i32 1, i32 2, i32 7>
1133 ret <4 x float> %shuffle1
1136 define <4 x float> @shuffle_v4f32_0z24(<4 x float> %a, <4 x float> %b) {
1137 ; SSE2-LABEL: shuffle_v4f32_0z24:
1139 ; SSE2-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,0],xmm0[2,0]
1140 ; SSE2-NEXT: xorps %xmm2, %xmm2
1141 ; SSE2-NEXT: shufps {{.*#+}} xmm2 = xmm2[1,0],xmm0[0,0]
1142 ; SSE2-NEXT: shufps {{.*#+}} xmm2 = xmm2[2,0],xmm1[2,0]
1143 ; SSE2-NEXT: movaps %xmm2, %xmm0
1146 ; SSE3-LABEL: shuffle_v4f32_0z24:
1148 ; SSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,0],xmm0[2,0]
1149 ; SSE3-NEXT: xorps %xmm2, %xmm2
1150 ; SSE3-NEXT: shufps {{.*#+}} xmm2 = xmm2[1,0],xmm0[0,0]
1151 ; SSE3-NEXT: shufps {{.*#+}} xmm2 = xmm2[2,0],xmm1[2,0]
1152 ; SSE3-NEXT: movaps %xmm2, %xmm0
1155 ; SSSE3-LABEL: shuffle_v4f32_0z24:
1157 ; SSSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,0],xmm0[2,0]
1158 ; SSSE3-NEXT: xorps %xmm2, %xmm2
1159 ; SSSE3-NEXT: shufps {{.*#+}} xmm2 = xmm2[1,0],xmm0[0,0]
1160 ; SSSE3-NEXT: shufps {{.*#+}} xmm2 = xmm2[2,0],xmm1[2,0]
1161 ; SSSE3-NEXT: movaps %xmm2, %xmm0
1164 ; SSE41-LABEL: shuffle_v4f32_0z24:
1166 ; SSE41-NEXT: insertps {{.*#+}} xmm0 = xmm0[0],zero,xmm0[2],xmm1[0]
1169 ; AVX-LABEL: shuffle_v4f32_0z24:
1171 ; AVX-NEXT: vinsertps {{.*#+}} xmm0 = xmm0[0],zero,xmm0[2],xmm1[0]
1173 %shuffle = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 0, i32 undef, i32 2, i32 4>
1174 %shuffle1 = shufflevector <4 x float> zeroinitializer, <4 x float> %shuffle, <4 x i32> <i32 4, i32 1, i32 6, i32 7>
1175 ret <4 x float> %shuffle1
1178 define <4 x i32> @shuffle_v4i32_4zzz(<4 x i32> %a) {
1179 ; SSE2-LABEL: shuffle_v4i32_4zzz:
1181 ; SSE2-NEXT: xorps %xmm1, %xmm1
1182 ; SSE2-NEXT: movss {{.*#+}} xmm1 = xmm0[0],xmm1[1,2,3]
1183 ; SSE2-NEXT: movaps %xmm1, %xmm0
1186 ; SSE3-LABEL: shuffle_v4i32_4zzz:
1188 ; SSE3-NEXT: xorps %xmm1, %xmm1
1189 ; SSE3-NEXT: movss {{.*#+}} xmm1 = xmm0[0],xmm1[1,2,3]
1190 ; SSE3-NEXT: movaps %xmm1, %xmm0
1193 ; SSSE3-LABEL: shuffle_v4i32_4zzz:
1195 ; SSSE3-NEXT: xorps %xmm1, %xmm1
1196 ; SSSE3-NEXT: movss {{.*#+}} xmm1 = xmm0[0],xmm1[1,2,3]
1197 ; SSSE3-NEXT: movaps %xmm1, %xmm0
1200 ; SSE41-LABEL: shuffle_v4i32_4zzz:
1202 ; SSE41-NEXT: xorps %xmm1, %xmm1
1203 ; SSE41-NEXT: blendps {{.*#+}} xmm0 = xmm0[0],xmm1[1,2,3]
1206 ; AVX-LABEL: shuffle_v4i32_4zzz:
1208 ; AVX-NEXT: vxorps %xmm1, %xmm1, %xmm1
1209 ; AVX-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0],xmm1[1,2,3]
1211 %shuffle = shufflevector <4 x i32> zeroinitializer, <4 x i32> %a, <4 x i32> <i32 4, i32 1, i32 2, i32 3>
1212 ret <4 x i32> %shuffle
1215 define <4 x i32> @shuffle_v4i32_z4zz(<4 x i32> %a) {
1216 ; SSE2-LABEL: shuffle_v4i32_z4zz:
1218 ; SSE2-NEXT: xorps %xmm1, %xmm1
1219 ; SSE2-NEXT: movss {{.*#+}} xmm1 = xmm0[0],xmm1[1,2,3]
1220 ; SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,0,1,1]
1223 ; SSE3-LABEL: shuffle_v4i32_z4zz:
1225 ; SSE3-NEXT: xorps %xmm1, %xmm1
1226 ; SSE3-NEXT: movss {{.*#+}} xmm1 = xmm0[0],xmm1[1,2,3]
1227 ; SSE3-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,0,1,1]
1230 ; SSSE3-LABEL: shuffle_v4i32_z4zz:
1232 ; SSSE3-NEXT: xorps %xmm1, %xmm1
1233 ; SSSE3-NEXT: movss {{.*#+}} xmm1 = xmm0[0],xmm1[1,2,3]
1234 ; SSSE3-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,0,1,1]
1237 ; SSE41-LABEL: shuffle_v4i32_z4zz:
1239 ; SSE41-NEXT: pxor %xmm1, %xmm1
1240 ; SSE41-NEXT: pblendw {{.*#+}} xmm1 = xmm0[0,1],xmm1[2,3,4,5,6,7]
1241 ; SSE41-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,0,1,1]
1244 ; AVX1-LABEL: shuffle_v4i32_z4zz:
1246 ; AVX1-NEXT: vxorps %xmm1, %xmm1, %xmm1
1247 ; AVX1-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0],xmm1[1,2,3]
1248 ; AVX1-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[1,0,1,1]
1251 ; AVX2-SLOW-LABEL: shuffle_v4i32_z4zz:
1252 ; AVX2-SLOW: # %bb.0:
1253 ; AVX2-SLOW-NEXT: vxorps %xmm1, %xmm1, %xmm1
1254 ; AVX2-SLOW-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0],xmm1[1,2,3]
1255 ; AVX2-SLOW-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[1,0,1,1]
1256 ; AVX2-SLOW-NEXT: retq
1258 ; AVX2-FAST-LABEL: shuffle_v4i32_z4zz:
1259 ; AVX2-FAST: # %bb.0:
1260 ; AVX2-FAST-NEXT: vpshufb {{.*#+}} xmm0 = zero,zero,zero,zero,xmm0[0,1,2,3],zero,zero,zero,zero,zero,zero,zero,zero
1261 ; AVX2-FAST-NEXT: retq
1263 ; AVX512VL-LABEL: shuffle_v4i32_z4zz:
1264 ; AVX512VL: # %bb.0:
1265 ; AVX512VL-NEXT: vpshufb {{.*#+}} xmm0 = zero,zero,zero,zero,xmm0[0,1,2,3],zero,zero,zero,zero,zero,zero,zero,zero
1266 ; AVX512VL-NEXT: retq
1267 %shuffle = shufflevector <4 x i32> zeroinitializer, <4 x i32> %a, <4 x i32> <i32 2, i32 4, i32 3, i32 0>
1268 ret <4 x i32> %shuffle
1271 define <4 x i32> @shuffle_v4i32_zz4z(<4 x i32> %a) {
1272 ; SSE2-LABEL: shuffle_v4i32_zz4z:
1274 ; SSE2-NEXT: xorps %xmm1, %xmm1
1275 ; SSE2-NEXT: movss {{.*#+}} xmm1 = xmm0[0],xmm1[1,2,3]
1276 ; SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,0,1]
1279 ; SSE3-LABEL: shuffle_v4i32_zz4z:
1281 ; SSE3-NEXT: xorps %xmm1, %xmm1
1282 ; SSE3-NEXT: movss {{.*#+}} xmm1 = xmm0[0],xmm1[1,2,3]
1283 ; SSE3-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,0,1]
1286 ; SSSE3-LABEL: shuffle_v4i32_zz4z:
1288 ; SSSE3-NEXT: xorps %xmm1, %xmm1
1289 ; SSSE3-NEXT: movss {{.*#+}} xmm1 = xmm0[0],xmm1[1,2,3]
1290 ; SSSE3-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,0,1]
1293 ; SSE41-LABEL: shuffle_v4i32_zz4z:
1295 ; SSE41-NEXT: pxor %xmm1, %xmm1
1296 ; SSE41-NEXT: pblendw {{.*#+}} xmm1 = xmm0[0,1],xmm1[2,3,4,5,6,7]
1297 ; SSE41-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,1,0,1]
1300 ; AVX1-LABEL: shuffle_v4i32_zz4z:
1302 ; AVX1-NEXT: vxorps %xmm1, %xmm1, %xmm1
1303 ; AVX1-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0],xmm1[1,2,3]
1304 ; AVX1-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[1,1,0,1]
1307 ; AVX2-SLOW-LABEL: shuffle_v4i32_zz4z:
1308 ; AVX2-SLOW: # %bb.0:
1309 ; AVX2-SLOW-NEXT: vxorps %xmm1, %xmm1, %xmm1
1310 ; AVX2-SLOW-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0],xmm1[1,2,3]
1311 ; AVX2-SLOW-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[1,1,0,1]
1312 ; AVX2-SLOW-NEXT: retq
1314 ; AVX2-FAST-LABEL: shuffle_v4i32_zz4z:
1315 ; AVX2-FAST: # %bb.0:
1316 ; AVX2-FAST-NEXT: vpshufb {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3],zero,zero,zero,zero
1317 ; AVX2-FAST-NEXT: retq
1319 ; AVX512VL-LABEL: shuffle_v4i32_zz4z:
1320 ; AVX512VL: # %bb.0:
1321 ; AVX512VL-NEXT: vpshufb {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3],zero,zero,zero,zero
1322 ; AVX512VL-NEXT: retq
1323 %shuffle = shufflevector <4 x i32> zeroinitializer, <4 x i32> %a, <4 x i32> <i32 0, i32 0, i32 4, i32 0>
1324 ret <4 x i32> %shuffle
1327 define <4 x i32> @shuffle_v4i32_zuu4(<4 x i32> %a) {
1328 ; SSE-LABEL: shuffle_v4i32_zuu4:
1330 ; SSE-NEXT: pslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3]
1333 ; AVX-LABEL: shuffle_v4i32_zuu4:
1335 ; AVX-NEXT: vpslldq {{.*#+}} xmm0 = zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,xmm0[0,1,2,3]
1337 %shuffle = shufflevector <4 x i32> zeroinitializer, <4 x i32> %a, <4 x i32> <i32 0, i32 undef, i32 undef, i32 4>
1338 ret <4 x i32> %shuffle
1341 define <4 x i32> @shuffle_v4i32_z6zz(<4 x i32> %a) {
1342 ; SSE2-LABEL: shuffle_v4i32_z6zz:
1344 ; SSE2-NEXT: xorps %xmm1, %xmm1
1345 ; SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[2,0],xmm1[0,0]
1346 ; SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[2,0],xmm1[2,3]
1349 ; SSE3-LABEL: shuffle_v4i32_z6zz:
1351 ; SSE3-NEXT: xorps %xmm1, %xmm1
1352 ; SSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[2,0],xmm1[0,0]
1353 ; SSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[2,0],xmm1[2,3]
1356 ; SSSE3-LABEL: shuffle_v4i32_z6zz:
1358 ; SSSE3-NEXT: xorps %xmm1, %xmm1
1359 ; SSSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[2,0],xmm1[0,0]
1360 ; SSSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[2,0],xmm1[2,3]
1363 ; SSE41-LABEL: shuffle_v4i32_z6zz:
1365 ; SSE41-NEXT: pshufd {{.*#+}} xmm1 = xmm0[2,2,3,3]
1366 ; SSE41-NEXT: pxor %xmm0, %xmm0
1367 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm0[0,1],xmm1[2,3],xmm0[4,5,6,7]
1370 ; AVX1-LABEL: shuffle_v4i32_z6zz:
1372 ; AVX1-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[2,2,3,3]
1373 ; AVX1-NEXT: vxorps %xmm1, %xmm1, %xmm1
1374 ; AVX1-NEXT: vblendps {{.*#+}} xmm0 = xmm1[0],xmm0[1],xmm1[2,3]
1377 ; AVX2-SLOW-LABEL: shuffle_v4i32_z6zz:
1378 ; AVX2-SLOW: # %bb.0:
1379 ; AVX2-SLOW-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[2,2,3,3]
1380 ; AVX2-SLOW-NEXT: vxorps %xmm1, %xmm1, %xmm1
1381 ; AVX2-SLOW-NEXT: vblendps {{.*#+}} xmm0 = xmm1[0],xmm0[1],xmm1[2,3]
1382 ; AVX2-SLOW-NEXT: retq
1384 ; AVX2-FAST-LABEL: shuffle_v4i32_z6zz:
1385 ; AVX2-FAST: # %bb.0:
1386 ; AVX2-FAST-NEXT: vpshufb {{.*#+}} xmm0 = zero,zero,zero,zero,xmm0[8,9,10,11],zero,zero,zero,zero,zero,zero,zero,zero
1387 ; AVX2-FAST-NEXT: retq
1389 ; AVX512VL-LABEL: shuffle_v4i32_z6zz:
1390 ; AVX512VL: # %bb.0:
1391 ; AVX512VL-NEXT: vpshufb {{.*#+}} xmm0 = zero,zero,zero,zero,xmm0[8,9,10,11],zero,zero,zero,zero,zero,zero,zero,zero
1392 ; AVX512VL-NEXT: retq
1393 %shuffle = shufflevector <4 x i32> zeroinitializer, <4 x i32> %a, <4 x i32> <i32 0, i32 6, i32 2, i32 3>
1394 ret <4 x i32> %shuffle
1397 define <4 x i32> @shuffle_v4i32_7012(<4 x i32> %a, <4 x i32> %b) {
1398 ; SSE2-LABEL: shuffle_v4i32_7012:
1400 ; SSE2-NEXT: shufps {{.*#+}} xmm1 = xmm1[3,0],xmm0[0,0]
1401 ; SSE2-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,2],xmm0[1,2]
1402 ; SSE2-NEXT: movaps %xmm1, %xmm0
1405 ; SSE3-LABEL: shuffle_v4i32_7012:
1407 ; SSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[3,0],xmm0[0,0]
1408 ; SSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,2],xmm0[1,2]
1409 ; SSE3-NEXT: movaps %xmm1, %xmm0
1412 ; SSSE3-LABEL: shuffle_v4i32_7012:
1414 ; SSSE3-NEXT: palignr {{.*#+}} xmm0 = xmm1[12,13,14,15],xmm0[0,1,2,3,4,5,6,7,8,9,10,11]
1417 ; SSE41-LABEL: shuffle_v4i32_7012:
1419 ; SSE41-NEXT: palignr {{.*#+}} xmm0 = xmm1[12,13,14,15],xmm0[0,1,2,3,4,5,6,7,8,9,10,11]
1422 ; AVX-LABEL: shuffle_v4i32_7012:
1424 ; AVX-NEXT: vpalignr {{.*#+}} xmm0 = xmm1[12,13,14,15],xmm0[0,1,2,3,4,5,6,7,8,9,10,11]
1426 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 7, i32 0, i32 1, i32 2>
1427 ret <4 x i32> %shuffle
1430 define <4 x i32> @shuffle_v4i32_6701(<4 x i32> %a, <4 x i32> %b) {
1431 ; SSE2-LABEL: shuffle_v4i32_6701:
1433 ; SSE2-NEXT: shufps {{.*#+}} xmm1 = xmm1[2,3],xmm0[0,1]
1434 ; SSE2-NEXT: movaps %xmm1, %xmm0
1437 ; SSE3-LABEL: shuffle_v4i32_6701:
1439 ; SSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[2,3],xmm0[0,1]
1440 ; SSE3-NEXT: movaps %xmm1, %xmm0
1443 ; SSSE3-LABEL: shuffle_v4i32_6701:
1445 ; SSSE3-NEXT: palignr {{.*#+}} xmm0 = xmm1[8,9,10,11,12,13,14,15],xmm0[0,1,2,3,4,5,6,7]
1448 ; SSE41-LABEL: shuffle_v4i32_6701:
1450 ; SSE41-NEXT: palignr {{.*#+}} xmm0 = xmm1[8,9,10,11,12,13,14,15],xmm0[0,1,2,3,4,5,6,7]
1453 ; AVX-LABEL: shuffle_v4i32_6701:
1455 ; AVX-NEXT: vpalignr {{.*#+}} xmm0 = xmm1[8,9,10,11,12,13,14,15],xmm0[0,1,2,3,4,5,6,7]
1457 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 6, i32 7, i32 0, i32 1>
1458 ret <4 x i32> %shuffle
1461 define <4 x i32> @shuffle_v4i32_5670(<4 x i32> %a, <4 x i32> %b) {
1462 ; SSE2-LABEL: shuffle_v4i32_5670:
1464 ; SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,0],xmm1[3,0]
1465 ; SSE2-NEXT: shufps {{.*#+}} xmm1 = xmm1[1,2],xmm0[2,0]
1466 ; SSE2-NEXT: movaps %xmm1, %xmm0
1469 ; SSE3-LABEL: shuffle_v4i32_5670:
1471 ; SSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,0],xmm1[3,0]
1472 ; SSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[1,2],xmm0[2,0]
1473 ; SSE3-NEXT: movaps %xmm1, %xmm0
1476 ; SSSE3-LABEL: shuffle_v4i32_5670:
1478 ; SSSE3-NEXT: palignr {{.*#+}} xmm0 = xmm1[4,5,6,7,8,9,10,11,12,13,14,15],xmm0[0,1,2,3]
1481 ; SSE41-LABEL: shuffle_v4i32_5670:
1483 ; SSE41-NEXT: palignr {{.*#+}} xmm0 = xmm1[4,5,6,7,8,9,10,11,12,13,14,15],xmm0[0,1,2,3]
1486 ; AVX-LABEL: shuffle_v4i32_5670:
1488 ; AVX-NEXT: vpalignr {{.*#+}} xmm0 = xmm1[4,5,6,7,8,9,10,11,12,13,14,15],xmm0[0,1,2,3]
1490 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 5, i32 6, i32 7, i32 0>
1491 ret <4 x i32> %shuffle
1494 define <4 x i32> @shuffle_v4i32_1234(<4 x i32> %a, <4 x i32> %b) {
1495 ; SSE2-LABEL: shuffle_v4i32_1234:
1497 ; SSE2-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,0],xmm0[3,0]
1498 ; SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[1,2],xmm1[2,0]
1501 ; SSE3-LABEL: shuffle_v4i32_1234:
1503 ; SSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,0],xmm0[3,0]
1504 ; SSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[1,2],xmm1[2,0]
1507 ; SSSE3-LABEL: shuffle_v4i32_1234:
1509 ; SSSE3-NEXT: palignr {{.*#+}} xmm1 = xmm0[4,5,6,7,8,9,10,11,12,13,14,15],xmm1[0,1,2,3]
1510 ; SSSE3-NEXT: movdqa %xmm1, %xmm0
1513 ; SSE41-LABEL: shuffle_v4i32_1234:
1515 ; SSE41-NEXT: palignr {{.*#+}} xmm1 = xmm0[4,5,6,7,8,9,10,11,12,13,14,15],xmm1[0,1,2,3]
1516 ; SSE41-NEXT: movdqa %xmm1, %xmm0
1519 ; AVX-LABEL: shuffle_v4i32_1234:
1521 ; AVX-NEXT: vpalignr {{.*#+}} xmm0 = xmm0[4,5,6,7,8,9,10,11,12,13,14,15],xmm1[0,1,2,3]
1523 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 1, i32 2, i32 3, i32 4>
1524 ret <4 x i32> %shuffle
1527 define <4 x i32> @shuffle_v4i32_2345(<4 x i32> %a, <4 x i32> %b) {
1528 ; SSE2-LABEL: shuffle_v4i32_2345:
1530 ; SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[2,3],xmm1[0,1]
1533 ; SSE3-LABEL: shuffle_v4i32_2345:
1535 ; SSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[2,3],xmm1[0,1]
1538 ; SSSE3-LABEL: shuffle_v4i32_2345:
1540 ; SSSE3-NEXT: palignr {{.*#+}} xmm1 = xmm0[8,9,10,11,12,13,14,15],xmm1[0,1,2,3,4,5,6,7]
1541 ; SSSE3-NEXT: movdqa %xmm1, %xmm0
1544 ; SSE41-LABEL: shuffle_v4i32_2345:
1546 ; SSE41-NEXT: palignr {{.*#+}} xmm1 = xmm0[8,9,10,11,12,13,14,15],xmm1[0,1,2,3,4,5,6,7]
1547 ; SSE41-NEXT: movdqa %xmm1, %xmm0
1550 ; AVX-LABEL: shuffle_v4i32_2345:
1552 ; AVX-NEXT: vpalignr {{.*#+}} xmm0 = xmm0[8,9,10,11,12,13,14,15],xmm1[0,1,2,3,4,5,6,7]
1554 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 2, i32 3, i32 4, i32 5>
1555 ret <4 x i32> %shuffle
1559 define <4 x i32> @shuffle_v4i32_2456(<4 x i32> %a, <4 x i32> %b) {
1560 ; SSE2-LABEL: shuffle_v4i32_2456:
1562 ; SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[2,0],xmm1[0,0]
1563 ; SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,2],xmm1[1,2]
1566 ; SSE3-LABEL: shuffle_v4i32_2456:
1568 ; SSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[2,0],xmm1[0,0]
1569 ; SSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,2],xmm1[1,2]
1572 ; SSSE3-LABEL: shuffle_v4i32_2456:
1574 ; SSSE3-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,1,2,2]
1575 ; SSSE3-NEXT: palignr {{.*#+}} xmm1 = xmm0[12,13,14,15],xmm1[0,1,2,3,4,5,6,7,8,9,10,11]
1576 ; SSSE3-NEXT: movdqa %xmm1, %xmm0
1579 ; SSE41-LABEL: shuffle_v4i32_2456:
1581 ; SSE41-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,1,2,2]
1582 ; SSE41-NEXT: palignr {{.*#+}} xmm1 = xmm0[12,13,14,15],xmm1[0,1,2,3,4,5,6,7,8,9,10,11]
1583 ; SSE41-NEXT: movdqa %xmm1, %xmm0
1586 ; AVX-LABEL: shuffle_v4i32_2456:
1588 ; AVX-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[0,1,2,2]
1589 ; AVX-NEXT: vpalignr {{.*#+}} xmm0 = xmm0[12,13,14,15],xmm1[0,1,2,3,4,5,6,7,8,9,10,11]
1591 %s1 = shufflevector <4 x i32> %a, <4 x i32> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 2>
1592 %s2 = shufflevector <4 x i32> %s1, <4 x i32> %b, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
1596 define <4 x i32> @shuffle_v4i32_40u1(<4 x i32> %a, <4 x i32> %b) {
1597 ; SSE-LABEL: shuffle_v4i32_40u1:
1599 ; SSE-NEXT: unpcklps {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
1600 ; SSE-NEXT: movaps %xmm1, %xmm0
1603 ; AVX-LABEL: shuffle_v4i32_40u1:
1605 ; AVX-NEXT: vunpcklps {{.*#+}} xmm0 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
1607 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 4, i32 0, i32 undef, i32 1>
1608 ret <4 x i32> %shuffle
1611 define <4 x i32> @shuffle_v4i32_3456(<4 x i32> %a, <4 x i32> %b) {
1612 ; SSE2-LABEL: shuffle_v4i32_3456:
1614 ; SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[3,0],xmm1[0,0]
1615 ; SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,2],xmm1[1,2]
1618 ; SSE3-LABEL: shuffle_v4i32_3456:
1620 ; SSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[3,0],xmm1[0,0]
1621 ; SSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,2],xmm1[1,2]
1624 ; SSSE3-LABEL: shuffle_v4i32_3456:
1626 ; SSSE3-NEXT: palignr {{.*#+}} xmm1 = xmm0[12,13,14,15],xmm1[0,1,2,3,4,5,6,7,8,9,10,11]
1627 ; SSSE3-NEXT: movdqa %xmm1, %xmm0
1630 ; SSE41-LABEL: shuffle_v4i32_3456:
1632 ; SSE41-NEXT: palignr {{.*#+}} xmm1 = xmm0[12,13,14,15],xmm1[0,1,2,3,4,5,6,7,8,9,10,11]
1633 ; SSE41-NEXT: movdqa %xmm1, %xmm0
1636 ; AVX-LABEL: shuffle_v4i32_3456:
1638 ; AVX-NEXT: vpalignr {{.*#+}} xmm0 = xmm0[12,13,14,15],xmm1[0,1,2,3,4,5,6,7,8,9,10,11]
1640 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 3, i32 4, i32 5, i32 6>
1641 ret <4 x i32> %shuffle
1644 define <4 x i32> @shuffle_v4i32_0u1u(<4 x i32> %a, <4 x i32> %b) {
1645 ; SSE2-LABEL: shuffle_v4i32_0u1u:
1647 ; SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,1,1,3]
1650 ; SSE3-LABEL: shuffle_v4i32_0u1u:
1652 ; SSE3-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,1,1,3]
1655 ; SSSE3-LABEL: shuffle_v4i32_0u1u:
1657 ; SSSE3-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,1,1,3]
1660 ; SSE41-LABEL: shuffle_v4i32_0u1u:
1662 ; SSE41-NEXT: pmovzxdq {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero
1665 ; AVX-LABEL: shuffle_v4i32_0u1u:
1667 ; AVX-NEXT: vpmovzxdq {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero
1669 %shuffle = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 0, i32 undef, i32 1, i32 undef>
1670 ret <4 x i32> %shuffle
1673 define <4 x i32> @shuffle_v4i32_0z1z(<4 x i32> %a) {
1674 ; SSE2-LABEL: shuffle_v4i32_0z1z:
1676 ; SSE2-NEXT: xorps %xmm1, %xmm1
1677 ; SSE2-NEXT: unpcklps {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
1680 ; SSE3-LABEL: shuffle_v4i32_0z1z:
1682 ; SSE3-NEXT: xorps %xmm1, %xmm1
1683 ; SSE3-NEXT: unpcklps {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
1686 ; SSSE3-LABEL: shuffle_v4i32_0z1z:
1688 ; SSSE3-NEXT: xorps %xmm1, %xmm1
1689 ; SSSE3-NEXT: unpcklps {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
1692 ; SSE41-LABEL: shuffle_v4i32_0z1z:
1694 ; SSE41-NEXT: pmovzxdq {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero
1697 ; AVX-LABEL: shuffle_v4i32_0z1z:
1699 ; AVX-NEXT: vpmovzxdq {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero
1701 %shuffle = shufflevector <4 x i32> %a, <4 x i32> zeroinitializer, <4 x i32> <i32 0, i32 5, i32 1, i32 7>
1702 ret <4 x i32> %shuffle
1705 define <4 x i32> @shuffle_v4i32_01zu(<4 x i32> %a) {
1706 ; SSE-LABEL: shuffle_v4i32_01zu:
1708 ; SSE-NEXT: movq {{.*#+}} xmm0 = xmm0[0],zero
1711 ; AVX-LABEL: shuffle_v4i32_01zu:
1713 ; AVX-NEXT: vmovq {{.*#+}} xmm0 = xmm0[0],zero
1715 %shuffle = shufflevector <4 x i32> %a, <4 x i32> zeroinitializer, <4 x i32> <i32 0, i32 1, i32 7, i32 undef>
1716 ret <4 x i32> %shuffle
1719 define <4 x i32> @shuffle_v4i32_0z23(<4 x i32> %a) {
1720 ; SSE2-LABEL: shuffle_v4i32_0z23:
1722 ; SSE2-NEXT: andps {{.*}}(%rip), %xmm0
1725 ; SSE3-LABEL: shuffle_v4i32_0z23:
1727 ; SSE3-NEXT: andps {{.*}}(%rip), %xmm0
1730 ; SSSE3-LABEL: shuffle_v4i32_0z23:
1732 ; SSSE3-NEXT: andps {{.*}}(%rip), %xmm0
1735 ; SSE41-LABEL: shuffle_v4i32_0z23:
1737 ; SSE41-NEXT: xorps %xmm1, %xmm1
1738 ; SSE41-NEXT: blendps {{.*#+}} xmm0 = xmm0[0],xmm1[1],xmm0[2,3]
1741 ; AVX-LABEL: shuffle_v4i32_0z23:
1743 ; AVX-NEXT: vxorps %xmm1, %xmm1, %xmm1
1744 ; AVX-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0],xmm1[1],xmm0[2,3]
1746 %shuffle = shufflevector <4 x i32> %a, <4 x i32> zeroinitializer, <4 x i32> <i32 0, i32 4, i32 2, i32 3>
1747 ret <4 x i32> %shuffle
1750 define <4 x i32> @shuffle_v4i32_01z3(<4 x i32> %a) {
1751 ; SSE2-LABEL: shuffle_v4i32_01z3:
1753 ; SSE2-NEXT: andps {{.*}}(%rip), %xmm0
1756 ; SSE3-LABEL: shuffle_v4i32_01z3:
1758 ; SSE3-NEXT: andps {{.*}}(%rip), %xmm0
1761 ; SSSE3-LABEL: shuffle_v4i32_01z3:
1763 ; SSSE3-NEXT: andps {{.*}}(%rip), %xmm0
1766 ; SSE41-LABEL: shuffle_v4i32_01z3:
1768 ; SSE41-NEXT: xorps %xmm1, %xmm1
1769 ; SSE41-NEXT: blendps {{.*#+}} xmm0 = xmm0[0,1],xmm1[2],xmm0[3]
1772 ; AVX-LABEL: shuffle_v4i32_01z3:
1774 ; AVX-NEXT: vxorps %xmm1, %xmm1, %xmm1
1775 ; AVX-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0,1],xmm1[2],xmm0[3]
1777 %shuffle = shufflevector <4 x i32> %a, <4 x i32> zeroinitializer, <4 x i32> <i32 0, i32 1, i32 4, i32 3>
1778 ret <4 x i32> %shuffle
1781 define <4 x i32> @shuffle_v4i32_012z(<4 x i32> %a) {
1782 ; SSE2-LABEL: shuffle_v4i32_012z:
1784 ; SSE2-NEXT: andps {{.*}}(%rip), %xmm0
1787 ; SSE3-LABEL: shuffle_v4i32_012z:
1789 ; SSE3-NEXT: andps {{.*}}(%rip), %xmm0
1792 ; SSSE3-LABEL: shuffle_v4i32_012z:
1794 ; SSSE3-NEXT: andps {{.*}}(%rip), %xmm0
1797 ; SSE41-LABEL: shuffle_v4i32_012z:
1799 ; SSE41-NEXT: xorps %xmm1, %xmm1
1800 ; SSE41-NEXT: blendps {{.*#+}} xmm0 = xmm0[0,1,2],xmm1[3]
1803 ; AVX-LABEL: shuffle_v4i32_012z:
1805 ; AVX-NEXT: vxorps %xmm1, %xmm1, %xmm1
1806 ; AVX-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0,1,2],xmm1[3]
1808 %shuffle = shufflevector <4 x i32> %a, <4 x i32> zeroinitializer, <4 x i32> <i32 0, i32 1, i32 2, i32 7>
1809 ret <4 x i32> %shuffle
1812 define <4 x i32> @shuffle_v4i32_0zz3(<4 x i32> %a) {
1813 ; SSE2-LABEL: shuffle_v4i32_0zz3:
1815 ; SSE2-NEXT: andps {{.*}}(%rip), %xmm0
1818 ; SSE3-LABEL: shuffle_v4i32_0zz3:
1820 ; SSE3-NEXT: andps {{.*}}(%rip), %xmm0
1823 ; SSSE3-LABEL: shuffle_v4i32_0zz3:
1825 ; SSSE3-NEXT: andps {{.*}}(%rip), %xmm0
1828 ; SSE41-LABEL: shuffle_v4i32_0zz3:
1830 ; SSE41-NEXT: xorps %xmm1, %xmm1
1831 ; SSE41-NEXT: blendps {{.*#+}} xmm0 = xmm0[0],xmm1[1,2],xmm0[3]
1834 ; AVX-LABEL: shuffle_v4i32_0zz3:
1836 ; AVX-NEXT: vxorps %xmm1, %xmm1, %xmm1
1837 ; AVX-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0],xmm1[1,2],xmm0[3]
1839 %shuffle = shufflevector <4 x i32> %a, <4 x i32> zeroinitializer, <4 x i32> <i32 0, i32 4, i32 4, i32 3>
1840 ret <4 x i32> %shuffle
1843 define <4 x i32> @shuffle_v4i32_bitcast_0415(<4 x i32> %a, <4 x i32> %b) {
1844 ; SSE-LABEL: shuffle_v4i32_bitcast_0415:
1846 ; SSE-NEXT: unpcklps {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
1849 ; AVX-LABEL: shuffle_v4i32_bitcast_0415:
1851 ; AVX-NEXT: vunpcklps {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
1853 %shuffle32 = shufflevector <4 x i32> %a, <4 x i32> %b, <4 x i32> <i32 1, i32 5, i32 0, i32 4>
1854 %bitcast64 = bitcast <4 x i32> %shuffle32 to <2 x double>
1855 %shuffle64 = shufflevector <2 x double> %bitcast64, <2 x double> undef, <2 x i32> <i32 1, i32 0>
1856 %bitcast32 = bitcast <2 x double> %shuffle64 to <4 x i32>
1857 ret <4 x i32> %bitcast32
1860 define <4 x float> @shuffle_v4f32_bitcast_4401(<4 x float> %a, <4 x i32> %b) {
1861 ; SSE-LABEL: shuffle_v4f32_bitcast_4401:
1863 ; SSE-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,0],xmm0[0,1]
1864 ; SSE-NEXT: movaps %xmm1, %xmm0
1867 ; AVX-LABEL: shuffle_v4f32_bitcast_4401:
1869 ; AVX-NEXT: vshufps {{.*#+}} xmm0 = xmm1[0,0],xmm0[0,1]
1871 %1 = shufflevector <4 x i32> %b, <4 x i32> undef, <4 x i32> <i32 0, i32 0, i32 1, i32 1>
1872 %2 = bitcast <4 x i32> %1 to <2 x double>
1873 %3 = bitcast <4 x float> %a to <2 x double>
1874 %4 = shufflevector <2 x double> %2, <2 x double> %3, <2 x i32> <i32 0, i32 2>
1875 %5 = bitcast <2 x double> %4 to <4 x float>
1879 define <4 x float> @shuffle_v4f32_bitcast_0045(<4 x float> %a, <4 x i32> %b) {
1880 ; SSE-LABEL: shuffle_v4f32_bitcast_0045:
1882 ; SSE-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,0],xmm1[0,1]
1885 ; AVX-LABEL: shuffle_v4f32_bitcast_0045:
1887 ; AVX-NEXT: vshufps {{.*#+}} xmm0 = xmm0[0,0],xmm1[0,1]
1889 %1 = shufflevector <4 x float> %a, <4 x float> undef, <4 x i32> <i32 0, i32 0, i32 1, i32 1>
1890 %2 = bitcast <4 x i32> %b to <4 x float>
1891 %3 = shufflevector <4 x float> %1, <4 x float> %2, <4 x i32> <i32 1, i32 0, i32 4, i32 5>
1895 define <4 x float> @mask_v4f32_4127(<4 x float> %a, <4 x float> %b) {
1896 ; SSE2-LABEL: mask_v4f32_4127:
1898 ; SSE2-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,3],xmm0[1,2]
1899 ; SSE2-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,2,3,1]
1900 ; SSE2-NEXT: movaps %xmm1, %xmm0
1903 ; SSE3-LABEL: mask_v4f32_4127:
1905 ; SSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,3],xmm0[1,2]
1906 ; SSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,2,3,1]
1907 ; SSE3-NEXT: movaps %xmm1, %xmm0
1910 ; SSSE3-LABEL: mask_v4f32_4127:
1912 ; SSSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,3],xmm0[1,2]
1913 ; SSSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,2,3,1]
1914 ; SSSE3-NEXT: movaps %xmm1, %xmm0
1917 ; SSE41-LABEL: mask_v4f32_4127:
1919 ; SSE41-NEXT: blendps {{.*#+}} xmm0 = xmm1[0],xmm0[1,2],xmm1[3]
1922 ; AVX-LABEL: mask_v4f32_4127:
1924 ; AVX-NEXT: vblendps {{.*#+}} xmm0 = xmm1[0],xmm0[1,2],xmm1[3]
1926 %1 = bitcast <4 x float> %a to <4 x i32>
1927 %2 = bitcast <4 x float> %b to <4 x i32>
1928 %3 = and <4 x i32> %1, <i32 0, i32 -1, i32 -1, i32 0>
1929 %4 = and <4 x i32> %2, <i32 -1, i32 0, i32 0, i32 -1>
1930 %5 = or <4 x i32> %4, %3
1931 %6 = bitcast <4 x i32> %5 to <4 x float>
1935 define <4 x float> @mask_v4f32_0127(<4 x float> %a, <4 x float> %b) {
1936 ; SSE2-LABEL: mask_v4f32_0127:
1938 ; SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[3,0],xmm1[2,0]
1939 ; SSE2-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,1],xmm0[2,0]
1940 ; SSE2-NEXT: movaps %xmm1, %xmm0
1943 ; SSE3-LABEL: mask_v4f32_0127:
1945 ; SSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[3,0],xmm1[2,0]
1946 ; SSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,1],xmm0[2,0]
1947 ; SSE3-NEXT: movaps %xmm1, %xmm0
1950 ; SSSE3-LABEL: mask_v4f32_0127:
1952 ; SSSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[3,0],xmm1[2,0]
1953 ; SSSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,1],xmm0[2,0]
1954 ; SSSE3-NEXT: movaps %xmm1, %xmm0
1957 ; SSE41-LABEL: mask_v4f32_0127:
1959 ; SSE41-NEXT: blendps {{.*#+}} xmm0 = xmm1[0,1,2],xmm0[3]
1962 ; AVX-LABEL: mask_v4f32_0127:
1964 ; AVX-NEXT: vblendps {{.*#+}} xmm0 = xmm1[0,1,2],xmm0[3]
1966 %1 = bitcast <4 x float> %a to <2 x i64>
1967 %2 = bitcast <4 x float> %b to <2 x i64>
1968 %3 = and <2 x i64> %1, <i64 0, i64 -4294967296>
1969 %4 = and <2 x i64> %2, <i64 -1, i64 4294967295>
1970 %5 = or <2 x i64> %4, %3
1971 %6 = bitcast <2 x i64> %5 to <4 x float>
1975 define <4 x i32> @mask_v4i32_0127(<4 x i32> %a, <4 x i32> %b) {
1976 ; SSE2-LABEL: mask_v4i32_0127:
1978 ; SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[3,0],xmm1[2,0]
1979 ; SSE2-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,1],xmm0[2,0]
1980 ; SSE2-NEXT: movaps %xmm1, %xmm0
1983 ; SSE3-LABEL: mask_v4i32_0127:
1985 ; SSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[3,0],xmm1[2,0]
1986 ; SSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,1],xmm0[2,0]
1987 ; SSE3-NEXT: movaps %xmm1, %xmm0
1990 ; SSSE3-LABEL: mask_v4i32_0127:
1992 ; SSSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[3,0],xmm1[2,0]
1993 ; SSSE3-NEXT: shufps {{.*#+}} xmm1 = xmm1[0,1],xmm0[2,0]
1994 ; SSSE3-NEXT: movaps %xmm1, %xmm0
1997 ; SSE41-LABEL: mask_v4i32_0127:
1999 ; SSE41-NEXT: blendps {{.*#+}} xmm0 = xmm1[0,1,2],xmm0[3]
2002 ; AVX-LABEL: mask_v4i32_0127:
2004 ; AVX-NEXT: vblendps {{.*#+}} xmm0 = xmm1[0,1,2],xmm0[3]
2006 %1 = bitcast <4 x i32> %a to <2 x i64>
2007 %2 = bitcast <4 x i32> %b to <2 x i64>
2008 %3 = and <2 x i64> %1, <i64 0, i64 -4294967296>
2009 %4 = and <2 x i64> %2, <i64 -1, i64 4294967295>
2010 %5 = or <2 x i64> %4, %3
2011 %6 = bitcast <2 x i64> %5 to <4 x i32>
2015 define <4 x float> @broadcast_v4f32_0101_from_v2f32(<2 x float>* %x) {
2016 ; SSE2-LABEL: broadcast_v4f32_0101_from_v2f32:
2018 ; SSE2-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
2019 ; SSE2-NEXT: movlhps {{.*#+}} xmm0 = xmm0[0,0]
2022 ; SSE3-LABEL: broadcast_v4f32_0101_from_v2f32:
2024 ; SSE3-NEXT: movddup {{.*#+}} xmm0 = mem[0,0]
2027 ; SSSE3-LABEL: broadcast_v4f32_0101_from_v2f32:
2029 ; SSSE3-NEXT: movddup {{.*#+}} xmm0 = mem[0,0]
2032 ; SSE41-LABEL: broadcast_v4f32_0101_from_v2f32:
2034 ; SSE41-NEXT: movddup {{.*#+}} xmm0 = mem[0,0]
2037 ; AVX-LABEL: broadcast_v4f32_0101_from_v2f32:
2039 ; AVX-NEXT: vmovddup {{.*#+}} xmm0 = mem[0,0]
2041 %1 = load <2 x float>, <2 x float>* %x, align 1
2042 %2 = shufflevector <2 x float> %1, <2 x float> undef, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
2046 define <4 x i32> @insert_reg_and_zero_v4i32(i32 %a) {
2047 ; SSE-LABEL: insert_reg_and_zero_v4i32:
2049 ; SSE-NEXT: movd %edi, %xmm0
2052 ; AVX-LABEL: insert_reg_and_zero_v4i32:
2054 ; AVX-NEXT: vmovd %edi, %xmm0
2056 %v = insertelement <4 x i32> undef, i32 %a, i32 0
2057 %shuffle = shufflevector <4 x i32> %v, <4 x i32> zeroinitializer, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
2058 ret <4 x i32> %shuffle
2061 define <4 x i32> @insert_mem_and_zero_v4i32(i32* %ptr) {
2062 ; SSE-LABEL: insert_mem_and_zero_v4i32:
2064 ; SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
2067 ; AVX-LABEL: insert_mem_and_zero_v4i32:
2069 ; AVX-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
2071 %a = load i32, i32* %ptr
2072 %v = insertelement <4 x i32> undef, i32 %a, i32 0
2073 %shuffle = shufflevector <4 x i32> %v, <4 x i32> zeroinitializer, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
2074 ret <4 x i32> %shuffle
2077 define <4 x float> @insert_reg_and_zero_v4f32(float %a) {
2078 ; SSE2-LABEL: insert_reg_and_zero_v4f32:
2080 ; SSE2-NEXT: xorps %xmm1, %xmm1
2081 ; SSE2-NEXT: movss {{.*#+}} xmm1 = xmm0[0],xmm1[1,2,3]
2082 ; SSE2-NEXT: movaps %xmm1, %xmm0
2085 ; SSE3-LABEL: insert_reg_and_zero_v4f32:
2087 ; SSE3-NEXT: xorps %xmm1, %xmm1
2088 ; SSE3-NEXT: movss {{.*#+}} xmm1 = xmm0[0],xmm1[1,2,3]
2089 ; SSE3-NEXT: movaps %xmm1, %xmm0
2092 ; SSSE3-LABEL: insert_reg_and_zero_v4f32:
2094 ; SSSE3-NEXT: xorps %xmm1, %xmm1
2095 ; SSSE3-NEXT: movss {{.*#+}} xmm1 = xmm0[0],xmm1[1,2,3]
2096 ; SSSE3-NEXT: movaps %xmm1, %xmm0
2099 ; SSE41-LABEL: insert_reg_and_zero_v4f32:
2101 ; SSE41-NEXT: xorps %xmm1, %xmm1
2102 ; SSE41-NEXT: blendps {{.*#+}} xmm0 = xmm0[0],xmm1[1,2,3]
2105 ; AVX-LABEL: insert_reg_and_zero_v4f32:
2107 ; AVX-NEXT: vxorps %xmm1, %xmm1, %xmm1
2108 ; AVX-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0],xmm1[1,2,3]
2110 %v = insertelement <4 x float> undef, float %a, i32 0
2111 %shuffle = shufflevector <4 x float> %v, <4 x float> zeroinitializer, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
2112 ret <4 x float> %shuffle
2115 define <4 x float> @insert_mem_and_zero_v4f32(float* %ptr) {
2116 ; SSE-LABEL: insert_mem_and_zero_v4f32:
2118 ; SSE-NEXT: movss {{.*#+}} xmm0 = mem[0],zero,zero,zero
2121 ; AVX-LABEL: insert_mem_and_zero_v4f32:
2123 ; AVX-NEXT: vmovss {{.*#+}} xmm0 = mem[0],zero,zero,zero
2125 %a = load float, float* %ptr
2126 %v = insertelement <4 x float> undef, float %a, i32 0
2127 %shuffle = shufflevector <4 x float> %v, <4 x float> zeroinitializer, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
2128 ret <4 x float> %shuffle
2131 define <4 x i32> @insert_reg_lo_v4i32(i64 %a, <4 x i32> %b) {
2132 ; SSE2-LABEL: insert_reg_lo_v4i32:
2134 ; SSE2-NEXT: movq %rdi, %xmm1
2135 ; SSE2-NEXT: movsd {{.*#+}} xmm0 = xmm1[0],xmm0[1]
2138 ; SSE3-LABEL: insert_reg_lo_v4i32:
2140 ; SSE3-NEXT: movq %rdi, %xmm1
2141 ; SSE3-NEXT: movsd {{.*#+}} xmm0 = xmm1[0],xmm0[1]
2144 ; SSSE3-LABEL: insert_reg_lo_v4i32:
2146 ; SSSE3-NEXT: movq %rdi, %xmm1
2147 ; SSSE3-NEXT: movsd {{.*#+}} xmm0 = xmm1[0],xmm0[1]
2150 ; SSE41-LABEL: insert_reg_lo_v4i32:
2152 ; SSE41-NEXT: movq %rdi, %xmm1
2153 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm1[0,1,2,3],xmm0[4,5,6,7]
2156 ; AVX1-LABEL: insert_reg_lo_v4i32:
2158 ; AVX1-NEXT: vmovq %rdi, %xmm1
2159 ; AVX1-NEXT: vpblendw {{.*#+}} xmm0 = xmm1[0,1,2,3],xmm0[4,5,6,7]
2162 ; AVX2OR512VL-LABEL: insert_reg_lo_v4i32:
2163 ; AVX2OR512VL: # %bb.0:
2164 ; AVX2OR512VL-NEXT: vmovq %rdi, %xmm1
2165 ; AVX2OR512VL-NEXT: vpblendd {{.*#+}} xmm0 = xmm1[0,1],xmm0[2,3]
2166 ; AVX2OR512VL-NEXT: retq
2167 %a.cast = bitcast i64 %a to <2 x i32>
2168 %v = shufflevector <2 x i32> %a.cast, <2 x i32> undef, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
2169 %shuffle = shufflevector <4 x i32> %v, <4 x i32> %b, <4 x i32> <i32 0, i32 1, i32 6, i32 7>
2170 ret <4 x i32> %shuffle
2173 define <4 x i32> @insert_mem_lo_v4i32(<2 x i32>* %ptr, <4 x i32> %b) {
2174 ; SSE2-LABEL: insert_mem_lo_v4i32:
2176 ; SSE2-NEXT: movlps {{.*#+}} xmm0 = mem[0,1],xmm0[2,3]
2179 ; SSE3-LABEL: insert_mem_lo_v4i32:
2181 ; SSE3-NEXT: movlps {{.*#+}} xmm0 = mem[0,1],xmm0[2,3]
2184 ; SSSE3-LABEL: insert_mem_lo_v4i32:
2186 ; SSSE3-NEXT: movlps {{.*#+}} xmm0 = mem[0,1],xmm0[2,3]
2189 ; SSE41-LABEL: insert_mem_lo_v4i32:
2191 ; SSE41-NEXT: movsd {{.*#+}} xmm1 = mem[0],zero
2192 ; SSE41-NEXT: blendps {{.*#+}} xmm0 = xmm1[0,1],xmm0[2,3]
2195 ; AVX-LABEL: insert_mem_lo_v4i32:
2197 ; AVX-NEXT: vmovsd {{.*#+}} xmm1 = mem[0],zero
2198 ; AVX-NEXT: vblendps {{.*#+}} xmm0 = xmm1[0,1],xmm0[2,3]
2200 %a = load <2 x i32>, <2 x i32>* %ptr
2201 %v = shufflevector <2 x i32> %a, <2 x i32> undef, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
2202 %shuffle = shufflevector <4 x i32> %v, <4 x i32> %b, <4 x i32> <i32 0, i32 1, i32 6, i32 7>
2203 ret <4 x i32> %shuffle
2206 define <4 x i32> @insert_reg_hi_v4i32(i64 %a, <4 x i32> %b) {
2207 ; SSE-LABEL: insert_reg_hi_v4i32:
2209 ; SSE-NEXT: movq %rdi, %xmm1
2210 ; SSE-NEXT: punpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm1[0]
2213 ; AVX-LABEL: insert_reg_hi_v4i32:
2215 ; AVX-NEXT: vmovq %rdi, %xmm1
2216 ; AVX-NEXT: vpunpcklqdq {{.*#+}} xmm0 = xmm0[0],xmm1[0]
2218 %a.cast = bitcast i64 %a to <2 x i32>
2219 %v = shufflevector <2 x i32> %a.cast, <2 x i32> undef, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
2220 %shuffle = shufflevector <4 x i32> %v, <4 x i32> %b, <4 x i32> <i32 4, i32 5, i32 0, i32 1>
2221 ret <4 x i32> %shuffle
2224 define <4 x i32> @insert_mem_hi_v4i32(<2 x i32>* %ptr, <4 x i32> %b) {
2225 ; SSE-LABEL: insert_mem_hi_v4i32:
2227 ; SSE-NEXT: movsd {{.*#+}} xmm1 = mem[0],zero
2228 ; SSE-NEXT: movlhps {{.*#+}} xmm0 = xmm0[0],xmm1[0]
2231 ; AVX-LABEL: insert_mem_hi_v4i32:
2233 ; AVX-NEXT: vmovsd {{.*#+}} xmm1 = mem[0],zero
2234 ; AVX-NEXT: vmovlhps {{.*#+}} xmm0 = xmm0[0],xmm1[0]
2236 %a = load <2 x i32>, <2 x i32>* %ptr
2237 %v = shufflevector <2 x i32> %a, <2 x i32> undef, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
2238 %shuffle = shufflevector <4 x i32> %v, <4 x i32> %b, <4 x i32> <i32 4, i32 5, i32 0, i32 1>
2239 ret <4 x i32> %shuffle
2242 define <4 x float> @insert_reg_lo_v4f32(double %a, <4 x float> %b) {
2243 ; SSE2-LABEL: insert_reg_lo_v4f32:
2245 ; SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,1],xmm1[2,3]
2248 ; SSE3-LABEL: insert_reg_lo_v4f32:
2250 ; SSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,1],xmm1[2,3]
2253 ; SSSE3-LABEL: insert_reg_lo_v4f32:
2255 ; SSSE3-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,1],xmm1[2,3]
2258 ; SSE41-LABEL: insert_reg_lo_v4f32:
2260 ; SSE41-NEXT: blendps {{.*#+}} xmm0 = xmm0[0,1],xmm1[2,3]
2263 ; AVX-LABEL: insert_reg_lo_v4f32:
2265 ; AVX-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0,1],xmm1[2,3]
2267 %a.cast = bitcast double %a to <2 x float>
2268 %v = shufflevector <2 x float> %a.cast, <2 x float> undef, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
2269 %shuffle = shufflevector <4 x float> %v, <4 x float> %b, <4 x i32> <i32 0, i32 1, i32 6, i32 7>
2270 ret <4 x float> %shuffle
2273 define <4 x float> @insert_mem_lo_v4f32(<2 x float>* %ptr, <4 x float> %b) {
2274 ; SSE-LABEL: insert_mem_lo_v4f32:
2276 ; SSE-NEXT: movlps {{.*#+}} xmm0 = mem[0,1],xmm0[2,3]
2279 ; AVX-LABEL: insert_mem_lo_v4f32:
2281 ; AVX-NEXT: vmovlps {{.*#+}} xmm0 = mem[0,1],xmm0[2,3]
2283 %a = load <2 x float>, <2 x float>* %ptr
2284 %v = shufflevector <2 x float> %a, <2 x float> undef, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
2285 %shuffle = shufflevector <4 x float> %v, <4 x float> %b, <4 x i32> <i32 0, i32 1, i32 6, i32 7>
2286 ret <4 x float> %shuffle
2289 define <4 x float> @insert_reg_hi_v4f32(double %a, <4 x float> %b) {
2290 ; SSE-LABEL: insert_reg_hi_v4f32:
2292 ; SSE-NEXT: movlhps {{.*#+}} xmm1 = xmm1[0],xmm0[0]
2293 ; SSE-NEXT: movaps %xmm1, %xmm0
2296 ; AVX-LABEL: insert_reg_hi_v4f32:
2298 ; AVX-NEXT: vmovlhps {{.*#+}} xmm0 = xmm1[0],xmm0[0]
2300 %a.cast = bitcast double %a to <2 x float>
2301 %v = shufflevector <2 x float> %a.cast, <2 x float> undef, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
2302 %shuffle = shufflevector <4 x float> %v, <4 x float> %b, <4 x i32> <i32 4, i32 5, i32 0, i32 1>
2303 ret <4 x float> %shuffle
2306 define <4 x float> @insert_mem_hi_v4f32(<2 x float>* %ptr, <4 x float> %b) {
2307 ; SSE-LABEL: insert_mem_hi_v4f32:
2309 ; SSE-NEXT: movhps {{.*#+}} xmm0 = xmm0[0,1],mem[0,1]
2312 ; AVX-LABEL: insert_mem_hi_v4f32:
2314 ; AVX-NEXT: vmovhps {{.*#+}} xmm0 = xmm0[0,1],mem[0,1]
2316 %a = load <2 x float>, <2 x float>* %ptr
2317 %v = shufflevector <2 x float> %a, <2 x float> undef, <4 x i32> <i32 0, i32 1, i32 undef, i32 undef>
2318 %shuffle = shufflevector <4 x float> %v, <4 x float> %b, <4 x i32> <i32 4, i32 5, i32 0, i32 1>
2319 ret <4 x float> %shuffle
2323 define <4 x float> @shuffle_mem_v4f32_3210(<4 x float>* %ptr) {
2324 ; SSE-LABEL: shuffle_mem_v4f32_3210:
2326 ; SSE-NEXT: movaps (%rdi), %xmm0
2327 ; SSE-NEXT: shufps {{.*#+}} xmm0 = xmm0[3,2,1,0]
2330 ; AVX-LABEL: shuffle_mem_v4f32_3210:
2332 ; AVX-NEXT: vpermilps {{.*#+}} xmm0 = mem[3,2,1,0]
2334 %a = load <4 x float>, <4 x float>* %ptr
2335 %shuffle = shufflevector <4 x float> %a, <4 x float> undef, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
2336 ret <4 x float> %shuffle
2339 define <4 x i32> @insert_dup_mem_v4i32(i32* %ptr) {
2340 ; SSE-LABEL: insert_dup_mem_v4i32:
2342 ; SSE-NEXT: movd {{.*#+}} xmm0 = mem[0],zero,zero,zero
2343 ; SSE-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,0,0,0]
2346 ; AVX-LABEL: insert_dup_mem_v4i32:
2348 ; AVX-NEXT: vbroadcastss (%rdi), %xmm0
2350 %tmp = load i32, i32* %ptr, align 4
2351 %tmp1 = insertelement <4 x i32> zeroinitializer, i32 %tmp, i32 0
2352 %tmp2 = shufflevector <4 x i32> %tmp1, <4 x i32> undef, <4 x i32> zeroinitializer
2357 define <4 x float> @shuffle_mem_pmovzx_v4f32(<2 x float>* %p0, <4 x float>* %p1) {
2358 ; SSE-LABEL: shuffle_mem_pmovzx_v4f32:
2360 ; SSE-NEXT: movsd {{.*#+}} xmm0 = mem[0],zero
2361 ; SSE-NEXT: xorps %xmm1, %xmm1
2362 ; SSE-NEXT: movaps %xmm0, %xmm2
2363 ; SSE-NEXT: unpcklps {{.*#+}} xmm2 = xmm2[0],xmm1[0],xmm2[1],xmm1[1]
2364 ; SSE-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,0,0,0]
2365 ; SSE-NEXT: movaps %xmm2, (%rsi)
2368 ; AVX1-LABEL: shuffle_mem_pmovzx_v4f32:
2370 ; AVX1-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
2371 ; AVX1-NEXT: vxorps %xmm1, %xmm1, %xmm1
2372 ; AVX1-NEXT: vunpcklps {{.*#+}} xmm1 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
2373 ; AVX1-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[0,0,0,0]
2374 ; AVX1-NEXT: vmovaps %xmm1, (%rsi)
2377 ; AVX2OR512VL-LABEL: shuffle_mem_pmovzx_v4f32:
2378 ; AVX2OR512VL: # %bb.0:
2379 ; AVX2OR512VL-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
2380 ; AVX2OR512VL-NEXT: vxorps %xmm1, %xmm1, %xmm1
2381 ; AVX2OR512VL-NEXT: vunpcklps {{.*#+}} xmm1 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
2382 ; AVX2OR512VL-NEXT: vbroadcastss %xmm0, %xmm0
2383 ; AVX2OR512VL-NEXT: vmovaps %xmm1, (%rsi)
2384 ; AVX2OR512VL-NEXT: retq
2385 %1 = load <2 x float>, <2 x float>* %p0
2386 %2 = shufflevector <2 x float> %1, <2 x float> undef, <4 x i32> <i32 undef, i32 undef, i32 0, i32 1>
2387 %3 = shufflevector <4 x float> %2, <4 x float> <float undef, float undef, float 0.000000e+00, float 0.000000e+00>, <4 x i32> <i32 2, i32 6, i32 3, i32 7>
2388 %4 = shufflevector <2 x float> %1, <2 x float> undef, <4 x i32> zeroinitializer
2389 store <4 x float> %3, <4 x float>* %p1
2394 ; Shuffle to logical bit shifts
2397 define <4 x i32> @shuffle_v4i32_z0zX(<4 x i32> %a) {
2398 ; SSE-LABEL: shuffle_v4i32_z0zX:
2400 ; SSE-NEXT: psllq $32, %xmm0
2403 ; AVX-LABEL: shuffle_v4i32_z0zX:
2405 ; AVX-NEXT: vpsllq $32, %xmm0, %xmm0
2407 %shuffle = shufflevector <4 x i32> %a, <4 x i32> zeroinitializer, <4 x i32> <i32 4, i32 0, i32 4, i32 undef>
2408 ret <4 x i32> %shuffle
2411 define <4 x i32> @shuffle_v4i32_1z3z(<4 x i32> %a) {
2412 ; SSE-LABEL: shuffle_v4i32_1z3z:
2414 ; SSE-NEXT: psrlq $32, %xmm0
2417 ; AVX-LABEL: shuffle_v4i32_1z3z:
2419 ; AVX-NEXT: vpsrlq $32, %xmm0, %xmm0
2421 %shuffle = shufflevector <4 x i32> %a, <4 x i32> zeroinitializer, <4 x i32> <i32 1, i32 4, i32 3, i32 4>
2422 ret <4 x i32> %shuffle
2425 define <4 x float> @shuffle_mem_v4f32_0145(<4 x float> %a, <4 x float>* %pb) {
2426 ; SSE-LABEL: shuffle_mem_v4f32_0145:
2428 ; SSE-NEXT: movhps {{.*#+}} xmm0 = xmm0[0,1],mem[0,1]
2431 ; AVX-LABEL: shuffle_mem_v4f32_0145:
2433 ; AVX-NEXT: vunpcklpd {{.*#+}} xmm0 = xmm0[0],mem[0]
2435 %b = load <4 x float>, <4 x float>* %pb, align 1
2436 %shuffle = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 0, i32 1, i32 4, i32 5>
2437 ret <4 x float> %shuffle
2440 define <4 x float> @shuffle_mem_v4f32_4523(<4 x float> %a, <4 x float>* %pb) {
2441 ; SSE2-LABEL: shuffle_mem_v4f32_4523:
2443 ; SSE2-NEXT: movlps {{.*#+}} xmm0 = mem[0,1],xmm0[2,3]
2446 ; SSE3-LABEL: shuffle_mem_v4f32_4523:
2448 ; SSE3-NEXT: movlps {{.*#+}} xmm0 = mem[0,1],xmm0[2,3]
2451 ; SSSE3-LABEL: shuffle_mem_v4f32_4523:
2453 ; SSSE3-NEXT: movlps {{.*#+}} xmm0 = mem[0,1],xmm0[2,3]
2456 ; SSE41-LABEL: shuffle_mem_v4f32_4523:
2458 ; SSE41-NEXT: movups (%rdi), %xmm1
2459 ; SSE41-NEXT: blendps {{.*#+}} xmm0 = xmm1[0,1],xmm0[2,3]
2462 ; AVX-LABEL: shuffle_mem_v4f32_4523:
2464 ; AVX-NEXT: vblendps {{.*#+}} xmm0 = mem[0,1],xmm0[2,3]
2466 %b = load <4 x float>, <4 x float>* %pb, align 1
2467 %shuffle = shufflevector <4 x float> %a, <4 x float> %b, <4 x i32> <i32 4, i32 5, i32 2, i32 3>
2468 ret <4 x float> %shuffle