1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx | FileCheck %s --check-prefix=ALL --check-prefix=AVX1OR2 --check-prefix=AVX1
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2 | FileCheck %s --check-prefix=ALL --check-prefix=AVX1OR2 --check-prefix=AVX2 --check-prefix=AVX2-SLOW
4 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2,+fast-variable-shuffle | FileCheck %s --check-prefix=ALL --check-prefix=AVX1OR2 --check-prefix=AVX2 --check-prefix=AVX2-FAST
5 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512vl | FileCheck %s --check-prefix=ALL --check-prefix=AVX512VL --check-prefix=AVX512VL-SLOW
6 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512vl,+fast-variable-shuffle | FileCheck %s --check-prefix=ALL --check-prefix=AVX512VL --check-prefix=AVX512VL-FAST
8 define <4 x double> @shuffle_v4f64_0000(<4 x double> %a, <4 x double> %b) {
9 ; AVX1-LABEL: shuffle_v4f64_0000:
11 ; AVX1-NEXT: vmovddup {{.*#+}} xmm0 = xmm0[0,0]
12 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
15 ; AVX2-LABEL: shuffle_v4f64_0000:
17 ; AVX2-NEXT: vbroadcastsd %xmm0, %ymm0
20 ; AVX512VL-LABEL: shuffle_v4f64_0000:
22 ; AVX512VL-NEXT: vbroadcastsd %xmm0, %ymm0
24 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
25 ret <4 x double> %shuffle
28 define <4 x double> @shuffle_v4f64_0001(<4 x double> %a, <4 x double> %b) {
29 ; AVX1-LABEL: shuffle_v4f64_0001:
31 ; AVX1-NEXT: vmovddup {{.*#+}} xmm1 = xmm0[0,0]
32 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0
35 ; AVX2-LABEL: shuffle_v4f64_0001:
37 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,0,1]
40 ; AVX512VL-LABEL: shuffle_v4f64_0001:
42 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,0,1]
44 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 0, i32 0, i32 0, i32 1>
45 ret <4 x double> %shuffle
48 define <4 x double> @shuffle_v4f64_0020(<4 x double> %a, <4 x double> %b) {
49 ; AVX1-LABEL: shuffle_v4f64_0020:
51 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
52 ; AVX1-NEXT: vmovlhps {{.*#+}} xmm1 = xmm1[0],xmm0[0]
53 ; AVX1-NEXT: vmovddup {{.*#+}} xmm0 = xmm0[0,0]
54 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
57 ; AVX2-LABEL: shuffle_v4f64_0020:
59 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,2,0]
62 ; AVX512VL-LABEL: shuffle_v4f64_0020:
64 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,2,0]
66 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 0, i32 0, i32 2, i32 0>
67 ret <4 x double> %shuffle
70 define <4 x double> @shuffle_v4f64_0300(<4 x double> %a, <4 x double> %b) {
71 ; AVX1-LABEL: shuffle_v4f64_0300:
73 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm1 = ymm0[2,3,0,1]
74 ; AVX1-NEXT: vpermilpd {{.*#+}} ymm1 = ymm1[0,1,2,2]
75 ; AVX1-NEXT: vblendpd {{.*#+}} ymm0 = ymm0[0],ymm1[1,2,3]
78 ; AVX2-LABEL: shuffle_v4f64_0300:
80 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,3,0,0]
83 ; AVX512VL-LABEL: shuffle_v4f64_0300:
85 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,3,0,0]
87 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 0, i32 3, i32 0, i32 0>
88 ret <4 x double> %shuffle
91 define <4 x double> @shuffle_v4f64_1000(<4 x double> %a, <4 x double> %b) {
92 ; AVX1-LABEL: shuffle_v4f64_1000:
94 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
95 ; AVX1-NEXT: vpermilpd {{.*#+}} ymm0 = ymm0[1,0,2,2]
98 ; AVX2-LABEL: shuffle_v4f64_1000:
100 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[1,0,0,0]
103 ; AVX512VL-LABEL: shuffle_v4f64_1000:
105 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[1,0,0,0]
106 ; AVX512VL-NEXT: retq
107 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 1, i32 0, i32 0, i32 0>
108 ret <4 x double> %shuffle
111 define <4 x double> @shuffle_v4f64_2200(<4 x double> %a, <4 x double> %b) {
112 ; AVX1-LABEL: shuffle_v4f64_2200:
114 ; AVX1-NEXT: vmovddup {{.*#+}} ymm0 = ymm0[0,0,2,2]
115 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3,0,1]
118 ; AVX2-LABEL: shuffle_v4f64_2200:
120 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,2,0,0]
123 ; AVX512VL-LABEL: shuffle_v4f64_2200:
125 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,2,0,0]
126 ; AVX512VL-NEXT: retq
127 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 2, i32 2, i32 0, i32 0>
128 ret <4 x double> %shuffle
131 define <4 x double> @shuffle_v4f64_2222(<4 x double> %a, <4 x double> %b) {
132 ; AVX1-LABEL: shuffle_v4f64_2222:
134 ; AVX1-NEXT: vmovddup {{.*#+}} ymm0 = ymm0[0,0,2,2]
135 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3,2,3]
138 ; AVX2-LABEL: shuffle_v4f64_2222:
140 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,2,2,2]
143 ; AVX512VL-LABEL: shuffle_v4f64_2222:
145 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,2,2,2]
146 ; AVX512VL-NEXT: retq
147 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 2, i32 2, i32 2, i32 2>
148 ret <4 x double> %shuffle
151 define <4 x double> @shuffle_v4f64_2222_bc(<4 x i64> %a, <4 x i64> %b) {
152 ; AVX1-LABEL: shuffle_v4f64_2222_bc:
154 ; AVX1-NEXT: vmovddup {{.*#+}} ymm0 = ymm0[0,0,2,2]
155 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3,2,3]
158 ; AVX2-LABEL: shuffle_v4f64_2222_bc:
160 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,2,2,2]
163 ; AVX512VL-LABEL: shuffle_v4f64_2222_bc:
165 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,2,2,2]
166 ; AVX512VL-NEXT: retq
167 %tmp0 = bitcast <4 x i64> %a to <4 x double>
168 %tmp1 = bitcast <4 x i64> %b to <4 x double>
169 %shuffle = shufflevector <4 x double> %tmp0, <4 x double> %tmp1, <4 x i32> <i32 2, i32 2, i32 2, i32 2>
170 ret <4 x double> %shuffle
173 define <4 x double> @shuffle_v4f64_2233(<4 x double> %a, <4 x double> %b) {
174 ; AVX1-LABEL: shuffle_v4f64_2233:
176 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3,2,3]
177 ; AVX1-NEXT: vpermilpd {{.*#+}} ymm0 = ymm0[0,0,3,3]
180 ; AVX2-LABEL: shuffle_v4f64_2233:
182 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,2,3,3]
185 ; AVX512VL-LABEL: shuffle_v4f64_2233:
187 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,2,3,3]
188 ; AVX512VL-NEXT: retq
189 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 2, i32 2, i32 3, i32 3>
190 ret <4 x double> %shuffle
193 define <4 x double> @shuffle_v4f64_3330(<4 x double> %a, <4 x double> %b) {
194 ; AVX1-LABEL: shuffle_v4f64_3330:
196 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm1 = ymm0[2,3,0,1]
197 ; AVX1-NEXT: vblendpd {{.*#+}} ymm0 = ymm1[0,1,2],ymm0[3]
198 ; AVX1-NEXT: vpermilpd {{.*#+}} ymm0 = ymm0[1,1,3,2]
201 ; AVX2-LABEL: shuffle_v4f64_3330:
203 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[3,3,3,0]
206 ; AVX512VL-LABEL: shuffle_v4f64_3330:
208 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[3,3,3,0]
209 ; AVX512VL-NEXT: retq
210 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 3, i32 3, i32 3, i32 0>
211 ret <4 x double> %shuffle
214 define <4 x double> @shuffle_v4f64_3210(<4 x double> %a, <4 x double> %b) {
215 ; AVX1-LABEL: shuffle_v4f64_3210:
217 ; AVX1-NEXT: vpermilpd {{.*#+}} ymm0 = ymm0[1,0,3,2]
218 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3,0,1]
221 ; AVX2-LABEL: shuffle_v4f64_3210:
223 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[3,2,1,0]
226 ; AVX512VL-LABEL: shuffle_v4f64_3210:
228 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[3,2,1,0]
229 ; AVX512VL-NEXT: retq
230 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
231 ret <4 x double> %shuffle
234 define <4 x double> @shuffle_v4f64_0023(<4 x double> %a, <4 x double> %b) {
235 ; ALL-LABEL: shuffle_v4f64_0023:
237 ; ALL-NEXT: vpermilpd {{.*#+}} ymm0 = ymm0[0,0,2,3]
240 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 0, i32 0, i32 2, i32 3>
241 ret <4 x double> %shuffle
244 define <4 x double> @shuffle_v4f64_0022(<4 x double> %a, <4 x double> %b) {
245 ; ALL-LABEL: shuffle_v4f64_0022:
247 ; ALL-NEXT: vmovddup {{.*#+}} ymm0 = ymm0[0,0,2,2]
249 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 0, i32 0, i32 2, i32 2>
250 ret <4 x double> %shuffle
253 define <4 x double> @shuffle_v4f64mem_0022(<4 x double>* %ptr, <4 x double> %b) {
254 ; ALL-LABEL: shuffle_v4f64mem_0022:
256 ; ALL-NEXT: vmovddup {{.*#+}} ymm0 = mem[0,0,2,2]
258 %a = load <4 x double>, <4 x double>* %ptr
259 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 0, i32 0, i32 2, i32 2>
260 ret <4 x double> %shuffle
263 define <4 x double> @shuffle_v4f64_1032(<4 x double> %a, <4 x double> %b) {
264 ; ALL-LABEL: shuffle_v4f64_1032:
266 ; ALL-NEXT: vpermilpd {{.*#+}} ymm0 = ymm0[1,0,3,2]
268 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 1, i32 0, i32 3, i32 2>
269 ret <4 x double> %shuffle
272 define <4 x double> @shuffle_v4f64_1133(<4 x double> %a, <4 x double> %b) {
273 ; ALL-LABEL: shuffle_v4f64_1133:
275 ; ALL-NEXT: vpermilpd {{.*#+}} ymm0 = ymm0[1,1,3,3]
277 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 1, i32 1, i32 3, i32 3>
278 ret <4 x double> %shuffle
281 define <4 x double> @shuffle_v4f64_1023(<4 x double> %a, <4 x double> %b) {
282 ; ALL-LABEL: shuffle_v4f64_1023:
284 ; ALL-NEXT: vpermilpd {{.*#+}} ymm0 = ymm0[1,0,2,3]
286 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 1, i32 0, i32 2, i32 3>
287 ret <4 x double> %shuffle
290 define <4 x double> @shuffle_v4f64_1022(<4 x double> %a, <4 x double> %b) {
291 ; ALL-LABEL: shuffle_v4f64_1022:
293 ; ALL-NEXT: vpermilpd {{.*#+}} ymm0 = ymm0[1,0,2,2]
295 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 1, i32 0, i32 2, i32 2>
296 ret <4 x double> %shuffle
299 define <4 x double> @shuffle_v4f64_0213(<4 x double> %a, <4 x double> %b) {
300 ; AVX1-LABEL: shuffle_v4f64_0213:
302 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm1 = ymm0[2,3,0,1]
303 ; AVX1-NEXT: vpermilpd {{.*#+}} ymm1 = ymm1[0,0,3,2]
304 ; AVX1-NEXT: vblendpd {{.*#+}} ymm0 = ymm0[0],ymm1[1,2],ymm0[3]
307 ; AVX2-LABEL: shuffle_v4f64_0213:
309 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,2,1,3]
312 ; AVX512VL-LABEL: shuffle_v4f64_0213:
314 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,2,1,3]
315 ; AVX512VL-NEXT: retq
316 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
317 ret <4 x double> %shuffle
320 define <4 x double> @shuffle_v4f64_0423(<4 x double> %a, <4 x double> %b) {
321 ; ALL-LABEL: shuffle_v4f64_0423:
323 ; ALL-NEXT: vmovddup {{.*#+}} xmm1 = xmm1[0,0]
324 ; ALL-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1],ymm1[2,3],ymm0[4,5,6,7]
326 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 0, i32 4, i32 2, i32 3>
327 ret <4 x double> %shuffle
330 define <4 x double> @shuffle_v4f64_0462(<4 x double> %a, <4 x double> %b) {
331 ; ALL-LABEL: shuffle_v4f64_0462:
333 ; ALL-NEXT: vblendps {{.*#+}} ymm2 = ymm1[0,1,2,3],ymm0[4,5,6,7]
334 ; ALL-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1,2,3],ymm1[4,5,6,7]
335 ; ALL-NEXT: vunpcklpd {{.*#+}} ymm0 = ymm0[0],ymm2[0],ymm0[2],ymm2[2]
337 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 0, i32 4, i32 6, i32 2>
338 ret <4 x double> %shuffle
341 define <4 x double> @shuffle_v4f64_0426(<4 x double> %a, <4 x double> %b) {
342 ; ALL-LABEL: shuffle_v4f64_0426:
344 ; ALL-NEXT: vunpcklpd {{.*#+}} ymm0 = ymm0[0],ymm1[0],ymm0[2],ymm1[2]
346 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 0, i32 4, i32 2, i32 6>
347 ret <4 x double> %shuffle
350 define <4 x double> @shuffle_v4f64_1537(<4 x double> %a, <4 x double> %b) {
351 ; ALL-LABEL: shuffle_v4f64_1537:
353 ; ALL-NEXT: vunpckhpd {{.*#+}} ymm0 = ymm0[1],ymm1[1],ymm0[3],ymm1[3]
355 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 1, i32 5, i32 3, i32 7>
356 ret <4 x double> %shuffle
359 define <4 x double> @shuffle_v4f64_4062(<4 x double> %a, <4 x double> %b) {
360 ; ALL-LABEL: shuffle_v4f64_4062:
362 ; ALL-NEXT: vunpcklpd {{.*#+}} ymm0 = ymm1[0],ymm0[0],ymm1[2],ymm0[2]
364 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 4, i32 0, i32 6, i32 2>
365 ret <4 x double> %shuffle
368 define <4 x double> @shuffle_v4f64_5173(<4 x double> %a, <4 x double> %b) {
369 ; ALL-LABEL: shuffle_v4f64_5173:
371 ; ALL-NEXT: vunpckhpd {{.*#+}} ymm0 = ymm1[1],ymm0[1],ymm1[3],ymm0[3]
373 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 5, i32 1, i32 7, i32 3>
374 ret <4 x double> %shuffle
377 define <4 x double> @shuffle_v4f64_5163(<4 x double> %a, <4 x double> %b) {
378 ; ALL-LABEL: shuffle_v4f64_5163:
380 ; ALL-NEXT: vshufpd {{.*#+}} ymm0 = ymm1[1],ymm0[1],ymm1[2],ymm0[3]
382 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 5, i32 1, i32 6, i32 3>
383 ret <4 x double> %shuffle
386 define <4 x double> @shuffle_v4f64_0527(<4 x double> %a, <4 x double> %b) {
387 ; ALL-LABEL: shuffle_v4f64_0527:
389 ; ALL-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1],ymm1[2,3],ymm0[4,5],ymm1[6,7]
391 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 0, i32 5, i32 2, i32 7>
392 ret <4 x double> %shuffle
395 define <4 x double> @shuffle_v4f64_4163(<4 x double> %a, <4 x double> %b) {
396 ; ALL-LABEL: shuffle_v4f64_4163:
398 ; ALL-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3],ymm1[4,5],ymm0[6,7]
400 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 4, i32 1, i32 6, i32 3>
401 ret <4 x double> %shuffle
404 define <4 x double> @shuffle_v4f64_0145(<4 x double> %a, <4 x double> %b) {
405 ; ALL-LABEL: shuffle_v4f64_0145:
407 ; ALL-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
409 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 0, i32 1, i32 4, i32 5>
410 ret <4 x double> %shuffle
413 define <4 x double> @shuffle_v4f64_4501(<4 x double> %a, <4 x double> %b) {
414 ; ALL-LABEL: shuffle_v4f64_4501:
416 ; ALL-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0
418 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 4, i32 5, i32 0, i32 1>
419 ret <4 x double> %shuffle
422 define <4 x double> @shuffle_v4f64_0167(<4 x double> %a, <4 x double> %b) {
423 ; ALL-LABEL: shuffle_v4f64_0167:
425 ; ALL-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1,2,3],ymm1[4,5,6,7]
427 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 0, i32 1, i32 6, i32 7>
428 ret <4 x double> %shuffle
431 define <4 x double> @shuffle_v4f64_1054(<4 x double> %a, <4 x double> %b) {
432 ; ALL-LABEL: shuffle_v4f64_1054:
434 ; ALL-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
435 ; ALL-NEXT: vpermilpd {{.*#+}} ymm0 = ymm0[1,0,3,2]
437 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 1, i32 0, i32 5, i32 4>
438 ret <4 x double> %shuffle
441 define <4 x double> @shuffle_v4f64_3254(<4 x double> %a, <4 x double> %b) {
442 ; AVX1OR2-LABEL: shuffle_v4f64_3254:
444 ; AVX1OR2-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3],ymm1[0,1]
445 ; AVX1OR2-NEXT: vpermilpd {{.*#+}} ymm0 = ymm0[1,0,3,2]
448 ; AVX512VL-SLOW-LABEL: shuffle_v4f64_3254:
449 ; AVX512VL-SLOW: # %bb.0:
450 ; AVX512VL-SLOW-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3],ymm1[0,1]
451 ; AVX512VL-SLOW-NEXT: vpermilpd {{.*#+}} ymm0 = ymm0[1,0,3,2]
452 ; AVX512VL-SLOW-NEXT: retq
454 ; AVX512VL-FAST-LABEL: shuffle_v4f64_3254:
455 ; AVX512VL-FAST: # %bb.0:
456 ; AVX512VL-FAST-NEXT: vmovapd {{.*#+}} ymm2 = [3,2,5,4]
457 ; AVX512VL-FAST-NEXT: vpermt2pd %ymm1, %ymm2, %ymm0
458 ; AVX512VL-FAST-NEXT: retq
459 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 3, i32 2, i32 5, i32 4>
460 ret <4 x double> %shuffle
463 define <4 x double> @shuffle_v4f64_3276(<4 x double> %a, <4 x double> %b) {
464 ; AVX1OR2-LABEL: shuffle_v4f64_3276:
466 ; AVX1OR2-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3],ymm1[2,3]
467 ; AVX1OR2-NEXT: vpermilpd {{.*#+}} ymm0 = ymm0[1,0,3,2]
470 ; AVX512VL-SLOW-LABEL: shuffle_v4f64_3276:
471 ; AVX512VL-SLOW: # %bb.0:
472 ; AVX512VL-SLOW-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3],ymm1[2,3]
473 ; AVX512VL-SLOW-NEXT: vpermilpd {{.*#+}} ymm0 = ymm0[1,0,3,2]
474 ; AVX512VL-SLOW-NEXT: retq
476 ; AVX512VL-FAST-LABEL: shuffle_v4f64_3276:
477 ; AVX512VL-FAST: # %bb.0:
478 ; AVX512VL-FAST-NEXT: vmovapd {{.*#+}} ymm2 = [3,2,7,6]
479 ; AVX512VL-FAST-NEXT: vpermt2pd %ymm1, %ymm2, %ymm0
480 ; AVX512VL-FAST-NEXT: retq
481 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 3, i32 2, i32 7, i32 6>
482 ret <4 x double> %shuffle
485 define <4 x double> @shuffle_v4f64_1076(<4 x double> %a, <4 x double> %b) {
486 ; ALL-LABEL: shuffle_v4f64_1076:
488 ; ALL-NEXT: vblendpd {{.*#+}} ymm0 = ymm0[0,1],ymm1[2,3]
489 ; ALL-NEXT: vpermilpd {{.*#+}} ymm0 = ymm0[1,0,3,2]
491 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 1, i32 0, i32 7, i32 6>
492 ret <4 x double> %shuffle
495 define <4 x double> @shuffle_v4f64_0415(<4 x double> %a, <4 x double> %b) {
496 ; AVX1-LABEL: shuffle_v4f64_0415:
498 ; AVX1-NEXT: vunpckhpd {{.*#+}} xmm2 = xmm0[1],xmm1[1]
499 ; AVX1-NEXT: vmovlhps {{.*#+}} xmm0 = xmm0[0],xmm1[0]
500 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
503 ; AVX2-LABEL: shuffle_v4f64_0415:
505 ; AVX2-NEXT: vpermpd {{.*#+}} ymm1 = ymm1[0,0,2,1]
506 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,1,1,3]
507 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1],ymm1[2,3],ymm0[4,5],ymm1[6,7]
510 ; AVX512VL-LABEL: shuffle_v4f64_0415:
512 ; AVX512VL-NEXT: vmovapd {{.*#+}} ymm2 = [0,4,1,5]
513 ; AVX512VL-NEXT: vpermt2pd %ymm1, %ymm2, %ymm0
514 ; AVX512VL-NEXT: retq
515 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 0, i32 4, i32 1, i32 5>
516 ret <4 x double> %shuffle
519 define <4 x double> @shuffle_v4f64_u062(<4 x double> %a, <4 x double> %b) {
520 ; ALL-LABEL: shuffle_v4f64_u062:
522 ; ALL-NEXT: vunpcklpd {{.*#+}} ymm0 = ymm1[0],ymm0[0],ymm1[2],ymm0[2]
524 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 undef, i32 0, i32 6, i32 2>
525 ret <4 x double> %shuffle
528 define <4 x double> @shuffle_v4f64_15uu(<4 x double> %a, <4 x double> %b) {
529 ; ALL-LABEL: shuffle_v4f64_15uu:
531 ; ALL-NEXT: vunpckhpd {{.*#+}} xmm0 = xmm0[1],xmm1[1]
533 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 1, i32 5, i32 undef, i32 undef>
534 ret <4 x double> %shuffle
537 define <4 x double> @shuffle_v4f64_11uu(<4 x double> %a, <4 x double> %b) {
538 ; ALL-LABEL: shuffle_v4f64_11uu:
540 ; ALL-NEXT: vpermilpd {{.*#+}} xmm0 = xmm0[1,1]
542 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 1, i32 1, i32 undef, i32 undef>
543 ret <4 x double> %shuffle
546 define <4 x double> @shuffle_v4f64_22uu(<4 x double> %a, <4 x double> %b) {
547 ; AVX1-LABEL: shuffle_v4f64_22uu:
549 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm0
550 ; AVX1-NEXT: vmovddup {{.*#+}} xmm0 = xmm0[0,0]
553 ; AVX2-LABEL: shuffle_v4f64_22uu:
555 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,2,2,3]
558 ; AVX512VL-LABEL: shuffle_v4f64_22uu:
560 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,2,2,3]
561 ; AVX512VL-NEXT: retq
562 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 2, i32 2, i32 undef, i32 undef>
563 ret <4 x double> %shuffle
566 define <4 x double> @shuffle_v4f64_3333(<4 x double> %a, <4 x double> %b) {
567 ; AVX1-LABEL: shuffle_v4f64_3333:
569 ; AVX1-NEXT: vpermilpd {{.*#+}} ymm0 = ymm0[1,1,3,3]
570 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3,2,3]
573 ; AVX2-LABEL: shuffle_v4f64_3333:
575 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[3,3,3,3]
578 ; AVX512VL-LABEL: shuffle_v4f64_3333:
580 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[3,3,3,3]
581 ; AVX512VL-NEXT: retq
582 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 3, i32 3, i32 3, i32 3>
583 ret <4 x double> %shuffle
586 define <4 x double> @shuffle_v4f64_0z3z(<4 x double> %a, <4 x double> %b) {
587 ; AVX1-LABEL: shuffle_v4f64_0z3z:
589 ; AVX1-NEXT: vpermilpd {{.*#+}} ymm0 = ymm0[0,0,3,2]
590 ; AVX1-NEXT: vxorpd %xmm1, %xmm1, %xmm1
591 ; AVX1-NEXT: vblendpd {{.*#+}} ymm0 = ymm0[0],ymm1[1],ymm0[2],ymm1[3]
594 ; AVX2-SLOW-LABEL: shuffle_v4f64_0z3z:
595 ; AVX2-SLOW: # %bb.0:
596 ; AVX2-SLOW-NEXT: vpermilpd {{.*#+}} ymm0 = ymm0[0,0,3,2]
597 ; AVX2-SLOW-NEXT: vxorpd %xmm1, %xmm1, %xmm1
598 ; AVX2-SLOW-NEXT: vblendpd {{.*#+}} ymm0 = ymm0[0],ymm1[1],ymm0[2],ymm1[3]
599 ; AVX2-SLOW-NEXT: retq
601 ; AVX2-FAST-LABEL: shuffle_v4f64_0z3z:
602 ; AVX2-FAST: # %bb.0:
603 ; AVX2-FAST-NEXT: vpshufb {{.*#+}} ymm0 = ymm0[0,1,2,3,4,5,6,7],zero,zero,zero,zero,zero,zero,zero,zero,ymm0[24,25,26,27,28,29,30,31],zero,zero,zero,zero,zero,zero,zero,zero
604 ; AVX2-FAST-NEXT: retq
606 ; AVX512VL-SLOW-LABEL: shuffle_v4f64_0z3z:
607 ; AVX512VL-SLOW: # %bb.0:
608 ; AVX512VL-SLOW-NEXT: vpermilpd {{.*#+}} ymm0 = ymm0[0,0,3,2]
609 ; AVX512VL-SLOW-NEXT: vxorpd %xmm1, %xmm1, %xmm1
610 ; AVX512VL-SLOW-NEXT: vblendpd {{.*#+}} ymm0 = ymm0[0],ymm1[1],ymm0[2],ymm1[3]
611 ; AVX512VL-SLOW-NEXT: retq
613 ; AVX512VL-FAST-LABEL: shuffle_v4f64_0z3z:
614 ; AVX512VL-FAST: # %bb.0:
615 ; AVX512VL-FAST-NEXT: vpshufb {{.*#+}} ymm0 = ymm0[0,1,2,3,4,5,6,7],zero,zero,zero,zero,zero,zero,zero,zero,ymm0[24,25,26,27,28,29,30,31],zero,zero,zero,zero,zero,zero,zero,zero
616 ; AVX512VL-FAST-NEXT: retq
617 %shuffle = shufflevector <4 x double> %a, <4 x double> <double 0.000000e+00, double undef, double undef, double undef>, <4 x i32> <i32 0, i32 4, i32 3, i32 4>
618 ret <4 x double> %shuffle
621 define <4 x double> @shuffle_v4f64_1z2z(<4 x double> %a, <4 x double> %b) {
622 ; AVX1-LABEL: shuffle_v4f64_1z2z:
624 ; AVX1-NEXT: vxorpd %xmm1, %xmm1, %xmm1
625 ; AVX1-NEXT: vblendpd {{.*#+}} ymm0 = ymm1[0],ymm0[1,2,3]
626 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
627 ; AVX1-NEXT: vunpcklpd {{.*#+}} xmm1 = xmm1[0],xmm0[0]
628 ; AVX1-NEXT: vpermilpd {{.*#+}} xmm0 = xmm0[1,0]
629 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
632 ; AVX2-SLOW-LABEL: shuffle_v4f64_1z2z:
633 ; AVX2-SLOW: # %bb.0:
634 ; AVX2-SLOW-NEXT: vxorps %xmm1, %xmm1, %xmm1
635 ; AVX2-SLOW-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3,4,5,6,7]
636 ; AVX2-SLOW-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[1,0,2,0]
637 ; AVX2-SLOW-NEXT: retq
639 ; AVX2-FAST-LABEL: shuffle_v4f64_1z2z:
640 ; AVX2-FAST: # %bb.0:
641 ; AVX2-FAST-NEXT: vpshufb {{.*#+}} ymm0 = ymm0[8,9,10,11,12,13,14,15],zero,zero,zero,zero,zero,zero,zero,zero,ymm0[16,17,18,19,20,21,22,23],zero,zero,zero,zero,zero,zero,zero,zero
642 ; AVX2-FAST-NEXT: retq
644 ; AVX512VL-SLOW-LABEL: shuffle_v4f64_1z2z:
645 ; AVX512VL-SLOW: # %bb.0:
646 ; AVX512VL-SLOW-NEXT: vxorps %xmm1, %xmm1, %xmm1
647 ; AVX512VL-SLOW-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3,4,5,6,7]
648 ; AVX512VL-SLOW-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[1,0,2,0]
649 ; AVX512VL-SLOW-NEXT: retq
651 ; AVX512VL-FAST-LABEL: shuffle_v4f64_1z2z:
652 ; AVX512VL-FAST: # %bb.0:
653 ; AVX512VL-FAST-NEXT: vpshufb {{.*#+}} ymm0 = ymm0[8,9,10,11,12,13,14,15],zero,zero,zero,zero,zero,zero,zero,zero,ymm0[16,17,18,19,20,21,22,23],zero,zero,zero,zero,zero,zero,zero,zero
654 ; AVX512VL-FAST-NEXT: retq
655 %1 = shufflevector <4 x double> %a, <4 x double> <double 0.000000e+00, double undef, double undef, double undef>, <4 x i32> <i32 1, i32 4, i32 2, i32 4>
659 define <4 x i64> @shuffle_v4i64_0000(<4 x i64> %a, <4 x i64> %b) {
660 ; AVX1-LABEL: shuffle_v4i64_0000:
662 ; AVX1-NEXT: vmovddup {{.*#+}} xmm0 = xmm0[0,0]
663 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
666 ; AVX2-LABEL: shuffle_v4i64_0000:
668 ; AVX2-NEXT: vbroadcastsd %xmm0, %ymm0
671 ; AVX512VL-LABEL: shuffle_v4i64_0000:
673 ; AVX512VL-NEXT: vbroadcastsd %xmm0, %ymm0
674 ; AVX512VL-NEXT: retq
675 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
676 ret <4 x i64> %shuffle
679 define <4 x i64> @shuffle_v4i64_0001(<4 x i64> %a, <4 x i64> %b) {
680 ; AVX1-LABEL: shuffle_v4i64_0001:
682 ; AVX1-NEXT: vpermilps {{.*#+}} xmm1 = xmm0[0,1,0,1]
683 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0
686 ; AVX2-LABEL: shuffle_v4i64_0001:
688 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,0,1]
691 ; AVX512VL-LABEL: shuffle_v4i64_0001:
693 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,0,1]
694 ; AVX512VL-NEXT: retq
695 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 0, i32 0, i32 1>
696 ret <4 x i64> %shuffle
699 define <4 x i64> @shuffle_v4i64_0020(<4 x i64> %a, <4 x i64> %b) {
700 ; AVX1-LABEL: shuffle_v4i64_0020:
702 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
703 ; AVX1-NEXT: vmovlhps {{.*#+}} xmm1 = xmm1[0],xmm0[0]
704 ; AVX1-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[0,1,0,1]
705 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
708 ; AVX2-LABEL: shuffle_v4i64_0020:
710 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,2,0]
713 ; AVX512VL-LABEL: shuffle_v4i64_0020:
715 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,2,0]
716 ; AVX512VL-NEXT: retq
717 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 0, i32 2, i32 0>
718 ret <4 x i64> %shuffle
721 define <4 x i64> @shuffle_v4i64_0112(<4 x i64> %a, <4 x i64> %b) {
722 ; AVX1-LABEL: shuffle_v4i64_0112:
724 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
725 ; AVX1-NEXT: vpalignr {{.*#+}} xmm1 = xmm0[8,9,10,11,12,13,14,15],xmm1[0,1,2,3,4,5,6,7]
726 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
729 ; AVX2-LABEL: shuffle_v4i64_0112:
731 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,1,1,2]
734 ; AVX512VL-LABEL: shuffle_v4i64_0112:
736 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,1,1,2]
737 ; AVX512VL-NEXT: retq
738 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 1, i32 1, i32 2>
739 ret <4 x i64> %shuffle
742 define <4 x i64> @shuffle_v4i64_0300(<4 x i64> %a, <4 x i64> %b) {
743 ; AVX1-LABEL: shuffle_v4i64_0300:
745 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm1 = ymm0[2,3,0,1]
746 ; AVX1-NEXT: vpermilpd {{.*#+}} ymm1 = ymm1[0,1,2,2]
747 ; AVX1-NEXT: vblendpd {{.*#+}} ymm0 = ymm0[0],ymm1[1,2,3]
750 ; AVX2-LABEL: shuffle_v4i64_0300:
752 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,3,0,0]
755 ; AVX512VL-LABEL: shuffle_v4i64_0300:
757 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,3,0,0]
758 ; AVX512VL-NEXT: retq
759 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 3, i32 0, i32 0>
760 ret <4 x i64> %shuffle
763 define <4 x i64> @shuffle_v4i64_1000(<4 x i64> %a, <4 x i64> %b) {
764 ; AVX1-LABEL: shuffle_v4i64_1000:
766 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
767 ; AVX1-NEXT: vpermilpd {{.*#+}} ymm0 = ymm0[1,0,2,2]
770 ; AVX2-LABEL: shuffle_v4i64_1000:
772 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[1,0,0,0]
775 ; AVX512VL-LABEL: shuffle_v4i64_1000:
777 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[1,0,0,0]
778 ; AVX512VL-NEXT: retq
779 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 1, i32 0, i32 0, i32 0>
780 ret <4 x i64> %shuffle
783 define <4 x i64> @shuffle_v4i64_2200(<4 x i64> %a, <4 x i64> %b) {
784 ; AVX1-LABEL: shuffle_v4i64_2200:
786 ; AVX1-NEXT: vmovddup {{.*#+}} ymm0 = ymm0[0,0,2,2]
787 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3,0,1]
790 ; AVX2-LABEL: shuffle_v4i64_2200:
792 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,2,0,0]
795 ; AVX512VL-LABEL: shuffle_v4i64_2200:
797 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,2,0,0]
798 ; AVX512VL-NEXT: retq
799 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 2, i32 2, i32 0, i32 0>
800 ret <4 x i64> %shuffle
803 define <4 x i64> @shuffle_v4i64_3330(<4 x i64> %a, <4 x i64> %b) {
804 ; AVX1-LABEL: shuffle_v4i64_3330:
806 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm1 = ymm0[2,3,0,1]
807 ; AVX1-NEXT: vblendpd {{.*#+}} ymm0 = ymm1[0,1,2],ymm0[3]
808 ; AVX1-NEXT: vpermilpd {{.*#+}} ymm0 = ymm0[1,1,3,2]
811 ; AVX2-LABEL: shuffle_v4i64_3330:
813 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[3,3,3,0]
816 ; AVX512VL-LABEL: shuffle_v4i64_3330:
818 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[3,3,3,0]
819 ; AVX512VL-NEXT: retq
820 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 3, i32 3, i32 3, i32 0>
821 ret <4 x i64> %shuffle
824 define <4 x i64> @shuffle_v4i64_3210(<4 x i64> %a, <4 x i64> %b) {
825 ; AVX1-LABEL: shuffle_v4i64_3210:
827 ; AVX1-NEXT: vpermilpd {{.*#+}} ymm0 = ymm0[1,0,3,2]
828 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3,0,1]
831 ; AVX2-LABEL: shuffle_v4i64_3210:
833 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[3,2,1,0]
836 ; AVX512VL-LABEL: shuffle_v4i64_3210:
838 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[3,2,1,0]
839 ; AVX512VL-NEXT: retq
840 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
841 ret <4 x i64> %shuffle
844 define <4 x i64> @shuffle_v4i64_0213(<4 x i64> %a, <4 x i64> %b) {
845 ; AVX1-LABEL: shuffle_v4i64_0213:
847 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm1 = ymm0[2,3,0,1]
848 ; AVX1-NEXT: vpermilpd {{.*#+}} ymm1 = ymm1[0,0,3,2]
849 ; AVX1-NEXT: vblendpd {{.*#+}} ymm0 = ymm0[0],ymm1[1,2],ymm0[3]
852 ; AVX2-LABEL: shuffle_v4i64_0213:
854 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,2,1,3]
857 ; AVX512VL-LABEL: shuffle_v4i64_0213:
859 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,2,1,3]
860 ; AVX512VL-NEXT: retq
861 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
862 ret <4 x i64> %shuffle
865 define <4 x i64> @shuffle_v4i64_0124(<4 x i64> %a, <4 x i64> %b) {
866 ; AVX1-LABEL: shuffle_v4i64_0124:
868 ; AVX1-NEXT: vmovddup {{.*#+}} xmm1 = xmm1[0,0]
869 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm1
870 ; AVX1-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1,2,3,4,5],ymm1[6,7]
873 ; AVX2-LABEL: shuffle_v4i64_0124:
875 ; AVX2-NEXT: vbroadcastsd %xmm1, %ymm1
876 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1,2,3,4,5],ymm1[6,7]
879 ; AVX512VL-SLOW-LABEL: shuffle_v4i64_0124:
880 ; AVX512VL-SLOW: # %bb.0:
881 ; AVX512VL-SLOW-NEXT: vbroadcastsd %xmm1, %ymm1
882 ; AVX512VL-SLOW-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1,2,3,4,5],ymm1[6,7]
883 ; AVX512VL-SLOW-NEXT: retq
885 ; AVX512VL-FAST-LABEL: shuffle_v4i64_0124:
886 ; AVX512VL-FAST: # %bb.0:
887 ; AVX512VL-FAST-NEXT: vmovdqa {{.*#+}} ymm2 = [0,1,2,4]
888 ; AVX512VL-FAST-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
889 ; AVX512VL-FAST-NEXT: retq
890 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 1, i32 2, i32 4>
891 ret <4 x i64> %shuffle
894 define <4 x i64> @shuffle_v4i64_0142(<4 x i64> %a, <4 x i64> %b) {
895 ; AVX1-LABEL: shuffle_v4i64_0142:
897 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm1
898 ; AVX1-NEXT: vpermilpd {{.*#+}} ymm0 = ymm0[0,1,2,2]
899 ; AVX1-NEXT: vblendpd {{.*#+}} ymm0 = ymm0[0,1],ymm1[2],ymm0[3]
902 ; AVX2-LABEL: shuffle_v4i64_0142:
904 ; AVX2-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm1
905 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,1,2,2]
906 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1,2,3],ymm1[4,5],ymm0[6,7]
909 ; AVX512VL-LABEL: shuffle_v4i64_0142:
911 ; AVX512VL-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm1
912 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,1,2,2]
913 ; AVX512VL-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1,2,3],ymm1[4,5],ymm0[6,7]
914 ; AVX512VL-NEXT: retq
915 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 1, i32 4, i32 2>
916 ret <4 x i64> %shuffle
919 define <4 x i64> @shuffle_v4i64_0412(<4 x i64> %a, <4 x i64> %b) {
920 ; AVX1-LABEL: shuffle_v4i64_0412:
922 ; AVX1-NEXT: vmovddup {{.*#+}} xmm1 = xmm1[0,0]
923 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm2
924 ; AVX1-NEXT: vpalignr {{.*#+}} xmm2 = xmm0[8,9,10,11,12,13,14,15],xmm2[0,1,2,3,4,5,6,7]
925 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
926 ; AVX1-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1],ymm1[2,3],ymm0[4,5,6,7]
929 ; AVX2-LABEL: shuffle_v4i64_0412:
931 ; AVX2-NEXT: vmovddup {{.*#+}} xmm1 = xmm1[0,0]
932 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,1,1,2]
933 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1],ymm1[2,3],ymm0[4,5,6,7]
936 ; AVX512VL-LABEL: shuffle_v4i64_0412:
938 ; AVX512VL-NEXT: vmovdqa {{.*#+}} ymm2 = [0,4,1,2]
939 ; AVX512VL-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
940 ; AVX512VL-NEXT: retq
941 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 4, i32 1, i32 2>
942 ret <4 x i64> %shuffle
945 define <4 x i64> @shuffle_v4i64_4012(<4 x i64> %a, <4 x i64> %b) {
946 ; AVX1-LABEL: shuffle_v4i64_4012:
948 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm2
949 ; AVX1-NEXT: vpalignr {{.*#+}} xmm2 = xmm0[8,9,10,11,12,13,14,15],xmm2[0,1,2,3,4,5,6,7]
950 ; AVX1-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[0,1,0,1]
951 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
952 ; AVX1-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3,4,5,6,7]
955 ; AVX2-LABEL: shuffle_v4i64_4012:
957 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,1,2]
958 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3,4,5,6,7]
961 ; AVX512VL-SLOW-LABEL: shuffle_v4i64_4012:
962 ; AVX512VL-SLOW: # %bb.0:
963 ; AVX512VL-SLOW-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,1,2]
964 ; AVX512VL-SLOW-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3,4,5,6,7]
965 ; AVX512VL-SLOW-NEXT: retq
967 ; AVX512VL-FAST-LABEL: shuffle_v4i64_4012:
968 ; AVX512VL-FAST: # %bb.0:
969 ; AVX512VL-FAST-NEXT: vmovdqa {{.*#+}} ymm2 = [4,0,1,2]
970 ; AVX512VL-FAST-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
971 ; AVX512VL-FAST-NEXT: retq
972 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 4, i32 0, i32 1, i32 2>
973 ret <4 x i64> %shuffle
976 define <4 x i64> @shuffle_v4i64_0145(<4 x i64> %a, <4 x i64> %b) {
977 ; ALL-LABEL: shuffle_v4i64_0145:
979 ; ALL-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
981 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 1, i32 4, i32 5>
982 ret <4 x i64> %shuffle
985 define <4 x i64> @shuffle_v4i64_0451(<4 x i64> %a, <4 x i64> %b) {
986 ; AVX1-LABEL: shuffle_v4i64_0451:
988 ; AVX1-NEXT: vunpckhpd {{.*#+}} xmm2 = xmm1[1],xmm0[1]
989 ; AVX1-NEXT: vmovlhps {{.*#+}} xmm0 = xmm0[0],xmm1[0]
990 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
993 ; AVX2-LABEL: shuffle_v4i64_0451:
995 ; AVX2-NEXT: vpermpd {{.*#+}} ymm1 = ymm1[0,0,1,3]
996 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,1,2,1]
997 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1],ymm1[2,3,4,5],ymm0[6,7]
1000 ; AVX512VL-LABEL: shuffle_v4i64_0451:
1001 ; AVX512VL: # %bb.0:
1002 ; AVX512VL-NEXT: vmovdqa {{.*#+}} ymm2 = [0,4,5,1]
1003 ; AVX512VL-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
1004 ; AVX512VL-NEXT: retq
1005 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 4, i32 5, i32 1>
1006 ret <4 x i64> %shuffle
1009 define <4 x i64> @shuffle_v4i64_4501(<4 x i64> %a, <4 x i64> %b) {
1010 ; ALL-LABEL: shuffle_v4i64_4501:
1012 ; ALL-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0
1014 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 4, i32 5, i32 0, i32 1>
1015 ret <4 x i64> %shuffle
1018 define <4 x i64> @shuffle_v4i64_4015(<4 x i64> %a, <4 x i64> %b) {
1019 ; AVX1-LABEL: shuffle_v4i64_4015:
1021 ; AVX1-NEXT: vunpckhpd {{.*#+}} xmm2 = xmm0[1],xmm1[1]
1022 ; AVX1-NEXT: vmovlhps {{.*#+}} xmm0 = xmm1[0],xmm0[0]
1023 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
1026 ; AVX2-LABEL: shuffle_v4i64_4015:
1028 ; AVX2-NEXT: vpermpd {{.*#+}} ymm1 = ymm1[0,1,2,1]
1029 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,1,3]
1030 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3,4,5],ymm1[6,7]
1033 ; AVX512VL-LABEL: shuffle_v4i64_4015:
1034 ; AVX512VL: # %bb.0:
1035 ; AVX512VL-NEXT: vmovdqa {{.*#+}} ymm2 = [4,0,1,5]
1036 ; AVX512VL-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
1037 ; AVX512VL-NEXT: retq
1038 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 4, i32 0, i32 1, i32 5>
1039 ret <4 x i64> %shuffle
1042 define <4 x i64> @shuffle_v4i64_2u35(<4 x i64> %a, <4 x i64> %b) {
1043 ; AVX1-LABEL: shuffle_v4i64_2u35:
1045 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm0
1046 ; AVX1-NEXT: vunpckhpd {{.*#+}} xmm1 = xmm0[1],xmm1[1]
1047 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
1050 ; AVX2-LABEL: shuffle_v4i64_2u35:
1052 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1],ymm1[2,3],ymm0[4,5,6,7]
1053 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,1,3,1]
1056 ; AVX512VL-SLOW-LABEL: shuffle_v4i64_2u35:
1057 ; AVX512VL-SLOW: # %bb.0:
1058 ; AVX512VL-SLOW-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1],ymm1[2,3],ymm0[4,5,6,7]
1059 ; AVX512VL-SLOW-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,1,3,1]
1060 ; AVX512VL-SLOW-NEXT: retq
1062 ; AVX512VL-FAST-LABEL: shuffle_v4i64_2u35:
1063 ; AVX512VL-FAST: # %bb.0:
1064 ; AVX512VL-FAST-NEXT: vmovdqa {{.*#+}} ymm2 = [2,5,3,5]
1065 ; AVX512VL-FAST-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
1066 ; AVX512VL-FAST-NEXT: retq
1067 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 2, i32 undef, i32 3, i32 5>
1068 ret <4 x i64> %shuffle
1071 define <4 x i64> @shuffle_v4i64_1251(<4 x i64> %a, <4 x i64> %b) {
1072 ; AVX1-LABEL: shuffle_v4i64_1251:
1074 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm2 = ymm0[2,3,0,1]
1075 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1],ymm2[0],ymm0[2],ymm2[3]
1076 ; AVX1-NEXT: vpermilpd {{.*#+}} xmm1 = xmm1[1,0]
1077 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm1
1078 ; AVX1-NEXT: vblendpd {{.*#+}} ymm0 = ymm0[0,1],ymm1[2],ymm0[3]
1081 ; AVX2-LABEL: shuffle_v4i64_1251:
1083 ; AVX2-NEXT: vpermpd {{.*#+}} ymm1 = ymm1[0,1,1,3]
1084 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[1,2,2,1]
1085 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1,2,3],ymm1[4,5],ymm0[6,7]
1088 ; AVX512VL-LABEL: shuffle_v4i64_1251:
1089 ; AVX512VL: # %bb.0:
1090 ; AVX512VL-NEXT: vmovdqa {{.*#+}} ymm2 = [1,2,5,1]
1091 ; AVX512VL-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
1092 ; AVX512VL-NEXT: retq
1093 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 1, i32 2, i32 5, i32 1>
1094 ret <4 x i64> %shuffle
1097 define <4 x i64> @shuffle_v4i64_1054(<4 x i64> %a, <4 x i64> %b) {
1098 ; AVX1-LABEL: shuffle_v4i64_1054:
1100 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
1101 ; AVX1-NEXT: vpermilpd {{.*#+}} ymm0 = ymm0[1,0,3,2]
1104 ; AVX2-LABEL: shuffle_v4i64_1054:
1106 ; AVX2-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
1107 ; AVX2-NEXT: vpermilps {{.*#+}} ymm0 = ymm0[2,3,0,1,6,7,4,5]
1110 ; AVX512VL-LABEL: shuffle_v4i64_1054:
1111 ; AVX512VL: # %bb.0:
1112 ; AVX512VL-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
1113 ; AVX512VL-NEXT: vpermilps {{.*#+}} ymm0 = ymm0[2,3,0,1,6,7,4,5]
1114 ; AVX512VL-NEXT: retq
1115 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 1, i32 0, i32 5, i32 4>
1116 ret <4 x i64> %shuffle
1119 define <4 x i64> @shuffle_v4i64_3254(<4 x i64> %a, <4 x i64> %b) {
1120 ; AVX1-LABEL: shuffle_v4i64_3254:
1122 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3],ymm1[0,1]
1123 ; AVX1-NEXT: vpermilpd {{.*#+}} ymm0 = ymm0[1,0,3,2]
1126 ; AVX2-LABEL: shuffle_v4i64_3254:
1128 ; AVX2-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3],ymm1[0,1]
1129 ; AVX2-NEXT: vpermilps {{.*#+}} ymm0 = ymm0[2,3,0,1,6,7,4,5]
1132 ; AVX512VL-SLOW-LABEL: shuffle_v4i64_3254:
1133 ; AVX512VL-SLOW: # %bb.0:
1134 ; AVX512VL-SLOW-NEXT: vperm2i128 {{.*#+}} ymm0 = ymm0[2,3],ymm1[0,1]
1135 ; AVX512VL-SLOW-NEXT: vpshufd {{.*#+}} ymm0 = ymm0[2,3,0,1,6,7,4,5]
1136 ; AVX512VL-SLOW-NEXT: retq
1138 ; AVX512VL-FAST-LABEL: shuffle_v4i64_3254:
1139 ; AVX512VL-FAST: # %bb.0:
1140 ; AVX512VL-FAST-NEXT: vmovdqa {{.*#+}} ymm2 = [3,2,5,4]
1141 ; AVX512VL-FAST-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
1142 ; AVX512VL-FAST-NEXT: retq
1143 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 3, i32 2, i32 5, i32 4>
1144 ret <4 x i64> %shuffle
1147 define <4 x i64> @shuffle_v4i64_3276(<4 x i64> %a, <4 x i64> %b) {
1148 ; AVX1-LABEL: shuffle_v4i64_3276:
1150 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3],ymm1[2,3]
1151 ; AVX1-NEXT: vpermilpd {{.*#+}} ymm0 = ymm0[1,0,3,2]
1154 ; AVX2-LABEL: shuffle_v4i64_3276:
1156 ; AVX2-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3],ymm1[2,3]
1157 ; AVX2-NEXT: vpermilps {{.*#+}} ymm0 = ymm0[2,3,0,1,6,7,4,5]
1160 ; AVX512VL-SLOW-LABEL: shuffle_v4i64_3276:
1161 ; AVX512VL-SLOW: # %bb.0:
1162 ; AVX512VL-SLOW-NEXT: vperm2i128 {{.*#+}} ymm0 = ymm0[2,3],ymm1[2,3]
1163 ; AVX512VL-SLOW-NEXT: vpshufd {{.*#+}} ymm0 = ymm0[2,3,0,1,6,7,4,5]
1164 ; AVX512VL-SLOW-NEXT: retq
1166 ; AVX512VL-FAST-LABEL: shuffle_v4i64_3276:
1167 ; AVX512VL-FAST: # %bb.0:
1168 ; AVX512VL-FAST-NEXT: vmovdqa {{.*#+}} ymm2 = [3,2,7,6]
1169 ; AVX512VL-FAST-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
1170 ; AVX512VL-FAST-NEXT: retq
1171 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 3, i32 2, i32 7, i32 6>
1172 ret <4 x i64> %shuffle
1175 define <4 x i64> @shuffle_v4i64_1076(<4 x i64> %a, <4 x i64> %b) {
1176 ; AVX1-LABEL: shuffle_v4i64_1076:
1178 ; AVX1-NEXT: vblendpd {{.*#+}} ymm0 = ymm0[0,1],ymm1[2,3]
1179 ; AVX1-NEXT: vpermilpd {{.*#+}} ymm0 = ymm0[1,0,3,2]
1182 ; AVX2-LABEL: shuffle_v4i64_1076:
1184 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1,2,3],ymm1[4,5,6,7]
1185 ; AVX2-NEXT: vpermilps {{.*#+}} ymm0 = ymm0[2,3,0,1,6,7,4,5]
1188 ; AVX512VL-LABEL: shuffle_v4i64_1076:
1189 ; AVX512VL: # %bb.0:
1190 ; AVX512VL-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1,2,3],ymm1[4,5,6,7]
1191 ; AVX512VL-NEXT: vpermilps {{.*#+}} ymm0 = ymm0[2,3,0,1,6,7,4,5]
1192 ; AVX512VL-NEXT: retq
1193 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 1, i32 0, i32 7, i32 6>
1194 ret <4 x i64> %shuffle
1197 define <4 x i64> @shuffle_v4i64_0415(<4 x i64> %a, <4 x i64> %b) {
1198 ; AVX1-LABEL: shuffle_v4i64_0415:
1200 ; AVX1-NEXT: vunpckhpd {{.*#+}} xmm2 = xmm0[1],xmm1[1]
1201 ; AVX1-NEXT: vmovlhps {{.*#+}} xmm0 = xmm0[0],xmm1[0]
1202 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
1205 ; AVX2-LABEL: shuffle_v4i64_0415:
1207 ; AVX2-NEXT: vpermpd {{.*#+}} ymm1 = ymm1[0,0,2,1]
1208 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,1,1,3]
1209 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1],ymm1[2,3],ymm0[4,5],ymm1[6,7]
1212 ; AVX512VL-LABEL: shuffle_v4i64_0415:
1213 ; AVX512VL: # %bb.0:
1214 ; AVX512VL-NEXT: vmovdqa {{.*#+}} ymm2 = [0,4,1,5]
1215 ; AVX512VL-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
1216 ; AVX512VL-NEXT: retq
1217 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 4, i32 1, i32 5>
1218 ret <4 x i64> %shuffle
1221 define <4 x i64> @shuffle_v4i64_z4z6(<4 x i64> %a) {
1222 ; AVX1-LABEL: shuffle_v4i64_z4z6:
1224 ; AVX1-NEXT: vxorps %xmm1, %xmm1, %xmm1
1225 ; AVX1-NEXT: vunpcklpd {{.*#+}} ymm0 = ymm1[0],ymm0[0],ymm1[2],ymm0[2]
1228 ; AVX2-LABEL: shuffle_v4i64_z4z6:
1230 ; AVX2-NEXT: vpslldq {{.*#+}} ymm0 = zero,zero,zero,zero,zero,zero,zero,zero,ymm0[0,1,2,3,4,5,6,7],zero,zero,zero,zero,zero,zero,zero,zero,ymm0[16,17,18,19,20,21,22,23]
1233 ; AVX512VL-LABEL: shuffle_v4i64_z4z6:
1234 ; AVX512VL: # %bb.0:
1235 ; AVX512VL-NEXT: vpslldq {{.*#+}} ymm0 = zero,zero,zero,zero,zero,zero,zero,zero,ymm0[0,1,2,3,4,5,6,7],zero,zero,zero,zero,zero,zero,zero,zero,ymm0[16,17,18,19,20,21,22,23]
1236 ; AVX512VL-NEXT: retq
1237 %shuffle = shufflevector <4 x i64> zeroinitializer, <4 x i64> %a, <4 x i32> <i32 0, i32 4, i32 0, i32 6>
1238 ret <4 x i64> %shuffle
1241 define <4 x i64> @shuffle_v4i64_5zuz(<4 x i64> %a) {
1242 ; AVX1-LABEL: shuffle_v4i64_5zuz:
1244 ; AVX1-NEXT: vxorps %xmm1, %xmm1, %xmm1
1245 ; AVX1-NEXT: vunpckhpd {{.*#+}} ymm0 = ymm0[1],ymm1[1],ymm0[3],ymm1[3]
1248 ; AVX2-LABEL: shuffle_v4i64_5zuz:
1250 ; AVX2-NEXT: vpsrldq {{.*#+}} ymm0 = ymm0[8,9,10,11,12,13,14,15],zero,zero,zero,zero,zero,zero,zero,zero,ymm0[24,25,26,27,28,29,30,31],zero,zero,zero,zero,zero,zero,zero,zero
1253 ; AVX512VL-LABEL: shuffle_v4i64_5zuz:
1254 ; AVX512VL: # %bb.0:
1255 ; AVX512VL-NEXT: vpsrldq {{.*#+}} ymm0 = ymm0[8,9,10,11,12,13,14,15],zero,zero,zero,zero,zero,zero,zero,zero,ymm0[24,25,26,27,28,29,30,31],zero,zero,zero,zero,zero,zero,zero,zero
1256 ; AVX512VL-NEXT: retq
1257 %shuffle = shufflevector <4 x i64> zeroinitializer, <4 x i64> %a, <4 x i32> <i32 5, i32 0, i32 undef, i32 0>
1258 ret <4 x i64> %shuffle
1261 define <4 x i64> @shuffle_v4i64_40u2(<4 x i64> %a, <4 x i64> %b) {
1262 ; ALL-LABEL: shuffle_v4i64_40u2:
1264 ; ALL-NEXT: vunpcklpd {{.*#+}} ymm0 = ymm1[0],ymm0[0],ymm1[2],ymm0[2]
1266 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 4, i32 0, i32 undef, i32 2>
1267 ret <4 x i64> %shuffle
1270 define <4 x i64> @shuffle_v4i64_15uu(<4 x i64> %a, <4 x i64> %b) {
1271 ; ALL-LABEL: shuffle_v4i64_15uu:
1273 ; ALL-NEXT: vunpckhpd {{.*#+}} xmm0 = xmm0[1],xmm1[1]
1275 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 1, i32 5, i32 undef, i32 undef>
1276 ret <4 x i64> %shuffle
1279 define <4 x i64> @shuffle_v4i64_11uu(<4 x i64> %a, <4 x i64> %b) {
1280 ; ALL-LABEL: shuffle_v4i64_11uu:
1282 ; ALL-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[2,3,2,3]
1284 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 1, i32 1, i32 undef, i32 undef>
1285 ret <4 x i64> %shuffle
1288 define <4 x i64> @shuffle_v4i64_22uu(<4 x i64> %a, <4 x i64> %b) {
1289 ; AVX1-LABEL: shuffle_v4i64_22uu:
1291 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm0
1292 ; AVX1-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[0,1,0,1]
1295 ; AVX2-LABEL: shuffle_v4i64_22uu:
1297 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,2,2,3]
1300 ; AVX512VL-LABEL: shuffle_v4i64_22uu:
1301 ; AVX512VL: # %bb.0:
1302 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,2,2,3]
1303 ; AVX512VL-NEXT: retq
1304 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 2, i32 2, i32 undef, i32 undef>
1305 ret <4 x i64> %shuffle
1308 define <4 x i64> @shuffle_v4i64_3333(<4 x i64> %a, <4 x i64> %b) {
1309 ; AVX1-LABEL: shuffle_v4i64_3333:
1311 ; AVX1-NEXT: vpermilpd {{.*#+}} ymm0 = ymm0[1,1,3,3]
1312 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3,2,3]
1315 ; AVX2-LABEL: shuffle_v4i64_3333:
1317 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[3,3,3,3]
1320 ; AVX512VL-LABEL: shuffle_v4i64_3333:
1321 ; AVX512VL: # %bb.0:
1322 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[3,3,3,3]
1323 ; AVX512VL-NEXT: retq
1324 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 3, i32 3, i32 3, i32 3>
1325 ret <4 x i64> %shuffle
1328 define <4 x i64> @shuffle_v4i64_1z3z(<4 x i64> %a, <4 x i64> %b) {
1329 ; AVX1-LABEL: shuffle_v4i64_1z3z:
1331 ; AVX1-NEXT: vxorps %xmm1, %xmm1, %xmm1
1332 ; AVX1-NEXT: vunpckhpd {{.*#+}} ymm0 = ymm0[1],ymm1[1],ymm0[3],ymm1[3]
1335 ; AVX2-LABEL: shuffle_v4i64_1z3z:
1337 ; AVX2-NEXT: vpsrldq {{.*#+}} ymm0 = ymm0[8,9,10,11,12,13,14,15],zero,zero,zero,zero,zero,zero,zero,zero,ymm0[24,25,26,27,28,29,30,31],zero,zero,zero,zero,zero,zero,zero,zero
1340 ; AVX512VL-LABEL: shuffle_v4i64_1z3z:
1341 ; AVX512VL: # %bb.0:
1342 ; AVX512VL-NEXT: vpsrldq {{.*#+}} ymm0 = ymm0[8,9,10,11,12,13,14,15],zero,zero,zero,zero,zero,zero,zero,zero,ymm0[24,25,26,27,28,29,30,31],zero,zero,zero,zero,zero,zero,zero,zero
1343 ; AVX512VL-NEXT: retq
1344 %shuffle = shufflevector <4 x i64> %a, <4 x i64> <i64 0, i64 undef, i64 undef, i64 undef>, <4 x i32> <i32 1, i32 4, i32 3, i32 4>
1345 ret <4 x i64> %shuffle
1348 define <4 x i64> @stress_test1(<4 x i64> %a, <4 x i64> %b) {
1349 ; ALL-LABEL: stress_test1:
1351 %c = shufflevector <4 x i64> %b, <4 x i64> undef, <4 x i32> <i32 3, i32 1, i32 1, i32 0>
1352 %d = shufflevector <4 x i64> %c, <4 x i64> undef, <4 x i32> <i32 3, i32 undef, i32 2, i32 undef>
1353 %e = shufflevector <4 x i64> %b, <4 x i64> undef, <4 x i32> <i32 3, i32 3, i32 1, i32 undef>
1354 %f = shufflevector <4 x i64> %d, <4 x i64> %e, <4 x i32> <i32 5, i32 1, i32 1, i32 0>
1359 define <4 x i64> @insert_reg_and_zero_v4i64(i64 %a) {
1360 ; ALL-LABEL: insert_reg_and_zero_v4i64:
1362 ; ALL-NEXT: vmovq %rdi, %xmm0
1364 %v = insertelement <4 x i64> undef, i64 %a, i64 0
1365 %shuffle = shufflevector <4 x i64> %v, <4 x i64> zeroinitializer, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
1366 ret <4 x i64> %shuffle
1369 define <4 x i64> @insert_mem_and_zero_v4i64(i64* %ptr) {
1370 ; ALL-LABEL: insert_mem_and_zero_v4i64:
1372 ; ALL-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
1374 %a = load i64, i64* %ptr
1375 %v = insertelement <4 x i64> undef, i64 %a, i64 0
1376 %shuffle = shufflevector <4 x i64> %v, <4 x i64> zeroinitializer, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
1377 ret <4 x i64> %shuffle
1380 define <4 x double> @insert_reg_and_zero_v4f64(double %a) {
1381 ; ALL-LABEL: insert_reg_and_zero_v4f64:
1383 ; ALL-NEXT: # kill: def $xmm0 killed $xmm0 def $ymm0
1384 ; ALL-NEXT: vxorps %xmm1, %xmm1, %xmm1
1385 ; ALL-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0,1],xmm1[2,3]
1387 %v = insertelement <4 x double> undef, double %a, i32 0
1388 %shuffle = shufflevector <4 x double> %v, <4 x double> zeroinitializer, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
1389 ret <4 x double> %shuffle
1392 define <4 x double> @insert_mem_and_zero_v4f64(double* %ptr) {
1393 ; ALL-LABEL: insert_mem_and_zero_v4f64:
1395 ; ALL-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
1397 %a = load double, double* %ptr
1398 %v = insertelement <4 x double> undef, double %a, i32 0
1399 %shuffle = shufflevector <4 x double> %v, <4 x double> zeroinitializer, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
1400 ret <4 x double> %shuffle
1403 define <4 x double> @splat_mem_v4f64(double* %ptr) {
1404 ; ALL-LABEL: splat_mem_v4f64:
1406 ; ALL-NEXT: vbroadcastsd (%rdi), %ymm0
1408 %a = load double, double* %ptr
1409 %v = insertelement <4 x double> undef, double %a, i32 0
1410 %shuffle = shufflevector <4 x double> %v, <4 x double> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
1411 ret <4 x double> %shuffle
1414 define <4 x i64> @splat_mem_v4i64(i64* %ptr) {
1415 ; ALL-LABEL: splat_mem_v4i64:
1417 ; ALL-NEXT: vbroadcastsd (%rdi), %ymm0
1419 %a = load i64, i64* %ptr
1420 %v = insertelement <4 x i64> undef, i64 %a, i64 0
1421 %shuffle = shufflevector <4 x i64> %v, <4 x i64> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
1422 ret <4 x i64> %shuffle
1425 define <4 x double> @splat_mem_v4f64_2(double* %p) {
1426 ; ALL-LABEL: splat_mem_v4f64_2:
1428 ; ALL-NEXT: vbroadcastsd (%rdi), %ymm0
1430 %1 = load double, double* %p
1431 %2 = insertelement <2 x double> undef, double %1, i32 0
1432 %3 = shufflevector <2 x double> %2, <2 x double> undef, <4 x i32> zeroinitializer
1436 define <4 x double> @splat_v4f64(<2 x double> %r) {
1437 ; AVX1-LABEL: splat_v4f64:
1439 ; AVX1-NEXT: vmovddup {{.*#+}} xmm0 = xmm0[0,0]
1440 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
1443 ; AVX2-LABEL: splat_v4f64:
1445 ; AVX2-NEXT: vbroadcastsd %xmm0, %ymm0
1448 ; AVX512VL-LABEL: splat_v4f64:
1449 ; AVX512VL: # %bb.0:
1450 ; AVX512VL-NEXT: vbroadcastsd %xmm0, %ymm0
1451 ; AVX512VL-NEXT: retq
1452 %1 = shufflevector <2 x double> %r, <2 x double> undef, <4 x i32> zeroinitializer
1456 define <4 x i64> @splat_mem_v4i64_from_v2i64(<2 x i64>* %ptr) {
1457 ; ALL-LABEL: splat_mem_v4i64_from_v2i64:
1459 ; ALL-NEXT: vbroadcastsd (%rdi), %ymm0
1461 %v = load <2 x i64>, <2 x i64>* %ptr
1462 %shuffle = shufflevector <2 x i64> %v, <2 x i64> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
1463 ret <4 x i64> %shuffle
1466 define <4 x double> @splat_mem_v4f64_from_v2f64(<2 x double>* %ptr) {
1467 ; ALL-LABEL: splat_mem_v4f64_from_v2f64:
1469 ; ALL-NEXT: vbroadcastsd (%rdi), %ymm0
1471 %v = load <2 x double>, <2 x double>* %ptr
1472 %shuffle = shufflevector <2 x double> %v, <2 x double> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
1473 ret <4 x double> %shuffle
1476 define <4 x i64> @splat128_mem_v4i64_from_v2i64(<2 x i64>* %ptr) {
1477 ; AVX1OR2-LABEL: splat128_mem_v4i64_from_v2i64:
1479 ; AVX1OR2-NEXT: vbroadcastf128 {{.*#+}} ymm0 = mem[0,1,0,1]
1480 ; AVX1OR2-NEXT: retq
1482 ; AVX512VL-LABEL: splat128_mem_v4i64_from_v2i64:
1483 ; AVX512VL: # %bb.0:
1484 ; AVX512VL-NEXT: vbroadcasti128 {{.*#+}} ymm0 = mem[0,1,0,1]
1485 ; AVX512VL-NEXT: retq
1486 %v = load <2 x i64>, <2 x i64>* %ptr
1487 %shuffle = shufflevector <2 x i64> %v, <2 x i64> undef, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
1488 ret <4 x i64> %shuffle
1491 define <4 x double> @splat128_mem_v4f64_from_v2f64(<2 x double>* %ptr) {
1492 ; ALL-LABEL: splat128_mem_v4f64_from_v2f64:
1494 ; ALL-NEXT: vbroadcastf128 {{.*#+}} ymm0 = mem[0,1,0,1]
1496 %v = load <2 x double>, <2 x double>* %ptr
1497 %shuffle = shufflevector <2 x double> %v, <2 x double> undef, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
1498 ret <4 x double> %shuffle
1501 define <4 x double> @broadcast_v4f64_0000_from_v2i64(<2 x i64> %a0) {
1502 ; AVX1-LABEL: broadcast_v4f64_0000_from_v2i64:
1504 ; AVX1-NEXT: vpermilps {{.*#+}} xmm0 = xmm0[0,1,0,1]
1505 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
1508 ; AVX2-LABEL: broadcast_v4f64_0000_from_v2i64:
1510 ; AVX2-NEXT: vbroadcastsd %xmm0, %ymm0
1513 ; AVX512VL-LABEL: broadcast_v4f64_0000_from_v2i64:
1514 ; AVX512VL: # %bb.0:
1515 ; AVX512VL-NEXT: vbroadcastsd %xmm0, %ymm0
1516 ; AVX512VL-NEXT: retq
1517 %1 = shufflevector <2 x i64> %a0, <2 x i64> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
1518 %2 = bitcast <4 x i64> %1 to <4 x double>
1519 %3 = shufflevector <4 x double> %2, <4 x double> undef, <4 x i32> zeroinitializer
1523 define <4 x double> @bitcast_v4f64_0426(<4 x double> %a, <4 x double> %b) {
1524 ; ALL-LABEL: bitcast_v4f64_0426:
1526 ; ALL-NEXT: vunpcklpd {{.*#+}} ymm0 = ymm0[0],ymm1[0],ymm0[2],ymm1[2]
1528 %shuffle64 = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 4, i32 0, i32 6, i32 2>
1529 %bitcast32 = bitcast <4 x double> %shuffle64 to <8 x float>
1530 %shuffle32 = shufflevector <8 x float> %bitcast32, <8 x float> undef, <8 x i32> <i32 3, i32 2, i32 1, i32 0, i32 7, i32 6, i32 5, i32 4>
1531 %bitcast16 = bitcast <8 x float> %shuffle32 to <16 x i16>
1532 %shuffle16 = shufflevector <16 x i16> %bitcast16, <16 x i16> undef, <16 x i32> <i32 2, i32 3, i32 0, i32 1, i32 6, i32 7, i32 4, i32 5, i32 10, i32 11, i32 8, i32 9, i32 14, i32 15, i32 12, i32 13>
1533 %bitcast64 = bitcast <16 x i16> %shuffle16 to <4 x double>
1534 ret <4 x double> %bitcast64
1537 define <4 x i64> @concat_v4i64_0167(<4 x i64> %a0, <4 x i64> %a1) {
1538 ; ALL-LABEL: concat_v4i64_0167:
1540 ; ALL-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1,2,3],ymm1[4,5,6,7]
1542 %a0lo = shufflevector <4 x i64> %a0, <4 x i64> %a1, <2 x i32> <i32 0, i32 1>
1543 %a1hi = shufflevector <4 x i64> %a0, <4 x i64> %a1, <2 x i32> <i32 6, i32 7>
1544 %shuffle64 = shufflevector <2 x i64> %a0lo, <2 x i64> %a1hi, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
1545 ret <4 x i64> %shuffle64
1548 define <4 x i64> @concat_v4i64_0145_bc(<4 x i64> %a0, <4 x i64> %a1) {
1549 ; ALL-LABEL: concat_v4i64_0145_bc:
1551 ; ALL-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
1553 %a0lo = shufflevector <4 x i64> %a0, <4 x i64> %a1, <2 x i32> <i32 0, i32 1>
1554 %a1lo = shufflevector <4 x i64> %a0, <4 x i64> %a1, <2 x i32> <i32 4, i32 5>
1555 %bc0lo = bitcast <2 x i64> %a0lo to <4 x i32>
1556 %bc1lo = bitcast <2 x i64> %a1lo to <4 x i32>
1557 %shuffle32 = shufflevector <4 x i32> %bc0lo, <4 x i32> %bc1lo, <8 x i32> <i32 0, i32 1, i32 2, i32 3, i32 4, i32 5, i32 6, i32 7>
1558 %shuffle64 = bitcast <8 x i32> %shuffle32 to <4 x i64>
1559 ret <4 x i64> %shuffle64
1562 define <4 x i64> @insert_dup_mem_v4i64(i64* %ptr) {
1563 ; ALL-LABEL: insert_dup_mem_v4i64:
1565 ; ALL-NEXT: vbroadcastsd (%rdi), %ymm0
1567 %tmp = load i64, i64* %ptr, align 1
1568 %tmp1 = insertelement <2 x i64> undef, i64 %tmp, i32 0
1569 %tmp2 = shufflevector <2 x i64> %tmp1, <2 x i64> undef, <4 x i32> zeroinitializer
1573 define <4 x i64> @shuffle_v4i64_1234(<4 x i64> %a, <4 x i64> %b) {
1574 ; AVX1-LABEL: shuffle_v4i64_1234:
1576 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm1 = ymm0[2,3],ymm1[0,1]
1577 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1],ymm1[0],ymm0[3],ymm1[2]
1580 ; AVX2-LABEL: shuffle_v4i64_1234:
1582 ; AVX2-NEXT: vperm2i128 {{.*#+}} ymm1 = ymm0[2,3],ymm1[0,1]
1583 ; AVX2-NEXT: vpalignr {{.*#+}} ymm0 = ymm0[8,9,10,11,12,13,14,15],ymm1[0,1,2,3,4,5,6,7],ymm0[24,25,26,27,28,29,30,31],ymm1[16,17,18,19,20,21,22,23]
1586 ; AVX512VL-LABEL: shuffle_v4i64_1234:
1587 ; AVX512VL: # %bb.0:
1588 ; AVX512VL-NEXT: valignq {{.*#+}} ymm0 = ymm0[1,2,3],ymm1[0]
1589 ; AVX512VL-NEXT: retq
1590 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 1, i32 2, i32 3, i32 4>
1591 ret <4 x i64> %shuffle
1594 define <4 x i64> @shuffle_v4i64_1230(<4 x i64> %a) {
1595 ; AVX1-LABEL: shuffle_v4i64_1230:
1597 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm1 = ymm0[2,3,0,1]
1598 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1],ymm1[0],ymm0[3],ymm1[2]
1601 ; AVX2-LABEL: shuffle_v4i64_1230:
1603 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[1,2,3,0]
1606 ; AVX512VL-LABEL: shuffle_v4i64_1230:
1607 ; AVX512VL: # %bb.0:
1608 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[1,2,3,0]
1609 ; AVX512VL-NEXT: retq
1610 %shuffle = shufflevector <4 x i64> %a, <4 x i64> undef, <4 x i32> <i32 1, i32 2, i32 3, i32 0>
1611 ret <4 x i64> %shuffle
1614 define <4 x i64> @shuffle_v4i64_z0z3(<4 x i64> %a, <4 x i64> %b) {
1615 ; AVX1-LABEL: shuffle_v4i64_z0z3:
1617 ; AVX1-NEXT: vpermilpd {{.*#+}} ymm0 = ymm0[0,0,2,3]
1618 ; AVX1-NEXT: vxorpd %xmm1, %xmm1, %xmm1
1619 ; AVX1-NEXT: vblendpd {{.*#+}} ymm0 = ymm1[0],ymm0[1],ymm1[2],ymm0[3]
1622 ; AVX2-SLOW-LABEL: shuffle_v4i64_z0z3:
1623 ; AVX2-SLOW: # %bb.0:
1624 ; AVX2-SLOW-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,2,3]
1625 ; AVX2-SLOW-NEXT: vxorps %xmm1, %xmm1, %xmm1
1626 ; AVX2-SLOW-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3],ymm1[4,5],ymm0[6,7]
1627 ; AVX2-SLOW-NEXT: retq
1629 ; AVX2-FAST-LABEL: shuffle_v4i64_z0z3:
1630 ; AVX2-FAST: # %bb.0:
1631 ; AVX2-FAST-NEXT: vpshufb {{.*#+}} ymm0 = zero,zero,zero,zero,zero,zero,zero,zero,ymm0[0,1,2,3,4,5,6,7],zero,zero,zero,zero,zero,zero,zero,zero,ymm0[24,25,26,27,28,29,30,31]
1632 ; AVX2-FAST-NEXT: retq
1634 ; AVX512VL-SLOW-LABEL: shuffle_v4i64_z0z3:
1635 ; AVX512VL-SLOW: # %bb.0:
1636 ; AVX512VL-SLOW-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,2,3]
1637 ; AVX512VL-SLOW-NEXT: vxorps %xmm1, %xmm1, %xmm1
1638 ; AVX512VL-SLOW-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3],ymm1[4,5],ymm0[6,7]
1639 ; AVX512VL-SLOW-NEXT: retq
1641 ; AVX512VL-FAST-LABEL: shuffle_v4i64_z0z3:
1642 ; AVX512VL-FAST: # %bb.0:
1643 ; AVX512VL-FAST-NEXT: vpshufb {{.*#+}} ymm0 = zero,zero,zero,zero,zero,zero,zero,zero,ymm0[0,1,2,3,4,5,6,7],zero,zero,zero,zero,zero,zero,zero,zero,ymm0[24,25,26,27,28,29,30,31]
1644 ; AVX512VL-FAST-NEXT: retq
1645 %1 = shufflevector <4 x i64> %a, <4 x i64> <i64 0, i64 undef, i64 undef, i64 undef>, <4 x i32> <i32 4, i32 0, i32 4, i32 3>
1649 define <4 x i64> @shuffle_v4i64_1z2z(<4 x i64> %a, <4 x i64> %b) {
1650 ; AVX1-LABEL: shuffle_v4i64_1z2z:
1652 ; AVX1-NEXT: vxorpd %xmm1, %xmm1, %xmm1
1653 ; AVX1-NEXT: vblendpd {{.*#+}} ymm0 = ymm1[0],ymm0[1,2,3]
1654 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
1655 ; AVX1-NEXT: vunpcklpd {{.*#+}} xmm1 = xmm1[0],xmm0[0]
1656 ; AVX1-NEXT: vpermilpd {{.*#+}} xmm0 = xmm0[1,0]
1657 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
1660 ; AVX2-SLOW-LABEL: shuffle_v4i64_1z2z:
1661 ; AVX2-SLOW: # %bb.0:
1662 ; AVX2-SLOW-NEXT: vxorps %xmm1, %xmm1, %xmm1
1663 ; AVX2-SLOW-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3,4,5,6,7]
1664 ; AVX2-SLOW-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[1,0,2,0]
1665 ; AVX2-SLOW-NEXT: retq
1667 ; AVX2-FAST-LABEL: shuffle_v4i64_1z2z:
1668 ; AVX2-FAST: # %bb.0:
1669 ; AVX2-FAST-NEXT: vpshufb {{.*#+}} ymm0 = ymm0[8,9,10,11,12,13,14,15],zero,zero,zero,zero,zero,zero,zero,zero,ymm0[16,17,18,19,20,21,22,23],zero,zero,zero,zero,zero,zero,zero,zero
1670 ; AVX2-FAST-NEXT: retq
1672 ; AVX512VL-SLOW-LABEL: shuffle_v4i64_1z2z:
1673 ; AVX512VL-SLOW: # %bb.0:
1674 ; AVX512VL-SLOW-NEXT: vxorps %xmm1, %xmm1, %xmm1
1675 ; AVX512VL-SLOW-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3,4,5,6,7]
1676 ; AVX512VL-SLOW-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[1,0,2,0]
1677 ; AVX512VL-SLOW-NEXT: retq
1679 ; AVX512VL-FAST-LABEL: shuffle_v4i64_1z2z:
1680 ; AVX512VL-FAST: # %bb.0:
1681 ; AVX512VL-FAST-NEXT: vpshufb {{.*#+}} ymm0 = ymm0[8,9,10,11,12,13,14,15],zero,zero,zero,zero,zero,zero,zero,zero,ymm0[16,17,18,19,20,21,22,23],zero,zero,zero,zero,zero,zero,zero,zero
1682 ; AVX512VL-FAST-NEXT: retq
1683 %1 = shufflevector <4 x i64> %a, <4 x i64> <i64 0, i64 undef, i64 undef, i64 undef>, <4 x i32> <i32 1, i32 4, i32 2, i32 4>
1687 define <4 x double> @add_v4f64_0246_1357(<4 x double> %a, <4 x double> %b) {
1688 ; AVX1-LABEL: add_v4f64_0246_1357:
1689 ; AVX1: # %bb.0: # %entry
1690 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm2 = ymm0[2,3],ymm1[2,3]
1691 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
1692 ; AVX1-NEXT: vunpcklpd {{.*#+}} ymm1 = ymm0[0],ymm2[0],ymm0[2],ymm2[2]
1693 ; AVX1-NEXT: vunpckhpd {{.*#+}} ymm0 = ymm0[1],ymm2[1],ymm0[3],ymm2[3]
1694 ; AVX1-NEXT: vaddpd %ymm0, %ymm1, %ymm0
1697 ; AVX2-LABEL: add_v4f64_0246_1357:
1698 ; AVX2: # %bb.0: # %entry
1699 ; AVX2-NEXT: vunpcklpd {{.*#+}} ymm2 = ymm0[0],ymm1[0],ymm0[2],ymm1[2]
1700 ; AVX2-NEXT: vpermpd {{.*#+}} ymm2 = ymm2[0,2,1,3]
1701 ; AVX2-NEXT: vunpckhpd {{.*#+}} ymm0 = ymm0[1],ymm1[1],ymm0[3],ymm1[3]
1702 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,2,1,3]
1703 ; AVX2-NEXT: vaddpd %ymm0, %ymm2, %ymm0
1706 ; AVX512VL-SLOW-LABEL: add_v4f64_0246_1357:
1707 ; AVX512VL-SLOW: # %bb.0: # %entry
1708 ; AVX512VL-SLOW-NEXT: vunpcklpd {{.*#+}} ymm2 = ymm0[0],ymm1[0],ymm0[2],ymm1[2]
1709 ; AVX512VL-SLOW-NEXT: vpermpd {{.*#+}} ymm2 = ymm2[0,2,1,3]
1710 ; AVX512VL-SLOW-NEXT: vunpckhpd {{.*#+}} ymm0 = ymm0[1],ymm1[1],ymm0[3],ymm1[3]
1711 ; AVX512VL-SLOW-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,2,1,3]
1712 ; AVX512VL-SLOW-NEXT: vaddpd %ymm0, %ymm2, %ymm0
1713 ; AVX512VL-SLOW-NEXT: retq
1715 ; AVX512VL-FAST-LABEL: add_v4f64_0246_1357:
1716 ; AVX512VL-FAST: # %bb.0: # %entry
1717 ; AVX512VL-FAST-NEXT: vmovapd {{.*#+}} ymm2 = [0,2,4,6]
1718 ; AVX512VL-FAST-NEXT: vpermi2pd %ymm1, %ymm0, %ymm2
1719 ; AVX512VL-FAST-NEXT: vmovapd {{.*#+}} ymm3 = [1,3,5,7]
1720 ; AVX512VL-FAST-NEXT: vpermi2pd %ymm1, %ymm0, %ymm3
1721 ; AVX512VL-FAST-NEXT: vaddpd %ymm3, %ymm2, %ymm0
1722 ; AVX512VL-FAST-NEXT: retq
1724 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
1725 %shuffle1 = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
1726 %add = fadd <4 x double> %shuffle, %shuffle1
1727 ret <4 x double> %add
1730 define <4 x double> @add_v4f64_4602_5713(<4 x double> %a, <4 x double> %b) {
1731 ; AVX1-LABEL: add_v4f64_4602_5713:
1732 ; AVX1: # %bb.0: # %entry
1733 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm2 = ymm1[2,3],ymm0[2,3]
1734 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0
1735 ; AVX1-NEXT: vunpcklpd {{.*#+}} ymm1 = ymm0[0],ymm2[0],ymm0[2],ymm2[2]
1736 ; AVX1-NEXT: vunpckhpd {{.*#+}} ymm0 = ymm0[1],ymm2[1],ymm0[3],ymm2[3]
1737 ; AVX1-NEXT: vaddpd %ymm0, %ymm1, %ymm0
1740 ; AVX2-LABEL: add_v4f64_4602_5713:
1741 ; AVX2: # %bb.0: # %entry
1742 ; AVX2-NEXT: vunpcklpd {{.*#+}} ymm2 = ymm1[0],ymm0[0],ymm1[2],ymm0[2]
1743 ; AVX2-NEXT: vpermpd {{.*#+}} ymm2 = ymm2[0,2,1,3]
1744 ; AVX2-NEXT: vunpckhpd {{.*#+}} ymm0 = ymm1[1],ymm0[1],ymm1[3],ymm0[3]
1745 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,2,1,3]
1746 ; AVX2-NEXT: vaddpd %ymm0, %ymm2, %ymm0
1749 ; AVX512VL-SLOW-LABEL: add_v4f64_4602_5713:
1750 ; AVX512VL-SLOW: # %bb.0: # %entry
1751 ; AVX512VL-SLOW-NEXT: vunpcklpd {{.*#+}} ymm2 = ymm1[0],ymm0[0],ymm1[2],ymm0[2]
1752 ; AVX512VL-SLOW-NEXT: vpermpd {{.*#+}} ymm2 = ymm2[0,2,1,3]
1753 ; AVX512VL-SLOW-NEXT: vunpckhpd {{.*#+}} ymm0 = ymm1[1],ymm0[1],ymm1[3],ymm0[3]
1754 ; AVX512VL-SLOW-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,2,1,3]
1755 ; AVX512VL-SLOW-NEXT: vaddpd %ymm0, %ymm2, %ymm0
1756 ; AVX512VL-SLOW-NEXT: retq
1758 ; AVX512VL-FAST-LABEL: add_v4f64_4602_5713:
1759 ; AVX512VL-FAST: # %bb.0: # %entry
1760 ; AVX512VL-FAST-NEXT: vmovapd {{.*#+}} ymm2 = [0,2,4,6]
1761 ; AVX512VL-FAST-NEXT: vpermi2pd %ymm0, %ymm1, %ymm2
1762 ; AVX512VL-FAST-NEXT: vmovapd {{.*#+}} ymm3 = [1,3,5,7]
1763 ; AVX512VL-FAST-NEXT: vpermi2pd %ymm0, %ymm1, %ymm3
1764 ; AVX512VL-FAST-NEXT: vaddpd %ymm3, %ymm2, %ymm0
1765 ; AVX512VL-FAST-NEXT: retq
1767 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 4, i32 6, i32 0, i32 2>
1768 %shuffle1 = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 5, i32 7, i32 1, i32 3>
1769 %add = fadd <4 x double> %shuffle, %shuffle1
1770 ret <4 x double> %add
1773 define <4 x i64> @add_v4i64_0246_1357(<4 x i64> %a, <4 x i64> %b) {
1774 ; AVX1-LABEL: add_v4i64_0246_1357:
1775 ; AVX1: # %bb.0: # %entry
1776 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm2 = ymm0[2,3],ymm1[2,3]
1777 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
1778 ; AVX1-NEXT: vunpcklpd {{.*#+}} ymm1 = ymm0[0],ymm2[0],ymm0[2],ymm2[2]
1779 ; AVX1-NEXT: vunpckhpd {{.*#+}} ymm0 = ymm0[1],ymm2[1],ymm0[3],ymm2[3]
1780 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm2
1781 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm3
1782 ; AVX1-NEXT: vpaddq %xmm2, %xmm3, %xmm2
1783 ; AVX1-NEXT: vpaddq %xmm0, %xmm1, %xmm0
1784 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
1787 ; AVX2-LABEL: add_v4i64_0246_1357:
1788 ; AVX2: # %bb.0: # %entry
1789 ; AVX2-NEXT: vpunpcklqdq {{.*#+}} ymm2 = ymm0[0],ymm1[0],ymm0[2],ymm1[2]
1790 ; AVX2-NEXT: vpermq {{.*#+}} ymm2 = ymm2[0,2,1,3]
1791 ; AVX2-NEXT: vpunpckhqdq {{.*#+}} ymm0 = ymm0[1],ymm1[1],ymm0[3],ymm1[3]
1792 ; AVX2-NEXT: vpermq {{.*#+}} ymm0 = ymm0[0,2,1,3]
1793 ; AVX2-NEXT: vpaddq %ymm0, %ymm2, %ymm0
1796 ; AVX512VL-SLOW-LABEL: add_v4i64_0246_1357:
1797 ; AVX512VL-SLOW: # %bb.0: # %entry
1798 ; AVX512VL-SLOW-NEXT: vpunpcklqdq {{.*#+}} ymm2 = ymm0[0],ymm1[0],ymm0[2],ymm1[2]
1799 ; AVX512VL-SLOW-NEXT: vpermq {{.*#+}} ymm2 = ymm2[0,2,1,3]
1800 ; AVX512VL-SLOW-NEXT: vpunpckhqdq {{.*#+}} ymm0 = ymm0[1],ymm1[1],ymm0[3],ymm1[3]
1801 ; AVX512VL-SLOW-NEXT: vpermq {{.*#+}} ymm0 = ymm0[0,2,1,3]
1802 ; AVX512VL-SLOW-NEXT: vpaddq %ymm0, %ymm2, %ymm0
1803 ; AVX512VL-SLOW-NEXT: retq
1805 ; AVX512VL-FAST-LABEL: add_v4i64_0246_1357:
1806 ; AVX512VL-FAST: # %bb.0: # %entry
1807 ; AVX512VL-FAST-NEXT: vmovdqa {{.*#+}} ymm2 = [0,2,4,6]
1808 ; AVX512VL-FAST-NEXT: vpermi2q %ymm1, %ymm0, %ymm2
1809 ; AVX512VL-FAST-NEXT: vmovdqa {{.*#+}} ymm3 = [1,3,5,7]
1810 ; AVX512VL-FAST-NEXT: vpermi2q %ymm1, %ymm0, %ymm3
1811 ; AVX512VL-FAST-NEXT: vpaddq %ymm3, %ymm2, %ymm0
1812 ; AVX512VL-FAST-NEXT: retq
1814 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
1815 %shuffle1 = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
1816 %add = add <4 x i64> %shuffle, %shuffle1
1820 define <4 x i64> @add_v4i64_4602_5713(<4 x i64> %a, <4 x i64> %b) {
1821 ; AVX1-LABEL: add_v4i64_4602_5713:
1822 ; AVX1: # %bb.0: # %entry
1823 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm2 = ymm1[2,3],ymm0[2,3]
1824 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0
1825 ; AVX1-NEXT: vunpcklpd {{.*#+}} ymm1 = ymm0[0],ymm2[0],ymm0[2],ymm2[2]
1826 ; AVX1-NEXT: vunpckhpd {{.*#+}} ymm0 = ymm0[1],ymm2[1],ymm0[3],ymm2[3]
1827 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm2
1828 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm3
1829 ; AVX1-NEXT: vpaddq %xmm2, %xmm3, %xmm2
1830 ; AVX1-NEXT: vpaddq %xmm0, %xmm1, %xmm0
1831 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
1834 ; AVX2-LABEL: add_v4i64_4602_5713:
1835 ; AVX2: # %bb.0: # %entry
1836 ; AVX2-NEXT: vpunpcklqdq {{.*#+}} ymm2 = ymm1[0],ymm0[0],ymm1[2],ymm0[2]
1837 ; AVX2-NEXT: vpermq {{.*#+}} ymm2 = ymm2[0,2,1,3]
1838 ; AVX2-NEXT: vpunpckhqdq {{.*#+}} ymm0 = ymm1[1],ymm0[1],ymm1[3],ymm0[3]
1839 ; AVX2-NEXT: vpermq {{.*#+}} ymm0 = ymm0[0,2,1,3]
1840 ; AVX2-NEXT: vpaddq %ymm0, %ymm2, %ymm0
1843 ; AVX512VL-SLOW-LABEL: add_v4i64_4602_5713:
1844 ; AVX512VL-SLOW: # %bb.0: # %entry
1845 ; AVX512VL-SLOW-NEXT: vpunpcklqdq {{.*#+}} ymm2 = ymm1[0],ymm0[0],ymm1[2],ymm0[2]
1846 ; AVX512VL-SLOW-NEXT: vpermq {{.*#+}} ymm2 = ymm2[0,2,1,3]
1847 ; AVX512VL-SLOW-NEXT: vpunpckhqdq {{.*#+}} ymm0 = ymm1[1],ymm0[1],ymm1[3],ymm0[3]
1848 ; AVX512VL-SLOW-NEXT: vpermq {{.*#+}} ymm0 = ymm0[0,2,1,3]
1849 ; AVX512VL-SLOW-NEXT: vpaddq %ymm0, %ymm2, %ymm0
1850 ; AVX512VL-SLOW-NEXT: retq
1852 ; AVX512VL-FAST-LABEL: add_v4i64_4602_5713:
1853 ; AVX512VL-FAST: # %bb.0: # %entry
1854 ; AVX512VL-FAST-NEXT: vmovdqa {{.*#+}} ymm2 = [0,2,4,6]
1855 ; AVX512VL-FAST-NEXT: vpermi2q %ymm0, %ymm1, %ymm2
1856 ; AVX512VL-FAST-NEXT: vmovdqa {{.*#+}} ymm3 = [1,3,5,7]
1857 ; AVX512VL-FAST-NEXT: vpermi2q %ymm0, %ymm1, %ymm3
1858 ; AVX512VL-FAST-NEXT: vpaddq %ymm3, %ymm2, %ymm0
1859 ; AVX512VL-FAST-NEXT: retq
1861 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 4, i32 6, i32 0, i32 2>
1862 %shuffle1 = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 5, i32 7, i32 1, i32 3>
1863 %add = add <4 x i64> %shuffle, %shuffle1
1867 define <4 x double> @shuffle_v4f64_0zzz_optsize(<4 x double> %a) optsize {
1868 ; ALL-LABEL: shuffle_v4f64_0zzz_optsize:
1870 ; ALL-NEXT: vxorpd %xmm1, %xmm1, %xmm1
1871 ; ALL-NEXT: vmovsd {{.*#+}} xmm0 = xmm0[0],xmm1[1]
1873 %b = shufflevector <4 x double> %a, <4 x double> zeroinitializer, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
1877 define <4 x i64> @shuffle_v4i64_0zzz_optsize(<4 x i64> %a) optsize {
1878 ; ALL-LABEL: shuffle_v4i64_0zzz_optsize:
1880 ; ALL-NEXT: vxorpd %xmm1, %xmm1, %xmm1
1881 ; ALL-NEXT: vmovsd {{.*#+}} xmm0 = xmm0[0],xmm1[1]
1883 %b = shufflevector <4 x i64> %a, <4 x i64> zeroinitializer, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
1887 define <8 x float> @shuffle_v8f32_0zzzzzzz_optsize(<8 x float> %a) optsize {
1888 ; ALL-LABEL: shuffle_v8f32_0zzzzzzz_optsize:
1890 ; ALL-NEXT: vxorps %xmm1, %xmm1, %xmm1
1891 ; ALL-NEXT: vmovss {{.*#+}} xmm0 = xmm0[0],xmm1[1,2,3]
1893 %b = shufflevector <8 x float> %a, <8 x float> zeroinitializer, <8 x i32> <i32 0, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
1897 define <8 x i32> @shuffle_v8i32_0zzzzzzz_optsize(<8 x i32> %a) optsize {
1898 ; ALL-LABEL: shuffle_v8i32_0zzzzzzz_optsize:
1900 ; ALL-NEXT: vxorps %xmm1, %xmm1, %xmm1
1901 ; ALL-NEXT: vmovss {{.*#+}} xmm0 = xmm0[0],xmm1[1,2,3]
1903 %b = shufflevector <8 x i32> %a, <8 x i32> zeroinitializer, <8 x i32> <i32 0, i32 9, i32 10, i32 11, i32 12, i32 13, i32 14, i32 15>
1907 define <4 x i64> @unpckh_v4i64(<4 x i64> %x, <4 x i64> %y) {
1908 ; ALL-LABEL: unpckh_v4i64:
1910 ; ALL-NEXT: vextractf128 $1, %ymm1, %xmm1
1911 ; ALL-NEXT: vunpckhpd {{.*#+}} xmm0 = xmm0[1],xmm1[1]
1913 %unpckh = shufflevector <4 x i64> %x, <4 x i64> %y, <4 x i32> <i32 1, i32 7, i32 undef, i32 undef>
1914 ret <4 x i64> %unpckh
1917 define <4 x double> @unpckh_v4f64(<4 x double> %x, <4 x double> %y) {
1918 ; ALL-LABEL: unpckh_v4f64:
1920 ; ALL-NEXT: vextractf128 $1, %ymm1, %xmm1
1921 ; ALL-NEXT: vunpckhpd {{.*#+}} xmm0 = xmm0[1],xmm1[1]
1923 %unpckh = shufflevector <4 x double> %x, <4 x double> %y, <4 x i32> <i32 1, i32 7, i32 undef, i32 undef>
1924 ret <4 x double> %unpckh