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-crosslane-shuffle,+fast-variable-perlane-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=+avx2,+fast-variable-perlane-shuffle | FileCheck %s --check-prefix=ALL --check-prefix=AVX1OR2 --check-prefix=AVX2 --check-prefix=AVX2-FAST
6 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512vl | FileCheck %s --check-prefix=ALL --check-prefix=AVX512VL --check-prefix=AVX512VL-SLOW
7 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512vl,+fast-variable-crosslane-shuffle,+fast-variable-perlane-shuffle | FileCheck %s --check-prefix=ALL --check-prefix=AVX512VL --check-prefix=AVX512VL-FAST --check-prefix=AVX512VL-FAST-ALL
8 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512vl,+fast-variable-perlane-shuffle | FileCheck %s --check-prefix=ALL --check-prefix=AVX512VL --check-prefix=AVX512VL-FAST --check-prefix=AVX512VL-FAST-PERLANE
10 define <4 x double> @shuffle_v4f64_0000(<4 x double> %a, <4 x double> %b) {
11 ; AVX1-LABEL: shuffle_v4f64_0000:
13 ; AVX1-NEXT: vmovddup {{.*#+}} xmm0 = xmm0[0,0]
14 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
17 ; AVX2-LABEL: shuffle_v4f64_0000:
19 ; AVX2-NEXT: vbroadcastsd %xmm0, %ymm0
22 ; AVX512VL-LABEL: shuffle_v4f64_0000:
24 ; AVX512VL-NEXT: vbroadcastsd %xmm0, %ymm0
26 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
27 ret <4 x double> %shuffle
30 define <4 x double> @shuffle_v4f64_0001(<4 x double> %a, <4 x double> %b) {
31 ; AVX1-LABEL: shuffle_v4f64_0001:
33 ; AVX1-NEXT: vmovddup {{.*#+}} xmm1 = xmm0[0,0]
34 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0
37 ; AVX2-LABEL: shuffle_v4f64_0001:
39 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,0,1]
42 ; AVX512VL-LABEL: shuffle_v4f64_0001:
44 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,0,1]
46 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 0, i32 0, i32 0, i32 1>
47 ret <4 x double> %shuffle
50 define <4 x double> @shuffle_v4f64_0020(<4 x double> %a, <4 x double> %b) {
51 ; AVX1-LABEL: shuffle_v4f64_0020:
53 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm1
54 ; AVX1-NEXT: vunpcklpd {{.*#+}} ymm0 = ymm0[0],ymm1[0],ymm0[2],ymm1[2]
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: vinsertf128 $1, %xmm0, %ymm0, %ymm0
75 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[0],ymm1[1],ymm0[2],ymm1[2]
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: vshufpd {{.*#+}} 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: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3,0,1]
115 ; AVX1-NEXT: vmovddup {{.*#+}} ymm0 = ymm0[0,0,2,2]
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: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3,2,3]
135 ; AVX1-NEXT: vmovddup {{.*#+}} ymm0 = ymm0[0,0,2,2]
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: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3,2,3]
155 ; AVX1-NEXT: vmovddup {{.*#+}} ymm0 = ymm0[0,0,2,2]
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: vshufpd {{.*#+}} 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: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3,2,3]
198 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1],ymm1[1],ymm0[3],ymm1[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: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3,0,1]
218 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1,0,3,2]
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: vshufpd {{.*#+}} 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(ptr %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>, ptr %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: vshufpd {{.*#+}} 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: vshufpd {{.*#+}} 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: vshufpd {{.*#+}} 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: vshufpd {{.*#+}} 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,2,3]
303 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
304 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[0],ymm1[0],ymm0[3],ymm1[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 ; AVX1OR2-LABEL: shuffle_v4f64_0423:
323 ; AVX1OR2-NEXT: vmovddup {{.*#+}} xmm1 = xmm1[0,0]
324 ; AVX1OR2-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1],ymm1[2,3],ymm0[4,5,6,7]
327 ; AVX512VL-SLOW-LABEL: shuffle_v4f64_0423:
328 ; AVX512VL-SLOW: # %bb.0:
329 ; AVX512VL-SLOW-NEXT: vmovddup {{.*#+}} xmm1 = xmm1[0,0]
330 ; AVX512VL-SLOW-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1],ymm1[2,3],ymm0[4,5,6,7]
331 ; AVX512VL-SLOW-NEXT: retq
333 ; AVX512VL-FAST-LABEL: shuffle_v4f64_0423:
334 ; AVX512VL-FAST: # %bb.0:
335 ; AVX512VL-FAST-NEXT: vmovapd {{.*#+}} ymm2 = [0,4,2,3]
336 ; AVX512VL-FAST-NEXT: vpermt2pd %ymm1, %ymm2, %ymm0
337 ; AVX512VL-FAST-NEXT: retq
338 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 0, i32 4, i32 2, i32 3>
339 ret <4 x double> %shuffle
342 define <4 x double> @shuffle_v4f64_0462(<4 x double> %a, <4 x double> %b) {
343 ; AVX1OR2-LABEL: shuffle_v4f64_0462:
345 ; AVX1OR2-NEXT: vblendps {{.*#+}} ymm2 = ymm1[0,1,2,3],ymm0[4,5,6,7]
346 ; AVX1OR2-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1,2,3],ymm1[4,5,6,7]
347 ; AVX1OR2-NEXT: vunpcklpd {{.*#+}} ymm0 = ymm0[0],ymm2[0],ymm0[2],ymm2[2]
350 ; AVX512VL-LABEL: shuffle_v4f64_0462:
352 ; AVX512VL-NEXT: vmovapd {{.*#+}} ymm2 = [0,4,6,2]
353 ; AVX512VL-NEXT: vpermt2pd %ymm1, %ymm2, %ymm0
354 ; AVX512VL-NEXT: retq
355 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 0, i32 4, i32 6, i32 2>
356 ret <4 x double> %shuffle
359 define <4 x double> @shuffle_v4f64_0426(<4 x double> %a, <4 x double> %b) {
360 ; ALL-LABEL: shuffle_v4f64_0426:
362 ; ALL-NEXT: vunpcklpd {{.*#+}} ymm0 = ymm0[0],ymm1[0],ymm0[2],ymm1[2]
364 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 0, i32 4, i32 2, i32 6>
365 ret <4 x double> %shuffle
368 define <4 x double> @shuffle_v4f64_1537(<4 x double> %a, <4 x double> %b) {
369 ; ALL-LABEL: shuffle_v4f64_1537:
371 ; ALL-NEXT: vunpckhpd {{.*#+}} ymm0 = ymm0[1],ymm1[1],ymm0[3],ymm1[3]
373 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 1, i32 5, i32 3, i32 7>
374 ret <4 x double> %shuffle
377 define <4 x double> @shuffle_v4f64_4062(<4 x double> %a, <4 x double> %b) {
378 ; ALL-LABEL: shuffle_v4f64_4062:
380 ; ALL-NEXT: vunpcklpd {{.*#+}} ymm0 = ymm1[0],ymm0[0],ymm1[2],ymm0[2]
382 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 4, i32 0, i32 6, i32 2>
383 ret <4 x double> %shuffle
386 define <4 x double> @shuffle_v4f64_5173(<4 x double> %a, <4 x double> %b) {
387 ; ALL-LABEL: shuffle_v4f64_5173:
389 ; ALL-NEXT: vunpckhpd {{.*#+}} ymm0 = ymm1[1],ymm0[1],ymm1[3],ymm0[3]
391 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 5, i32 1, i32 7, i32 3>
392 ret <4 x double> %shuffle
395 define <4 x double> @shuffle_v4f64_5163(<4 x double> %a, <4 x double> %b) {
396 ; ALL-LABEL: shuffle_v4f64_5163:
398 ; ALL-NEXT: vshufpd {{.*#+}} ymm0 = ymm1[1],ymm0[1],ymm1[2],ymm0[3]
400 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 5, i32 1, i32 6, i32 3>
401 ret <4 x double> %shuffle
404 define <4 x double> @shuffle_v4f64_0527(<4 x double> %a, <4 x double> %b) {
405 ; ALL-LABEL: shuffle_v4f64_0527:
407 ; ALL-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1],ymm1[2,3],ymm0[4,5],ymm1[6,7]
409 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 0, i32 5, i32 2, i32 7>
410 ret <4 x double> %shuffle
413 define <4 x double> @shuffle_v4f64_4163(<4 x double> %a, <4 x double> %b) {
414 ; ALL-LABEL: shuffle_v4f64_4163:
416 ; ALL-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3],ymm1[4,5],ymm0[6,7]
418 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 4, i32 1, i32 6, i32 3>
419 ret <4 x double> %shuffle
422 define <4 x double> @shuffle_v4f64_0145(<4 x double> %a, <4 x double> %b) {
423 ; ALL-LABEL: shuffle_v4f64_0145:
425 ; ALL-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
427 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 0, i32 1, i32 4, i32 5>
428 ret <4 x double> %shuffle
431 define <4 x double> @shuffle_v4f64_4501(<4 x double> %a, <4 x double> %b) {
432 ; ALL-LABEL: shuffle_v4f64_4501:
434 ; ALL-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0
436 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 4, i32 5, i32 0, i32 1>
437 ret <4 x double> %shuffle
440 define <4 x double> @shuffle_v4f64_0167(<4 x double> %a, <4 x double> %b) {
441 ; ALL-LABEL: shuffle_v4f64_0167:
443 ; ALL-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1,2,3],ymm1[4,5,6,7]
445 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 0, i32 1, i32 6, i32 7>
446 ret <4 x double> %shuffle
449 define <4 x double> @shuffle_v4f64_1054(<4 x double> %a, <4 x double> %b) {
450 ; AVX1OR2-LABEL: shuffle_v4f64_1054:
452 ; AVX1OR2-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
453 ; AVX1OR2-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1,0,3,2]
456 ; AVX512VL-SLOW-LABEL: shuffle_v4f64_1054:
457 ; AVX512VL-SLOW: # %bb.0:
458 ; AVX512VL-SLOW-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
459 ; AVX512VL-SLOW-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1,0,3,2]
460 ; AVX512VL-SLOW-NEXT: retq
462 ; AVX512VL-FAST-ALL-LABEL: shuffle_v4f64_1054:
463 ; AVX512VL-FAST-ALL: # %bb.0:
464 ; AVX512VL-FAST-ALL-NEXT: vmovapd {{.*#+}} ymm2 = [1,0,5,4]
465 ; AVX512VL-FAST-ALL-NEXT: vpermt2pd %ymm1, %ymm2, %ymm0
466 ; AVX512VL-FAST-ALL-NEXT: retq
468 ; AVX512VL-FAST-PERLANE-LABEL: shuffle_v4f64_1054:
469 ; AVX512VL-FAST-PERLANE: # %bb.0:
470 ; AVX512VL-FAST-PERLANE-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
471 ; AVX512VL-FAST-PERLANE-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1,0,3,2]
472 ; AVX512VL-FAST-PERLANE-NEXT: retq
473 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 1, i32 0, i32 5, i32 4>
474 ret <4 x double> %shuffle
477 define <4 x double> @shuffle_v4f64_3254(<4 x double> %a, <4 x double> %b) {
478 ; AVX1OR2-LABEL: shuffle_v4f64_3254:
480 ; AVX1OR2-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3],ymm1[0,1]
481 ; AVX1OR2-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1,0,3,2]
484 ; AVX512VL-SLOW-LABEL: shuffle_v4f64_3254:
485 ; AVX512VL-SLOW: # %bb.0:
486 ; AVX512VL-SLOW-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3],ymm1[0,1]
487 ; AVX512VL-SLOW-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1,0,3,2]
488 ; AVX512VL-SLOW-NEXT: retq
490 ; AVX512VL-FAST-ALL-LABEL: shuffle_v4f64_3254:
491 ; AVX512VL-FAST-ALL: # %bb.0:
492 ; AVX512VL-FAST-ALL-NEXT: vmovapd {{.*#+}} ymm2 = [3,2,5,4]
493 ; AVX512VL-FAST-ALL-NEXT: vpermt2pd %ymm1, %ymm2, %ymm0
494 ; AVX512VL-FAST-ALL-NEXT: retq
496 ; AVX512VL-FAST-PERLANE-LABEL: shuffle_v4f64_3254:
497 ; AVX512VL-FAST-PERLANE: # %bb.0:
498 ; AVX512VL-FAST-PERLANE-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3],ymm1[0,1]
499 ; AVX512VL-FAST-PERLANE-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1,0,3,2]
500 ; AVX512VL-FAST-PERLANE-NEXT: retq
501 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 3, i32 2, i32 5, i32 4>
502 ret <4 x double> %shuffle
505 define <4 x double> @shuffle_v4f64_3276(<4 x double> %a, <4 x double> %b) {
506 ; AVX1OR2-LABEL: shuffle_v4f64_3276:
508 ; AVX1OR2-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3],ymm1[2,3]
509 ; AVX1OR2-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1,0,3,2]
512 ; AVX512VL-SLOW-LABEL: shuffle_v4f64_3276:
513 ; AVX512VL-SLOW: # %bb.0:
514 ; AVX512VL-SLOW-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3],ymm1[2,3]
515 ; AVX512VL-SLOW-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1,0,3,2]
516 ; AVX512VL-SLOW-NEXT: retq
518 ; AVX512VL-FAST-ALL-LABEL: shuffle_v4f64_3276:
519 ; AVX512VL-FAST-ALL: # %bb.0:
520 ; AVX512VL-FAST-ALL-NEXT: vmovapd {{.*#+}} ymm2 = [3,2,7,6]
521 ; AVX512VL-FAST-ALL-NEXT: vpermt2pd %ymm1, %ymm2, %ymm0
522 ; AVX512VL-FAST-ALL-NEXT: retq
524 ; AVX512VL-FAST-PERLANE-LABEL: shuffle_v4f64_3276:
525 ; AVX512VL-FAST-PERLANE: # %bb.0:
526 ; AVX512VL-FAST-PERLANE-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3],ymm1[2,3]
527 ; AVX512VL-FAST-PERLANE-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1,0,3,2]
528 ; AVX512VL-FAST-PERLANE-NEXT: retq
529 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 3, i32 2, i32 7, i32 6>
530 ret <4 x double> %shuffle
533 define <4 x double> @shuffle_v4f64_1076(<4 x double> %a, <4 x double> %b) {
534 ; AVX1OR2-LABEL: shuffle_v4f64_1076:
536 ; AVX1OR2-NEXT: vblendpd {{.*#+}} ymm0 = ymm0[0,1],ymm1[2,3]
537 ; AVX1OR2-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1,0,3,2]
540 ; AVX512VL-SLOW-LABEL: shuffle_v4f64_1076:
541 ; AVX512VL-SLOW: # %bb.0:
542 ; AVX512VL-SLOW-NEXT: vblendpd {{.*#+}} ymm0 = ymm0[0,1],ymm1[2,3]
543 ; AVX512VL-SLOW-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1,0,3,2]
544 ; AVX512VL-SLOW-NEXT: retq
546 ; AVX512VL-FAST-LABEL: shuffle_v4f64_1076:
547 ; AVX512VL-FAST: # %bb.0:
548 ; AVX512VL-FAST-NEXT: vmovapd {{.*#+}} ymm2 = [1,0,7,6]
549 ; AVX512VL-FAST-NEXT: vpermt2pd %ymm1, %ymm2, %ymm0
550 ; AVX512VL-FAST-NEXT: retq
551 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 1, i32 0, i32 7, i32 6>
552 ret <4 x double> %shuffle
555 define <4 x double> @shuffle_v4f64_0415(<4 x double> %a, <4 x double> %b) {
556 ; AVX1-LABEL: shuffle_v4f64_0415:
558 ; AVX1-NEXT: vunpckhpd {{.*#+}} xmm2 = xmm0[1],xmm1[1]
559 ; AVX1-NEXT: vmovlhps {{.*#+}} xmm0 = xmm0[0],xmm1[0]
560 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
563 ; AVX2-LABEL: shuffle_v4f64_0415:
565 ; AVX2-NEXT: vpermpd {{.*#+}} ymm1 = ymm1[0,0,2,1]
566 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,1,1,3]
567 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1],ymm1[2,3],ymm0[4,5],ymm1[6,7]
570 ; AVX512VL-LABEL: shuffle_v4f64_0415:
572 ; AVX512VL-NEXT: vmovapd {{.*#+}} ymm2 = [0,4,1,5]
573 ; AVX512VL-NEXT: vpermt2pd %ymm1, %ymm2, %ymm0
574 ; AVX512VL-NEXT: retq
575 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 0, i32 4, i32 1, i32 5>
576 ret <4 x double> %shuffle
579 define <4 x double> @shuffle_v4f64_2741(<4 x double> %a, <4 x double> %b) {
580 ; AVX1OR2-LABEL: shuffle_v4f64_2741:
582 ; AVX1OR2-NEXT: vperm2f128 {{.*#+}} ymm2 = ymm1[2,3],ymm0[0,1]
583 ; AVX1OR2-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3],ymm1[0,1]
584 ; AVX1OR2-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1],ymm2[2,3],ymm0[4,5],ymm2[6,7]
587 ; AVX512VL-LABEL: shuffle_v4f64_2741:
589 ; AVX512VL-NEXT: vmovapd {{.*#+}} ymm2 = [2,7,4,1]
590 ; AVX512VL-NEXT: vpermt2pd %ymm1, %ymm2, %ymm0
591 ; AVX512VL-NEXT: retq
592 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 2, i32 7, i32 4, i32 1>
593 ret <4 x double> %shuffle
596 define <4 x double> @shuffle_v4f64_u062(<4 x double> %a, <4 x double> %b) {
597 ; ALL-LABEL: shuffle_v4f64_u062:
599 ; ALL-NEXT: vunpcklpd {{.*#+}} ymm0 = ymm1[0],ymm0[0],ymm1[2],ymm0[2]
601 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 undef, i32 0, i32 6, i32 2>
602 ret <4 x double> %shuffle
605 define <4 x double> @shuffle_v4f64_15uu(<4 x double> %a, <4 x double> %b) {
606 ; ALL-LABEL: shuffle_v4f64_15uu:
608 ; ALL-NEXT: vunpckhpd {{.*#+}} xmm0 = xmm0[1],xmm1[1]
610 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 1, i32 5, i32 undef, i32 undef>
611 ret <4 x double> %shuffle
614 define <4 x double> @shuffle_v4f64_11uu(<4 x double> %a, <4 x double> %b) {
615 ; ALL-LABEL: shuffle_v4f64_11uu:
617 ; ALL-NEXT: vshufpd {{.*#+}} xmm0 = xmm0[1,1]
619 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 1, i32 1, i32 undef, i32 undef>
620 ret <4 x double> %shuffle
623 define <4 x double> @shuffle_v4f64_22uu(<4 x double> %a, <4 x double> %b) {
624 ; AVX1-LABEL: shuffle_v4f64_22uu:
626 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm0
627 ; AVX1-NEXT: vmovddup {{.*#+}} xmm0 = xmm0[0,0]
630 ; AVX2-LABEL: shuffle_v4f64_22uu:
632 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,2,2,2]
635 ; AVX512VL-LABEL: shuffle_v4f64_22uu:
637 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,2,2,2]
638 ; AVX512VL-NEXT: retq
639 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 2, i32 2, i32 undef, i32 undef>
640 ret <4 x double> %shuffle
643 define <4 x double> @shuffle_v4f64_3333(<4 x double> %a, <4 x double> %b) {
644 ; AVX1-LABEL: shuffle_v4f64_3333:
646 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3,2,3]
647 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1,1,3,3]
650 ; AVX2-LABEL: shuffle_v4f64_3333:
652 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[3,3,3,3]
655 ; AVX512VL-LABEL: shuffle_v4f64_3333:
657 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[3,3,3,3]
658 ; AVX512VL-NEXT: retq
659 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 3, i32 3, i32 3, i32 3>
660 ret <4 x double> %shuffle
663 define <4 x double> @shuffle_v4f64_0456(<4 x double> %a, <4 x double> %b) {
664 ; AVX1OR2-LABEL: shuffle_v4f64_0456:
666 ; AVX1OR2-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
667 ; AVX1OR2-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[0],ymm1[0],ymm0[3],ymm1[2]
670 ; AVX512VL-SLOW-LABEL: shuffle_v4f64_0456:
671 ; AVX512VL-SLOW: # %bb.0:
672 ; AVX512VL-SLOW-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
673 ; AVX512VL-SLOW-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[0],ymm1[0],ymm0[3],ymm1[2]
674 ; AVX512VL-SLOW-NEXT: retq
676 ; AVX512VL-FAST-ALL-LABEL: shuffle_v4f64_0456:
677 ; AVX512VL-FAST-ALL: # %bb.0:
678 ; AVX512VL-FAST-ALL-NEXT: vmovapd {{.*#+}} ymm2 = [4,0,1,2]
679 ; AVX512VL-FAST-ALL-NEXT: vpermi2pd %ymm0, %ymm1, %ymm2
680 ; AVX512VL-FAST-ALL-NEXT: vmovapd %ymm2, %ymm0
681 ; AVX512VL-FAST-ALL-NEXT: retq
683 ; AVX512VL-FAST-PERLANE-LABEL: shuffle_v4f64_0456:
684 ; AVX512VL-FAST-PERLANE: # %bb.0:
685 ; AVX512VL-FAST-PERLANE-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
686 ; AVX512VL-FAST-PERLANE-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[0],ymm1[0],ymm0[3],ymm1[2]
687 ; AVX512VL-FAST-PERLANE-NEXT: retq
688 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 0, i32 4, i32 5, i32 6>
689 ret <4 x double> %shuffle
693 define <4 x double> @shuffle_v4f64_0437(<4 x double> %a, <4 x double> %b) {
694 ; ALL-LABEL: shuffle_v4f64_0437:
696 ; ALL-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[0],ymm1[0],ymm0[3],ymm1[3]
698 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 0, i32 4, i32 3, i32 7>
699 ret <4 x double> %shuffle
703 define <4 x double> @shuffle_v4f64_2303(<4 x double> %a) {
704 ; AVX1-LABEL: shuffle_v4f64_2303:
706 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm1 = ymm0[2,3,2,3]
707 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3,0,1]
708 ; AVX1-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1],ymm1[2,3],ymm0[4,5],ymm1[6,7]
711 ; AVX2-LABEL: shuffle_v4f64_2303:
713 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,3,0,3]
716 ; AVX512VL-LABEL: shuffle_v4f64_2303:
718 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,3,0,3]
719 ; AVX512VL-NEXT: retq
720 %shuffle = shufflevector <4 x double> %a, <4 x double> poison, <4 x i32> <i32 2, i32 3, i32 0, i32 3>
721 ret <4 x double> %shuffle
724 define <4 x double> @shuffle_v4f64_0z3z(<4 x double> %a, <4 x double> %b) {
725 ; ALL-LABEL: shuffle_v4f64_0z3z:
727 ; ALL-NEXT: vxorpd %xmm1, %xmm1, %xmm1
728 ; ALL-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[0],ymm1[0],ymm0[3],ymm1[2]
730 %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>
731 ret <4 x double> %shuffle
734 define <4 x double> @shuffle_v4f64_1z2z(<4 x double> %a, <4 x double> %b) {
735 ; ALL-LABEL: shuffle_v4f64_1z2z:
737 ; ALL-NEXT: vxorpd %xmm1, %xmm1, %xmm1
738 ; ALL-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1],ymm1[0],ymm0[2],ymm1[2]
740 %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>
744 define <4 x double> @shuffle_v4f64_0044(<4 x double> %a, <4 x double> %b) {
745 ; AVX1-LABEL: shuffle_v4f64_0044:
747 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
748 ; AVX1-NEXT: vmovddup {{.*#+}} ymm0 = ymm0[0,0,2,2]
751 ; AVX2-LABEL: shuffle_v4f64_0044:
753 ; AVX2-NEXT: vmovlhps {{.*#+}} xmm0 = xmm0[0],xmm1[0]
754 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,1,1]
757 ; AVX512VL-SLOW-LABEL: shuffle_v4f64_0044:
758 ; AVX512VL-SLOW: # %bb.0:
759 ; AVX512VL-SLOW-NEXT: vmovlhps {{.*#+}} xmm0 = xmm0[0],xmm1[0]
760 ; AVX512VL-SLOW-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,1,1]
761 ; AVX512VL-SLOW-NEXT: retq
763 ; AVX512VL-FAST-ALL-LABEL: shuffle_v4f64_0044:
764 ; AVX512VL-FAST-ALL: # %bb.0:
765 ; AVX512VL-FAST-ALL-NEXT: vmovapd {{.*#+}} ymm2 = [0,0,4,4]
766 ; AVX512VL-FAST-ALL-NEXT: vpermt2pd %ymm1, %ymm2, %ymm0
767 ; AVX512VL-FAST-ALL-NEXT: retq
769 ; AVX512VL-FAST-PERLANE-LABEL: shuffle_v4f64_0044:
770 ; AVX512VL-FAST-PERLANE: # %bb.0:
771 ; AVX512VL-FAST-PERLANE-NEXT: vmovlhps {{.*#+}} xmm0 = xmm0[0],xmm1[0]
772 ; AVX512VL-FAST-PERLANE-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,1,1]
773 ; AVX512VL-FAST-PERLANE-NEXT: retq
774 %1 = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 0, i32 0, i32 4, i32 4>
778 define <4 x double> @shuffle_v4f64_0044_v2f64(<2 x double> %a, <2 x double> %b) {
779 ; ALL-LABEL: shuffle_v4f64_0044_v2f64:
781 ; ALL-NEXT: # kill: def $xmm0 killed $xmm0 def $ymm0
782 ; ALL-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
783 ; ALL-NEXT: vmovddup {{.*#+}} ymm0 = ymm0[0,0,2,2]
785 %1 = shufflevector <2 x double> %a, <2 x double> undef, <2 x i32> <i32 0, i32 0>
786 %2 = shufflevector <2 x double> %b, <2 x double> undef, <2 x i32> <i32 0, i32 0>
787 %3 = shufflevector <2 x double> %1, <2 x double> %2, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
791 define <4 x double> @shuffle_v4f64_1032_v2f64(<2 x double> %a, <2 x double> %b) {
792 ; ALL-LABEL: shuffle_v4f64_1032_v2f64:
794 ; ALL-NEXT: # kill: def $xmm0 killed $xmm0 def $ymm0
795 ; ALL-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
796 ; ALL-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1,0,3,2]
798 %1 = shufflevector <2 x double> %a, <2 x double> undef, <2 x i32> <i32 1, i32 0>
799 %2 = shufflevector <2 x double> %b, <2 x double> undef, <2 x i32> <i32 1, i32 0>
800 %3 = shufflevector <2 x double> %1, <2 x double> %2, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
805 define <4 x double> @shuffle_v4f64_2345_0567_select(<4 x double> %vec1, <4 x double> %vec2, <4 x double> %vec3) {
806 ; ALL-LABEL: shuffle_v4f64_2345_0567_select:
808 ; ALL-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3],ymm1[0,1]
809 ; ALL-NEXT: vblendps {{.*#+}} ymm0 = ymm2[0,1],ymm0[2,3,4,5,6,7]
811 %shuf = shufflevector <4 x double> %vec1, <4 x double> %vec2, <4 x i32> <i32 2, i32 3, i32 4, i32 5>
812 %res = select <4 x i1> <i1 0, i1 1, i1 1, i1 1>, <4 x double> %shuf, <4 x double> %vec3
813 ret <4 x double> %res
816 define <4 x i64> @shuffle_v4i64_0000(<4 x i64> %a, <4 x i64> %b) {
817 ; AVX1-LABEL: shuffle_v4i64_0000:
819 ; AVX1-NEXT: vshufps {{.*#+}} xmm0 = xmm0[0,1,0,1]
820 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
823 ; AVX2-LABEL: shuffle_v4i64_0000:
825 ; AVX2-NEXT: vbroadcastsd %xmm0, %ymm0
828 ; AVX512VL-LABEL: shuffle_v4i64_0000:
830 ; AVX512VL-NEXT: vbroadcastsd %xmm0, %ymm0
831 ; AVX512VL-NEXT: retq
832 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
833 ret <4 x i64> %shuffle
836 define <4 x i64> @shuffle_v4i64_0001(<4 x i64> %a, <4 x i64> %b) {
837 ; AVX1-LABEL: shuffle_v4i64_0001:
839 ; AVX1-NEXT: vshufps {{.*#+}} xmm1 = xmm0[0,1,0,1]
840 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0
843 ; AVX2-LABEL: shuffle_v4i64_0001:
845 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,0,1]
848 ; AVX512VL-LABEL: shuffle_v4i64_0001:
850 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,0,1]
851 ; AVX512VL-NEXT: retq
852 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 0, i32 0, i32 1>
853 ret <4 x i64> %shuffle
856 define <4 x i64> @shuffle_v4i64_0020(<4 x i64> %a, <4 x i64> %b) {
857 ; AVX1-LABEL: shuffle_v4i64_0020:
859 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm1
860 ; AVX1-NEXT: vunpcklpd {{.*#+}} ymm0 = ymm0[0],ymm1[0],ymm0[2],ymm1[2]
863 ; AVX2-LABEL: shuffle_v4i64_0020:
865 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,2,0]
868 ; AVX512VL-LABEL: shuffle_v4i64_0020:
870 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,2,0]
871 ; AVX512VL-NEXT: retq
872 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 0, i32 2, i32 0>
873 ret <4 x i64> %shuffle
876 define <4 x i64> @shuffle_v4i64_0112(<4 x i64> %a, <4 x i64> %b) {
877 ; AVX1-LABEL: shuffle_v4i64_0112:
879 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm1
880 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm1[0],ymm0[1],ymm1[3],ymm0[2]
883 ; AVX2-LABEL: shuffle_v4i64_0112:
885 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,1,1,2]
888 ; AVX512VL-LABEL: shuffle_v4i64_0112:
890 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,1,1,2]
891 ; AVX512VL-NEXT: retq
892 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 1, i32 1, i32 2>
893 ret <4 x i64> %shuffle
896 define <4 x i64> @shuffle_v4i64_0300(<4 x i64> %a, <4 x i64> %b) {
897 ; AVX1-LABEL: shuffle_v4i64_0300:
899 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm1 = ymm0[2,3,0,1]
900 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
901 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[0],ymm1[1],ymm0[2],ymm1[2]
904 ; AVX2-LABEL: shuffle_v4i64_0300:
906 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,3,0,0]
909 ; AVX512VL-LABEL: shuffle_v4i64_0300:
911 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,3,0,0]
912 ; AVX512VL-NEXT: retq
913 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 3, i32 0, i32 0>
914 ret <4 x i64> %shuffle
917 define <4 x i64> @shuffle_v4i64_1000(<4 x i64> %a, <4 x i64> %b) {
918 ; AVX1-LABEL: shuffle_v4i64_1000:
920 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
921 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1,0,2,2]
924 ; AVX2-LABEL: shuffle_v4i64_1000:
926 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[1,0,0,0]
929 ; AVX512VL-LABEL: shuffle_v4i64_1000:
931 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[1,0,0,0]
932 ; AVX512VL-NEXT: retq
933 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 1, i32 0, i32 0, i32 0>
934 ret <4 x i64> %shuffle
937 define <4 x i64> @shuffle_v4i64_2200(<4 x i64> %a, <4 x i64> %b) {
938 ; AVX1-LABEL: shuffle_v4i64_2200:
940 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3,0,1]
941 ; AVX1-NEXT: vmovddup {{.*#+}} ymm0 = ymm0[0,0,2,2]
944 ; AVX2-LABEL: shuffle_v4i64_2200:
946 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,2,0,0]
949 ; AVX512VL-LABEL: shuffle_v4i64_2200:
951 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,2,0,0]
952 ; AVX512VL-NEXT: retq
953 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 2, i32 2, i32 0, i32 0>
954 ret <4 x i64> %shuffle
957 define <4 x i64> @shuffle_v4i64_3330(<4 x i64> %a, <4 x i64> %b) {
958 ; AVX1-LABEL: shuffle_v4i64_3330:
960 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm1 = ymm0[2,3,0,1]
961 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3,2,3]
962 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1],ymm1[1],ymm0[3],ymm1[2]
965 ; AVX2-LABEL: shuffle_v4i64_3330:
967 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[3,3,3,0]
970 ; AVX512VL-LABEL: shuffle_v4i64_3330:
972 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[3,3,3,0]
973 ; AVX512VL-NEXT: retq
974 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 3, i32 3, i32 3, i32 0>
975 ret <4 x i64> %shuffle
978 define <4 x i64> @shuffle_v4i64_3210(<4 x i64> %a, <4 x i64> %b) {
979 ; AVX1-LABEL: shuffle_v4i64_3210:
981 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3,0,1]
982 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1,0,3,2]
985 ; AVX2-LABEL: shuffle_v4i64_3210:
987 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[3,2,1,0]
990 ; AVX512VL-LABEL: shuffle_v4i64_3210:
992 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[3,2,1,0]
993 ; AVX512VL-NEXT: retq
994 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
995 ret <4 x i64> %shuffle
998 define <4 x i64> @shuffle_v4i64_0213(<4 x i64> %a, <4 x i64> %b) {
999 ; AVX1-LABEL: shuffle_v4i64_0213:
1001 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm1 = ymm0[2,3,2,3]
1002 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
1003 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[0],ymm1[0],ymm0[3],ymm1[3]
1006 ; AVX2-LABEL: shuffle_v4i64_0213:
1008 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,2,1,3]
1011 ; AVX512VL-LABEL: shuffle_v4i64_0213:
1012 ; AVX512VL: # %bb.0:
1013 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,2,1,3]
1014 ; AVX512VL-NEXT: retq
1015 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
1016 ret <4 x i64> %shuffle
1019 define <4 x i64> @shuffle_v4i64_0124(<4 x i64> %a, <4 x i64> %b) {
1020 ; AVX1-LABEL: shuffle_v4i64_0124:
1022 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm1
1023 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[0],ymm1[1],ymm0[2],ymm1[2]
1026 ; AVX2-LABEL: shuffle_v4i64_0124:
1028 ; AVX2-NEXT: vbroadcastsd %xmm1, %ymm1
1029 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1,2,3,4,5],ymm1[6,7]
1032 ; AVX512VL-SLOW-LABEL: shuffle_v4i64_0124:
1033 ; AVX512VL-SLOW: # %bb.0:
1034 ; AVX512VL-SLOW-NEXT: vbroadcastsd %xmm1, %ymm1
1035 ; AVX512VL-SLOW-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1,2,3,4,5],ymm1[6,7]
1036 ; AVX512VL-SLOW-NEXT: retq
1038 ; AVX512VL-FAST-ALL-LABEL: shuffle_v4i64_0124:
1039 ; AVX512VL-FAST-ALL: # %bb.0:
1040 ; AVX512VL-FAST-ALL-NEXT: vpmovsxbq {{.*#+}} ymm2 = [0,1,2,4]
1041 ; AVX512VL-FAST-ALL-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
1042 ; AVX512VL-FAST-ALL-NEXT: retq
1044 ; AVX512VL-FAST-PERLANE-LABEL: shuffle_v4i64_0124:
1045 ; AVX512VL-FAST-PERLANE: # %bb.0:
1046 ; AVX512VL-FAST-PERLANE-NEXT: vbroadcastsd %xmm1, %ymm1
1047 ; AVX512VL-FAST-PERLANE-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1,2,3,4,5],ymm1[6,7]
1048 ; AVX512VL-FAST-PERLANE-NEXT: retq
1049 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 1, i32 2, i32 4>
1050 ret <4 x i64> %shuffle
1053 define <4 x i64> @shuffle_v4i64_0142(<4 x i64> %a, <4 x i64> %b) {
1054 ; AVX1-LABEL: shuffle_v4i64_0142:
1056 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm1
1057 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm1[0],ymm0[1],ymm1[2],ymm0[2]
1060 ; AVX2-LABEL: shuffle_v4i64_0142:
1062 ; AVX2-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm1
1063 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,1,2,2]
1064 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1,2,3],ymm1[4,5],ymm0[6,7]
1067 ; AVX512VL-LABEL: shuffle_v4i64_0142:
1068 ; AVX512VL: # %bb.0:
1069 ; AVX512VL-NEXT: vpmovsxbq {{.*#+}} ymm2 = [0,1,4,2]
1070 ; AVX512VL-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
1071 ; AVX512VL-NEXT: retq
1072 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 1, i32 4, i32 2>
1073 ret <4 x i64> %shuffle
1076 define <4 x i64> @shuffle_v4i64_0412(<4 x i64> %a, <4 x i64> %b) {
1077 ; AVX1-LABEL: shuffle_v4i64_0412:
1079 ; AVX1-NEXT: vblendpd {{.*#+}} ymm1 = ymm1[0,1],ymm0[2,3]
1080 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
1081 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[0],ymm1[0],ymm0[3],ymm1[2]
1084 ; AVX2-LABEL: shuffle_v4i64_0412:
1086 ; AVX2-NEXT: vmovddup {{.*#+}} xmm1 = xmm1[0,0]
1087 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,1,1,2]
1088 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1],ymm1[2,3],ymm0[4,5,6,7]
1091 ; AVX512VL-LABEL: shuffle_v4i64_0412:
1092 ; AVX512VL: # %bb.0:
1093 ; AVX512VL-NEXT: vpmovsxbq {{.*#+}} ymm2 = [0,4,1,2]
1094 ; AVX512VL-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
1095 ; AVX512VL-NEXT: retq
1096 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 4, i32 1, i32 2>
1097 ret <4 x i64> %shuffle
1100 define <4 x i64> @shuffle_v4i64_4012(<4 x i64> %a, <4 x i64> %b) {
1101 ; AVX1-LABEL: shuffle_v4i64_4012:
1103 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm1
1104 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm1[0],ymm0[0],ymm1[3],ymm0[2]
1107 ; AVX2-LABEL: shuffle_v4i64_4012:
1109 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,1,2]
1110 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3,4,5,6,7]
1113 ; AVX512VL-SLOW-LABEL: shuffle_v4i64_4012:
1114 ; AVX512VL-SLOW: # %bb.0:
1115 ; AVX512VL-SLOW-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,1,2]
1116 ; AVX512VL-SLOW-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3,4,5,6,7]
1117 ; AVX512VL-SLOW-NEXT: retq
1119 ; AVX512VL-FAST-ALL-LABEL: shuffle_v4i64_4012:
1120 ; AVX512VL-FAST-ALL: # %bb.0:
1121 ; AVX512VL-FAST-ALL-NEXT: vpmovsxbq {{.*#+}} ymm2 = [4,0,1,2]
1122 ; AVX512VL-FAST-ALL-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
1123 ; AVX512VL-FAST-ALL-NEXT: retq
1125 ; AVX512VL-FAST-PERLANE-LABEL: shuffle_v4i64_4012:
1126 ; AVX512VL-FAST-PERLANE: # %bb.0:
1127 ; AVX512VL-FAST-PERLANE-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,1,2]
1128 ; AVX512VL-FAST-PERLANE-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3,4,5,6,7]
1129 ; AVX512VL-FAST-PERLANE-NEXT: retq
1130 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 4, i32 0, i32 1, i32 2>
1131 ret <4 x i64> %shuffle
1134 define <4 x i64> @shuffle_v4i64_0145(<4 x i64> %a, <4 x i64> %b) {
1135 ; ALL-LABEL: shuffle_v4i64_0145:
1137 ; ALL-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
1139 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 1, i32 4, i32 5>
1140 ret <4 x i64> %shuffle
1143 define <4 x i64> @shuffle_v4i64_0451(<4 x i64> %a, <4 x i64> %b) {
1144 ; AVX1-LABEL: shuffle_v4i64_0451:
1146 ; AVX1-NEXT: vunpckhpd {{.*#+}} xmm2 = xmm1[1],xmm0[1]
1147 ; AVX1-NEXT: vmovlhps {{.*#+}} xmm0 = xmm0[0],xmm1[0]
1148 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
1151 ; AVX2-LABEL: shuffle_v4i64_0451:
1153 ; AVX2-NEXT: vpermpd {{.*#+}} ymm1 = ymm1[0,0,1,3]
1154 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,1,2,1]
1155 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1],ymm1[2,3,4,5],ymm0[6,7]
1158 ; AVX512VL-LABEL: shuffle_v4i64_0451:
1159 ; AVX512VL: # %bb.0:
1160 ; AVX512VL-NEXT: vpmovsxbq {{.*#+}} ymm2 = [0,4,5,1]
1161 ; AVX512VL-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
1162 ; AVX512VL-NEXT: retq
1163 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 4, i32 5, i32 1>
1164 ret <4 x i64> %shuffle
1167 define <4 x i64> @shuffle_v4i64_4501(<4 x i64> %a, <4 x i64> %b) {
1168 ; ALL-LABEL: shuffle_v4i64_4501:
1170 ; ALL-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0
1172 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 4, i32 5, i32 0, i32 1>
1173 ret <4 x i64> %shuffle
1176 define <4 x i64> @shuffle_v4i64_4015(<4 x i64> %a, <4 x i64> %b) {
1177 ; AVX1-LABEL: shuffle_v4i64_4015:
1179 ; AVX1-NEXT: vunpckhpd {{.*#+}} xmm2 = xmm0[1],xmm1[1]
1180 ; AVX1-NEXT: vmovlhps {{.*#+}} xmm0 = xmm1[0],xmm0[0]
1181 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
1184 ; AVX2-LABEL: shuffle_v4i64_4015:
1186 ; AVX2-NEXT: vpermpd {{.*#+}} ymm1 = ymm1[0,1,2,1]
1187 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,1,3]
1188 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3,4,5],ymm1[6,7]
1191 ; AVX512VL-LABEL: shuffle_v4i64_4015:
1192 ; AVX512VL: # %bb.0:
1193 ; AVX512VL-NEXT: vpmovsxbq {{.*#+}} ymm2 = [4,0,1,5]
1194 ; AVX512VL-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
1195 ; AVX512VL-NEXT: retq
1196 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 4, i32 0, i32 1, i32 5>
1197 ret <4 x i64> %shuffle
1200 define <4 x i64> @shuffle_v4i64_2u35(<4 x i64> %a, <4 x i64> %b) {
1201 ; AVX1-LABEL: shuffle_v4i64_2u35:
1203 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3,2,3]
1204 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm1
1205 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[0],ymm1[0],ymm0[3],ymm1[3]
1208 ; AVX2-LABEL: shuffle_v4i64_2u35:
1210 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
1211 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,1,3,1]
1214 ; AVX512VL-SLOW-LABEL: shuffle_v4i64_2u35:
1215 ; AVX512VL-SLOW: # %bb.0:
1216 ; AVX512VL-SLOW-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
1217 ; AVX512VL-SLOW-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,1,3,1]
1218 ; AVX512VL-SLOW-NEXT: retq
1220 ; AVX512VL-FAST-ALL-LABEL: shuffle_v4i64_2u35:
1221 ; AVX512VL-FAST-ALL: # %bb.0:
1222 ; AVX512VL-FAST-ALL-NEXT: vpmovsxbq {{.*#+}} ymm2 = [2,5,3,5]
1223 ; AVX512VL-FAST-ALL-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
1224 ; AVX512VL-FAST-ALL-NEXT: retq
1226 ; AVX512VL-FAST-PERLANE-LABEL: shuffle_v4i64_2u35:
1227 ; AVX512VL-FAST-PERLANE: # %bb.0:
1228 ; AVX512VL-FAST-PERLANE-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
1229 ; AVX512VL-FAST-PERLANE-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,1,3,1]
1230 ; AVX512VL-FAST-PERLANE-NEXT: retq
1231 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 2, i32 undef, i32 3, i32 5>
1232 ret <4 x i64> %shuffle
1235 define <4 x i64> @shuffle_v4i64_1251(<4 x i64> %a, <4 x i64> %b) {
1236 ; AVX1-LABEL: shuffle_v4i64_1251:
1238 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm2 = ymm0[2,3,0,1]
1239 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
1240 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1],ymm2[0],ymm0[3],ymm2[3]
1243 ; AVX2-LABEL: shuffle_v4i64_1251:
1245 ; AVX2-NEXT: vpermpd {{.*#+}} ymm1 = ymm1[1,1,1,1]
1246 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[1,2,2,1]
1247 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1,2,3],ymm1[4,5],ymm0[6,7]
1250 ; AVX512VL-LABEL: shuffle_v4i64_1251:
1251 ; AVX512VL: # %bb.0:
1252 ; AVX512VL-NEXT: vpmovsxbq {{.*#+}} ymm2 = [1,2,5,1]
1253 ; AVX512VL-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
1254 ; AVX512VL-NEXT: retq
1255 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 1, i32 2, i32 5, i32 1>
1256 ret <4 x i64> %shuffle
1259 define <4 x i64> @shuffle_v4i64_1054(<4 x i64> %a, <4 x i64> %b) {
1260 ; AVX1-LABEL: shuffle_v4i64_1054:
1262 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
1263 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1,0,3,2]
1266 ; AVX2-LABEL: shuffle_v4i64_1054:
1268 ; AVX2-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
1269 ; AVX2-NEXT: vshufps {{.*#+}} ymm0 = ymm0[2,3,0,1,6,7,4,5]
1272 ; AVX512VL-SLOW-LABEL: shuffle_v4i64_1054:
1273 ; AVX512VL-SLOW: # %bb.0:
1274 ; AVX512VL-SLOW-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
1275 ; AVX512VL-SLOW-NEXT: vshufps {{.*#+}} ymm0 = ymm0[2,3,0,1,6,7,4,5]
1276 ; AVX512VL-SLOW-NEXT: retq
1278 ; AVX512VL-FAST-ALL-LABEL: shuffle_v4i64_1054:
1279 ; AVX512VL-FAST-ALL: # %bb.0:
1280 ; AVX512VL-FAST-ALL-NEXT: vpmovsxbq {{.*#+}} ymm2 = [1,0,5,4]
1281 ; AVX512VL-FAST-ALL-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
1282 ; AVX512VL-FAST-ALL-NEXT: retq
1284 ; AVX512VL-FAST-PERLANE-LABEL: shuffle_v4i64_1054:
1285 ; AVX512VL-FAST-PERLANE: # %bb.0:
1286 ; AVX512VL-FAST-PERLANE-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
1287 ; AVX512VL-FAST-PERLANE-NEXT: vshufps {{.*#+}} ymm0 = ymm0[2,3,0,1,6,7,4,5]
1288 ; AVX512VL-FAST-PERLANE-NEXT: retq
1289 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 1, i32 0, i32 5, i32 4>
1290 ret <4 x i64> %shuffle
1293 define <4 x i64> @shuffle_v4i64_3254(<4 x i64> %a, <4 x i64> %b) {
1294 ; AVX1-LABEL: shuffle_v4i64_3254:
1296 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3],ymm1[0,1]
1297 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1,0,3,2]
1300 ; AVX2-LABEL: shuffle_v4i64_3254:
1302 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
1303 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[3,2,1,0]
1306 ; AVX512VL-SLOW-LABEL: shuffle_v4i64_3254:
1307 ; AVX512VL-SLOW: # %bb.0:
1308 ; AVX512VL-SLOW-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
1309 ; AVX512VL-SLOW-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[3,2,1,0]
1310 ; AVX512VL-SLOW-NEXT: retq
1312 ; AVX512VL-FAST-ALL-LABEL: shuffle_v4i64_3254:
1313 ; AVX512VL-FAST-ALL: # %bb.0:
1314 ; AVX512VL-FAST-ALL-NEXT: vpmovsxbq {{.*#+}} ymm2 = [3,2,5,4]
1315 ; AVX512VL-FAST-ALL-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
1316 ; AVX512VL-FAST-ALL-NEXT: retq
1318 ; AVX512VL-FAST-PERLANE-LABEL: shuffle_v4i64_3254:
1319 ; AVX512VL-FAST-PERLANE: # %bb.0:
1320 ; AVX512VL-FAST-PERLANE-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
1321 ; AVX512VL-FAST-PERLANE-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[3,2,1,0]
1322 ; AVX512VL-FAST-PERLANE-NEXT: retq
1323 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 3, i32 2, i32 5, i32 4>
1324 ret <4 x i64> %shuffle
1327 define <4 x i64> @shuffle_v4i64_3276(<4 x i64> %a, <4 x i64> %b) {
1328 ; AVX1-LABEL: shuffle_v4i64_3276:
1330 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3],ymm1[2,3]
1331 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1,0,3,2]
1334 ; AVX2-LABEL: shuffle_v4i64_3276:
1336 ; AVX2-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3],ymm1[2,3]
1337 ; AVX2-NEXT: vshufps {{.*#+}} ymm0 = ymm0[2,3,0,1,6,7,4,5]
1340 ; AVX512VL-SLOW-LABEL: shuffle_v4i64_3276:
1341 ; AVX512VL-SLOW: # %bb.0:
1342 ; AVX512VL-SLOW-NEXT: vperm2i128 {{.*#+}} ymm0 = ymm0[2,3],ymm1[2,3]
1343 ; AVX512VL-SLOW-NEXT: vpshufd {{.*#+}} ymm0 = ymm0[2,3,0,1,6,7,4,5]
1344 ; AVX512VL-SLOW-NEXT: retq
1346 ; AVX512VL-FAST-ALL-LABEL: shuffle_v4i64_3276:
1347 ; AVX512VL-FAST-ALL: # %bb.0:
1348 ; AVX512VL-FAST-ALL-NEXT: vpmovsxbq {{.*#+}} ymm2 = [3,2,7,6]
1349 ; AVX512VL-FAST-ALL-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
1350 ; AVX512VL-FAST-ALL-NEXT: retq
1352 ; AVX512VL-FAST-PERLANE-LABEL: shuffle_v4i64_3276:
1353 ; AVX512VL-FAST-PERLANE: # %bb.0:
1354 ; AVX512VL-FAST-PERLANE-NEXT: vperm2i128 {{.*#+}} ymm0 = ymm0[2,3],ymm1[2,3]
1355 ; AVX512VL-FAST-PERLANE-NEXT: vpshufd {{.*#+}} ymm0 = ymm0[2,3,0,1,6,7,4,5]
1356 ; AVX512VL-FAST-PERLANE-NEXT: retq
1357 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 3, i32 2, i32 7, i32 6>
1358 ret <4 x i64> %shuffle
1361 define <4 x i64> @shuffle_v4i64_1076(<4 x i64> %a, <4 x i64> %b) {
1362 ; AVX1-LABEL: shuffle_v4i64_1076:
1364 ; AVX1-NEXT: vblendpd {{.*#+}} ymm0 = ymm0[0,1],ymm1[2,3]
1365 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1,0,3,2]
1368 ; AVX2-LABEL: shuffle_v4i64_1076:
1370 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1,2,3],ymm1[4,5,6,7]
1371 ; AVX2-NEXT: vshufps {{.*#+}} ymm0 = ymm0[2,3,0,1,6,7,4,5]
1374 ; AVX512VL-SLOW-LABEL: shuffle_v4i64_1076:
1375 ; AVX512VL-SLOW: # %bb.0:
1376 ; AVX512VL-SLOW-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1,2,3],ymm1[4,5,6,7]
1377 ; AVX512VL-SLOW-NEXT: vshufps {{.*#+}} ymm0 = ymm0[2,3,0,1,6,7,4,5]
1378 ; AVX512VL-SLOW-NEXT: retq
1380 ; AVX512VL-FAST-LABEL: shuffle_v4i64_1076:
1381 ; AVX512VL-FAST: # %bb.0:
1382 ; AVX512VL-FAST-NEXT: vpmovsxbq {{.*#+}} ymm2 = [1,0,7,6]
1383 ; AVX512VL-FAST-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
1384 ; AVX512VL-FAST-NEXT: retq
1385 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 1, i32 0, i32 7, i32 6>
1386 ret <4 x i64> %shuffle
1389 define <4 x i64> @shuffle_v4i64_0415(<4 x i64> %a, <4 x i64> %b) {
1390 ; AVX1-LABEL: shuffle_v4i64_0415:
1392 ; AVX1-NEXT: vunpckhpd {{.*#+}} xmm2 = xmm0[1],xmm1[1]
1393 ; AVX1-NEXT: vmovlhps {{.*#+}} xmm0 = xmm0[0],xmm1[0]
1394 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
1397 ; AVX2-LABEL: shuffle_v4i64_0415:
1399 ; AVX2-NEXT: vpermpd {{.*#+}} ymm1 = ymm1[0,0,2,1]
1400 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,1,1,3]
1401 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1],ymm1[2,3],ymm0[4,5],ymm1[6,7]
1404 ; AVX512VL-LABEL: shuffle_v4i64_0415:
1405 ; AVX512VL: # %bb.0:
1406 ; AVX512VL-NEXT: vpmovsxbq {{.*#+}} ymm2 = [0,4,1,5]
1407 ; AVX512VL-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
1408 ; AVX512VL-NEXT: retq
1409 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 4, i32 1, i32 5>
1410 ret <4 x i64> %shuffle
1413 define <4 x i64> @shuffle_v4i64_2741(<4 x i64> %a, <4 x i64> %b) {
1414 ; AVX1-LABEL: shuffle_v4i64_2741:
1416 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm2 = ymm1[2,3],ymm0[0,1]
1417 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3],ymm1[0,1]
1418 ; AVX1-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1],ymm2[2,3],ymm0[4,5],ymm2[6,7]
1421 ; AVX2-LABEL: shuffle_v4i64_2741:
1423 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3,4,5],ymm1[6,7]
1424 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,3,0,1]
1427 ; AVX512VL-SLOW-LABEL: shuffle_v4i64_2741:
1428 ; AVX512VL-SLOW: # %bb.0:
1429 ; AVX512VL-SLOW-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3,4,5],ymm1[6,7]
1430 ; AVX512VL-SLOW-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,3,0,1]
1431 ; AVX512VL-SLOW-NEXT: retq
1433 ; AVX512VL-FAST-ALL-LABEL: shuffle_v4i64_2741:
1434 ; AVX512VL-FAST-ALL: # %bb.0:
1435 ; AVX512VL-FAST-ALL-NEXT: vpmovsxbq {{.*#+}} ymm2 = [2,7,4,1]
1436 ; AVX512VL-FAST-ALL-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
1437 ; AVX512VL-FAST-ALL-NEXT: retq
1439 ; AVX512VL-FAST-PERLANE-LABEL: shuffle_v4i64_2741:
1440 ; AVX512VL-FAST-PERLANE: # %bb.0:
1441 ; AVX512VL-FAST-PERLANE-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3,4,5],ymm1[6,7]
1442 ; AVX512VL-FAST-PERLANE-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,3,0,1]
1443 ; AVX512VL-FAST-PERLANE-NEXT: retq
1444 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 2, i32 7, i32 4, i32 1>
1445 ret <4 x i64> %shuffle
1449 define <4 x i64> @shuffle_v4i64_0437(<4 x i64> %a, <4 x i64> %b) {
1450 ; AVX1-LABEL: shuffle_v4i64_0437:
1452 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[0],ymm1[0],ymm0[3],ymm1[3]
1455 ; AVX2-LABEL: shuffle_v4i64_0437:
1457 ; AVX2-NEXT: vpermpd {{.*#+}} ymm1 = ymm1[0,0,2,3]
1458 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,1,3,3]
1459 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1],ymm1[2,3],ymm0[4,5],ymm1[6,7]
1462 ; AVX512VL-LABEL: shuffle_v4i64_0437:
1463 ; AVX512VL: # %bb.0:
1464 ; AVX512VL-NEXT: vpmovsxbq {{.*#+}} ymm2 = [0,4,3,7]
1465 ; AVX512VL-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
1466 ; AVX512VL-NEXT: retq
1467 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 4, i32 3, i32 7>
1468 ret <4 x i64> %shuffle
1471 define <4 x i64> @shuffle_v4i64_z4z6(<4 x i64> %a) {
1472 ; AVX1-LABEL: shuffle_v4i64_z4z6:
1474 ; AVX1-NEXT: vxorps %xmm1, %xmm1, %xmm1
1475 ; AVX1-NEXT: vunpcklpd {{.*#+}} ymm0 = ymm1[0],ymm0[0],ymm1[2],ymm0[2]
1478 ; AVX2-LABEL: shuffle_v4i64_z4z6:
1480 ; 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]
1483 ; AVX512VL-LABEL: shuffle_v4i64_z4z6:
1484 ; AVX512VL: # %bb.0:
1485 ; 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]
1486 ; AVX512VL-NEXT: retq
1487 %shuffle = shufflevector <4 x i64> zeroinitializer, <4 x i64> %a, <4 x i32> <i32 0, i32 4, i32 0, i32 6>
1488 ret <4 x i64> %shuffle
1491 define <4 x i64> @shuffle_v4i64_5zuz(<4 x i64> %a) {
1492 ; AVX1-LABEL: shuffle_v4i64_5zuz:
1494 ; AVX1-NEXT: vxorps %xmm1, %xmm1, %xmm1
1495 ; AVX1-NEXT: vunpckhpd {{.*#+}} ymm0 = ymm0[1],ymm1[1],ymm0[3],ymm1[3]
1498 ; AVX2-LABEL: shuffle_v4i64_5zuz:
1500 ; 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
1503 ; AVX512VL-LABEL: shuffle_v4i64_5zuz:
1504 ; AVX512VL: # %bb.0:
1505 ; 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
1506 ; AVX512VL-NEXT: retq
1507 %shuffle = shufflevector <4 x i64> zeroinitializer, <4 x i64> %a, <4 x i32> <i32 5, i32 0, i32 undef, i32 0>
1508 ret <4 x i64> %shuffle
1511 define <4 x i64> @shuffle_v4i64_40u2(<4 x i64> %a, <4 x i64> %b) {
1512 ; ALL-LABEL: shuffle_v4i64_40u2:
1514 ; ALL-NEXT: vunpcklpd {{.*#+}} ymm0 = ymm1[0],ymm0[0],ymm1[2],ymm0[2]
1516 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 4, i32 0, i32 undef, i32 2>
1517 ret <4 x i64> %shuffle
1520 define <4 x i64> @shuffle_v4i64_15uu(<4 x i64> %a, <4 x i64> %b) {
1521 ; ALL-LABEL: shuffle_v4i64_15uu:
1523 ; ALL-NEXT: vunpckhpd {{.*#+}} xmm0 = xmm0[1],xmm1[1]
1525 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 1, i32 5, i32 undef, i32 undef>
1526 ret <4 x i64> %shuffle
1529 define <4 x i64> @shuffle_v4i64_11uu(<4 x i64> %a, <4 x i64> %b) {
1530 ; ALL-LABEL: shuffle_v4i64_11uu:
1532 ; ALL-NEXT: vshufps {{.*#+}} xmm0 = xmm0[2,3,2,3]
1534 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 1, i32 1, i32 undef, i32 undef>
1535 ret <4 x i64> %shuffle
1538 define <4 x i64> @shuffle_v4i64_22uu(<4 x i64> %a, <4 x i64> %b) {
1539 ; AVX1-LABEL: shuffle_v4i64_22uu:
1541 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm0
1542 ; AVX1-NEXT: vshufps {{.*#+}} xmm0 = xmm0[0,1,0,1]
1545 ; AVX2-LABEL: shuffle_v4i64_22uu:
1547 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,2,2,2]
1550 ; AVX512VL-LABEL: shuffle_v4i64_22uu:
1551 ; AVX512VL: # %bb.0:
1552 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,2,2,2]
1553 ; AVX512VL-NEXT: retq
1554 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 2, i32 2, i32 undef, i32 undef>
1555 ret <4 x i64> %shuffle
1558 define <4 x i64> @shuffle_v4i64_3333(<4 x i64> %a, <4 x i64> %b) {
1559 ; AVX1-LABEL: shuffle_v4i64_3333:
1561 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3,2,3]
1562 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1,1,3,3]
1565 ; AVX2-LABEL: shuffle_v4i64_3333:
1567 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[3,3,3,3]
1570 ; AVX512VL-LABEL: shuffle_v4i64_3333:
1571 ; AVX512VL: # %bb.0:
1572 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[3,3,3,3]
1573 ; AVX512VL-NEXT: retq
1574 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 3, i32 3, i32 3, i32 3>
1575 ret <4 x i64> %shuffle
1578 define <4 x i64> @shuffle_v4i64_1z3z(<4 x i64> %a, <4 x i64> %b) {
1579 ; AVX1-LABEL: shuffle_v4i64_1z3z:
1581 ; AVX1-NEXT: vxorps %xmm1, %xmm1, %xmm1
1582 ; AVX1-NEXT: vunpckhpd {{.*#+}} ymm0 = ymm0[1],ymm1[1],ymm0[3],ymm1[3]
1585 ; AVX2-LABEL: shuffle_v4i64_1z3z:
1587 ; 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
1590 ; AVX512VL-LABEL: shuffle_v4i64_1z3z:
1591 ; AVX512VL: # %bb.0:
1592 ; 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
1593 ; AVX512VL-NEXT: retq
1594 %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>
1595 ret <4 x i64> %shuffle
1598 define <4 x i64> @shuffle_v4i64_0044_v2i64(<2 x i64> %a, <2 x i64> %b) {
1599 ; AVX1-LABEL: shuffle_v4i64_0044_v2i64:
1601 ; AVX1-NEXT: # kill: def $xmm0 killed $xmm0 def $ymm0
1602 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
1603 ; AVX1-NEXT: vmovddup {{.*#+}} ymm0 = ymm0[0,0,2,2]
1606 ; AVX2-LABEL: shuffle_v4i64_0044_v2i64:
1608 ; AVX2-NEXT: # kill: def $xmm0 killed $xmm0 def $ymm0
1609 ; AVX2-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
1610 ; AVX2-NEXT: vshufps {{.*#+}} ymm0 = ymm0[0,1,0,1,4,5,4,5]
1613 ; AVX512VL-LABEL: shuffle_v4i64_0044_v2i64:
1614 ; AVX512VL: # %bb.0:
1615 ; AVX512VL-NEXT: # kill: def $xmm0 killed $xmm0 def $ymm0
1616 ; AVX512VL-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
1617 ; AVX512VL-NEXT: vshufps {{.*#+}} ymm0 = ymm0[0,1,0,1,4,5,4,5]
1618 ; AVX512VL-NEXT: retq
1619 %1 = shufflevector <2 x i64> %a, <2 x i64> undef, <2 x i32> <i32 0, i32 0>
1620 %2 = shufflevector <2 x i64> %b, <2 x i64> undef, <2 x i32> <i32 0, i32 0>
1621 %3 = shufflevector <2 x i64> %1, <2 x i64> %2, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
1625 define <4 x i64> @shuffle_v4i64_1032_v2i64(<2 x i64> %a, <2 x i64> %b) {
1626 ; ALL-LABEL: shuffle_v4i64_1032_v2i64:
1628 ; ALL-NEXT: # kill: def $xmm0 killed $xmm0 def $ymm0
1629 ; ALL-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
1630 ; ALL-NEXT: vshufps {{.*#+}} ymm0 = ymm0[2,3,0,1,6,7,4,5]
1632 %1 = shufflevector <2 x i64> %a, <2 x i64> undef, <2 x i32> <i32 1, i32 0>
1633 %2 = shufflevector <2 x i64> %b, <2 x i64> undef, <2 x i32> <i32 1, i32 0>
1634 %3 = shufflevector <2 x i64> %1, <2 x i64> %2, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
1638 define <4 x i64> @stress_test1(<4 x i64> %a, <4 x i64> %b) {
1639 ; ALL-LABEL: stress_test1:
1641 %c = shufflevector <4 x i64> %b, <4 x i64> undef, <4 x i32> <i32 3, i32 1, i32 1, i32 0>
1642 %d = shufflevector <4 x i64> %c, <4 x i64> undef, <4 x i32> <i32 3, i32 undef, i32 2, i32 undef>
1643 %e = shufflevector <4 x i64> %b, <4 x i64> undef, <4 x i32> <i32 3, i32 3, i32 1, i32 undef>
1644 %f = shufflevector <4 x i64> %d, <4 x i64> %e, <4 x i32> <i32 5, i32 1, i32 1, i32 0>
1649 define <4 x i64> @insert_reg_and_zero_v4i64(i64 %a) {
1650 ; ALL-LABEL: insert_reg_and_zero_v4i64:
1652 ; ALL-NEXT: vmovq %rdi, %xmm0
1654 %v = insertelement <4 x i64> undef, i64 %a, i64 0
1655 %shuffle = shufflevector <4 x i64> %v, <4 x i64> zeroinitializer, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
1656 ret <4 x i64> %shuffle
1659 define <4 x i64> @insert_mem_and_zero_v4i64(ptr %ptr) {
1660 ; ALL-LABEL: insert_mem_and_zero_v4i64:
1662 ; ALL-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
1664 %a = load i64, ptr %ptr
1665 %v = insertelement <4 x i64> undef, i64 %a, i64 0
1666 %shuffle = shufflevector <4 x i64> %v, <4 x i64> zeroinitializer, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
1667 ret <4 x i64> %shuffle
1670 define <4 x double> @insert_reg_and_zero_v4f64(double %a) {
1671 ; ALL-LABEL: insert_reg_and_zero_v4f64:
1673 ; ALL-NEXT: vmovq {{.*#+}} xmm0 = xmm0[0],zero
1675 %v = insertelement <4 x double> undef, double %a, i32 0
1676 %shuffle = shufflevector <4 x double> %v, <4 x double> zeroinitializer, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
1677 ret <4 x double> %shuffle
1680 define <4 x double> @insert_mem_and_zero_v4f64(ptr %ptr) {
1681 ; ALL-LABEL: insert_mem_and_zero_v4f64:
1683 ; ALL-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
1685 %a = load double, ptr %ptr
1686 %v = insertelement <4 x double> undef, double %a, i32 0
1687 %shuffle = shufflevector <4 x double> %v, <4 x double> zeroinitializer, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
1688 ret <4 x double> %shuffle
1691 define <4 x double> @splat_mem_v4f64(ptr %ptr) {
1692 ; ALL-LABEL: splat_mem_v4f64:
1694 ; ALL-NEXT: vbroadcastsd (%rdi), %ymm0
1696 %a = load double, ptr %ptr
1697 %v = insertelement <4 x double> undef, double %a, i32 0
1698 %shuffle = shufflevector <4 x double> %v, <4 x double> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
1699 ret <4 x double> %shuffle
1702 define <4 x i64> @splat_mem_v4i64(ptr %ptr) {
1703 ; ALL-LABEL: splat_mem_v4i64:
1705 ; ALL-NEXT: vbroadcastsd (%rdi), %ymm0
1707 %a = load i64, ptr %ptr
1708 %v = insertelement <4 x i64> undef, i64 %a, i64 0
1709 %shuffle = shufflevector <4 x i64> %v, <4 x i64> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
1710 ret <4 x i64> %shuffle
1713 define <4 x double> @splat_mem_v4f64_2(ptr %p) {
1714 ; ALL-LABEL: splat_mem_v4f64_2:
1716 ; ALL-NEXT: vbroadcastsd (%rdi), %ymm0
1718 %1 = load double, ptr %p
1719 %2 = insertelement <2 x double> undef, double %1, i32 0
1720 %3 = shufflevector <2 x double> %2, <2 x double> undef, <4 x i32> zeroinitializer
1724 define <4 x double> @splat_v4f64(<2 x double> %r) {
1725 ; AVX1-LABEL: splat_v4f64:
1727 ; AVX1-NEXT: vmovddup {{.*#+}} xmm0 = xmm0[0,0]
1728 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
1731 ; AVX2-LABEL: splat_v4f64:
1733 ; AVX2-NEXT: vbroadcastsd %xmm0, %ymm0
1736 ; AVX512VL-LABEL: splat_v4f64:
1737 ; AVX512VL: # %bb.0:
1738 ; AVX512VL-NEXT: vbroadcastsd %xmm0, %ymm0
1739 ; AVX512VL-NEXT: retq
1740 %1 = shufflevector <2 x double> %r, <2 x double> undef, <4 x i32> zeroinitializer
1744 define <4 x i64> @splat_mem_v4i64_from_v2i64(ptr %ptr) {
1745 ; ALL-LABEL: splat_mem_v4i64_from_v2i64:
1747 ; ALL-NEXT: vbroadcastsd (%rdi), %ymm0
1749 %v = load <2 x i64>, ptr %ptr
1750 %shuffle = shufflevector <2 x i64> %v, <2 x i64> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
1751 ret <4 x i64> %shuffle
1754 define <4 x double> @splat_mem_v4f64_from_v2f64(ptr %ptr) {
1755 ; ALL-LABEL: splat_mem_v4f64_from_v2f64:
1757 ; ALL-NEXT: vbroadcastsd (%rdi), %ymm0
1759 %v = load <2 x double>, ptr %ptr
1760 %shuffle = shufflevector <2 x double> %v, <2 x double> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
1761 ret <4 x double> %shuffle
1764 define <4 x i64> @splat128_mem_v4i64_from_v2i64(ptr %ptr) {
1765 ; AVX1OR2-LABEL: splat128_mem_v4i64_from_v2i64:
1767 ; AVX1OR2-NEXT: vbroadcastf128 {{.*#+}} ymm0 = mem[0,1,0,1]
1768 ; AVX1OR2-NEXT: retq
1770 ; AVX512VL-LABEL: splat128_mem_v4i64_from_v2i64:
1771 ; AVX512VL: # %bb.0:
1772 ; AVX512VL-NEXT: vbroadcasti128 {{.*#+}} ymm0 = mem[0,1,0,1]
1773 ; AVX512VL-NEXT: retq
1774 %v = load <2 x i64>, ptr %ptr
1775 %shuffle = shufflevector <2 x i64> %v, <2 x i64> undef, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
1776 ret <4 x i64> %shuffle
1779 define <4 x double> @splat128_mem_v4f64_from_v2f64(ptr %ptr) {
1780 ; ALL-LABEL: splat128_mem_v4f64_from_v2f64:
1782 ; ALL-NEXT: vbroadcastf128 {{.*#+}} ymm0 = mem[0,1,0,1]
1784 %v = load <2 x double>, ptr %ptr
1785 %shuffle = shufflevector <2 x double> %v, <2 x double> undef, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
1786 ret <4 x double> %shuffle
1789 define <4 x double> @broadcast_v4f64_0000_from_v2i64(<2 x i64> %a0) {
1790 ; AVX1-LABEL: broadcast_v4f64_0000_from_v2i64:
1792 ; AVX1-NEXT: vshufps {{.*#+}} xmm0 = xmm0[0,1,0,1]
1793 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
1796 ; AVX2-LABEL: broadcast_v4f64_0000_from_v2i64:
1798 ; AVX2-NEXT: vbroadcastsd %xmm0, %ymm0
1801 ; AVX512VL-LABEL: broadcast_v4f64_0000_from_v2i64:
1802 ; AVX512VL: # %bb.0:
1803 ; AVX512VL-NEXT: vbroadcastsd %xmm0, %ymm0
1804 ; AVX512VL-NEXT: retq
1805 %1 = shufflevector <2 x i64> %a0, <2 x i64> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
1806 %2 = bitcast <4 x i64> %1 to <4 x double>
1807 %3 = shufflevector <4 x double> %2, <4 x double> undef, <4 x i32> zeroinitializer
1811 define <4 x double> @bitcast_v4f64_0426(<4 x double> %a, <4 x double> %b) {
1812 ; ALL-LABEL: bitcast_v4f64_0426:
1814 ; ALL-NEXT: vunpcklpd {{.*#+}} ymm0 = ymm0[0],ymm1[0],ymm0[2],ymm1[2]
1816 %shuffle64 = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 4, i32 0, i32 6, i32 2>
1817 %bitcast32 = bitcast <4 x double> %shuffle64 to <8 x float>
1818 %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>
1819 %bitcast16 = bitcast <8 x float> %shuffle32 to <16 x i16>
1820 %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>
1821 %bitcast64 = bitcast <16 x i16> %shuffle16 to <4 x double>
1822 ret <4 x double> %bitcast64
1825 define <4 x i64> @concat_v4i64_0167(<4 x i64> %a0, <4 x i64> %a1) {
1826 ; ALL-LABEL: concat_v4i64_0167:
1828 ; ALL-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1,2,3],ymm1[4,5,6,7]
1830 %a0lo = shufflevector <4 x i64> %a0, <4 x i64> %a1, <2 x i32> <i32 0, i32 1>
1831 %a1hi = shufflevector <4 x i64> %a0, <4 x i64> %a1, <2 x i32> <i32 6, i32 7>
1832 %shuffle64 = shufflevector <2 x i64> %a0lo, <2 x i64> %a1hi, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
1833 ret <4 x i64> %shuffle64
1836 define <4 x i64> @concat_v4i64_0145_bc(<4 x i64> %a0, <4 x i64> %a1) {
1837 ; ALL-LABEL: concat_v4i64_0145_bc:
1839 ; ALL-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
1841 %a0lo = shufflevector <4 x i64> %a0, <4 x i64> %a1, <2 x i32> <i32 0, i32 1>
1842 %a1lo = shufflevector <4 x i64> %a0, <4 x i64> %a1, <2 x i32> <i32 4, i32 5>
1843 %bc0lo = bitcast <2 x i64> %a0lo to <4 x i32>
1844 %bc1lo = bitcast <2 x i64> %a1lo to <4 x i32>
1845 %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>
1846 %shuffle64 = bitcast <8 x i32> %shuffle32 to <4 x i64>
1847 ret <4 x i64> %shuffle64
1850 define <4 x i64> @insert_dup_mem_v4i64(ptr %ptr) {
1851 ; ALL-LABEL: insert_dup_mem_v4i64:
1853 ; ALL-NEXT: vbroadcastsd (%rdi), %ymm0
1855 %tmp = load i64, ptr %ptr, align 1
1856 %tmp1 = insertelement <2 x i64> undef, i64 %tmp, i32 0
1857 %tmp2 = shufflevector <2 x i64> %tmp1, <2 x i64> undef, <4 x i32> zeroinitializer
1861 define <4 x i64> @shuffle_v4i64_1234(<4 x i64> %a, <4 x i64> %b) {
1862 ; AVX1-LABEL: shuffle_v4i64_1234:
1864 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm1 = ymm0[2,3],ymm1[0,1]
1865 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1],ymm1[0],ymm0[3],ymm1[2]
1868 ; AVX2-LABEL: shuffle_v4i64_1234:
1870 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3,4,5,6,7]
1871 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[1,2,3,0]
1874 ; AVX512VL-LABEL: shuffle_v4i64_1234:
1875 ; AVX512VL: # %bb.0:
1876 ; AVX512VL-NEXT: valignq {{.*#+}} ymm0 = ymm0[1,2,3],ymm1[0]
1877 ; AVX512VL-NEXT: retq
1878 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 1, i32 2, i32 3, i32 4>
1879 ret <4 x i64> %shuffle
1882 define <4 x i64> @shuffle_v4i64_1230(<4 x i64> %a) {
1883 ; AVX1-LABEL: shuffle_v4i64_1230:
1885 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm1 = ymm0[2,3,0,1]
1886 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1],ymm1[0],ymm0[3],ymm1[2]
1889 ; AVX2-LABEL: shuffle_v4i64_1230:
1891 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[1,2,3,0]
1894 ; AVX512VL-LABEL: shuffle_v4i64_1230:
1895 ; AVX512VL: # %bb.0:
1896 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[1,2,3,0]
1897 ; AVX512VL-NEXT: retq
1898 %shuffle = shufflevector <4 x i64> %a, <4 x i64> undef, <4 x i32> <i32 1, i32 2, i32 3, i32 0>
1899 ret <4 x i64> %shuffle
1902 define <4 x i64> @shuffle_v4i64_z0z3(<4 x i64> %a, <4 x i64> %b) {
1903 ; AVX1-LABEL: shuffle_v4i64_z0z3:
1905 ; AVX1-NEXT: vxorpd %xmm1, %xmm1, %xmm1
1906 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm1[0],ymm0[0],ymm1[2],ymm0[3]
1909 ; AVX2-SLOW-LABEL: shuffle_v4i64_z0z3:
1910 ; AVX2-SLOW: # %bb.0:
1911 ; AVX2-SLOW-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,2,3]
1912 ; AVX2-SLOW-NEXT: vxorps %xmm1, %xmm1, %xmm1
1913 ; AVX2-SLOW-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3],ymm1[4,5],ymm0[6,7]
1914 ; AVX2-SLOW-NEXT: retq
1916 ; AVX2-FAST-LABEL: shuffle_v4i64_z0z3:
1917 ; AVX2-FAST: # %bb.0:
1918 ; 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]
1919 ; AVX2-FAST-NEXT: retq
1921 ; AVX512VL-SLOW-LABEL: shuffle_v4i64_z0z3:
1922 ; AVX512VL-SLOW: # %bb.0:
1923 ; AVX512VL-SLOW-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,2,3]
1924 ; AVX512VL-SLOW-NEXT: vxorps %xmm1, %xmm1, %xmm1
1925 ; AVX512VL-SLOW-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3],ymm1[4,5],ymm0[6,7]
1926 ; AVX512VL-SLOW-NEXT: retq
1928 ; AVX512VL-FAST-LABEL: shuffle_v4i64_z0z3:
1929 ; AVX512VL-FAST: # %bb.0:
1930 ; 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]
1931 ; AVX512VL-FAST-NEXT: retq
1932 %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>
1936 define <4 x i64> @shuffle_v4i64_1z2z(<4 x i64> %a, <4 x i64> %b) {
1937 ; AVX1-LABEL: shuffle_v4i64_1z2z:
1939 ; AVX1-NEXT: vxorpd %xmm1, %xmm1, %xmm1
1940 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1],ymm1[0],ymm0[2],ymm1[2]
1943 ; AVX2-SLOW-LABEL: shuffle_v4i64_1z2z:
1944 ; AVX2-SLOW: # %bb.0:
1945 ; AVX2-SLOW-NEXT: vxorps %xmm1, %xmm1, %xmm1
1946 ; AVX2-SLOW-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3,4,5,6,7]
1947 ; AVX2-SLOW-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[1,0,2,0]
1948 ; AVX2-SLOW-NEXT: retq
1950 ; AVX2-FAST-LABEL: shuffle_v4i64_1z2z:
1951 ; AVX2-FAST: # %bb.0:
1952 ; 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
1953 ; AVX2-FAST-NEXT: retq
1955 ; AVX512VL-SLOW-LABEL: shuffle_v4i64_1z2z:
1956 ; AVX512VL-SLOW: # %bb.0:
1957 ; AVX512VL-SLOW-NEXT: vxorps %xmm1, %xmm1, %xmm1
1958 ; AVX512VL-SLOW-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3,4,5,6,7]
1959 ; AVX512VL-SLOW-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[1,0,2,0]
1960 ; AVX512VL-SLOW-NEXT: retq
1962 ; AVX512VL-FAST-LABEL: shuffle_v4i64_1z2z:
1963 ; AVX512VL-FAST: # %bb.0:
1964 ; 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
1965 ; AVX512VL-FAST-NEXT: retq
1966 %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>
1970 define <4 x double> @add_v4f64_0246_1357(<4 x double> %a, <4 x double> %b) {
1971 ; AVX1-LABEL: add_v4f64_0246_1357:
1972 ; AVX1: # %bb.0: # %entry
1973 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm2 = ymm0[2,3],ymm1[2,3]
1974 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
1975 ; AVX1-NEXT: vhaddpd %ymm2, %ymm0, %ymm0
1978 ; AVX2-LABEL: add_v4f64_0246_1357:
1979 ; AVX2: # %bb.0: # %entry
1980 ; AVX2-NEXT: vhaddpd %ymm1, %ymm0, %ymm0
1981 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,2,1,3]
1984 ; AVX512VL-LABEL: add_v4f64_0246_1357:
1985 ; AVX512VL: # %bb.0: # %entry
1986 ; AVX512VL-NEXT: vhaddpd %ymm1, %ymm0, %ymm0
1987 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,2,1,3]
1988 ; AVX512VL-NEXT: retq
1990 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
1991 %shuffle1 = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
1992 %add = fadd <4 x double> %shuffle, %shuffle1
1993 ret <4 x double> %add
1996 define <4 x double> @add_v4f64_4602_5713(<4 x double> %a, <4 x double> %b) {
1997 ; AVX1-LABEL: add_v4f64_4602_5713:
1998 ; AVX1: # %bb.0: # %entry
1999 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm2 = ymm1[2,3],ymm0[2,3]
2000 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0
2001 ; AVX1-NEXT: vhaddpd %ymm2, %ymm0, %ymm0
2004 ; AVX2-LABEL: add_v4f64_4602_5713:
2005 ; AVX2: # %bb.0: # %entry
2006 ; AVX2-NEXT: vhaddpd %ymm1, %ymm0, %ymm0
2007 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[1,3,0,2]
2010 ; AVX512VL-LABEL: add_v4f64_4602_5713:
2011 ; AVX512VL: # %bb.0: # %entry
2012 ; AVX512VL-NEXT: vhaddpd %ymm1, %ymm0, %ymm0
2013 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[1,3,0,2]
2014 ; AVX512VL-NEXT: retq
2016 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 4, i32 6, i32 0, i32 2>
2017 %shuffle1 = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 5, i32 7, i32 1, i32 3>
2018 %add = fadd <4 x double> %shuffle, %shuffle1
2019 ret <4 x double> %add
2022 define <4 x double> @add_v4f64_024u_135u_reverse(<4 x double> %a, <4 x double> %b) {
2023 ; AVX1-LABEL: add_v4f64_024u_135u_reverse:
2025 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm1
2026 ; AVX1-NEXT: vshufpd {{.*#+}} ymm2 = ymm0[0],ymm1[1],ymm0[3],ymm1[3]
2027 ; AVX1-NEXT: vunpcklpd {{.*#+}} ymm0 = ymm0[0],ymm1[0],ymm0[2],ymm1[2]
2028 ; AVX1-NEXT: vaddpd %ymm2, %ymm0, %ymm0
2031 ; AVX2-LABEL: add_v4f64_024u_135u_reverse:
2033 ; AVX2-NEXT: vhaddpd %ymm0, %ymm1, %ymm0
2034 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,3,1]
2037 ; AVX512VL-LABEL: add_v4f64_024u_135u_reverse:
2038 ; AVX512VL: # %bb.0:
2039 ; AVX512VL-NEXT: vhaddpd %ymm0, %ymm1, %ymm0
2040 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,3,1]
2041 ; AVX512VL-NEXT: retq
2042 %shuffle0 = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 0, i32 2, i32 4, i32 undef>
2043 %shuffle1 = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 1, i32 3, i32 5, i32 undef>
2044 %add = fadd <4 x double> %shuffle0, %shuffle1
2045 %shuffle = shufflevector <4 x double> %add, <4 x double> poison, <4 x i32> <i32 undef, i32 2, i32 1, i32 0>
2046 ret <4 x double> %shuffle
2049 define <4 x i64> @add_v4i64_0246_1357(<4 x i64> %a, <4 x i64> %b) {
2050 ; AVX1-LABEL: add_v4i64_0246_1357:
2051 ; AVX1: # %bb.0: # %entry
2052 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm2 = ymm0[2,3],ymm1[2,3]
2053 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
2054 ; AVX1-NEXT: vunpcklpd {{.*#+}} ymm1 = ymm0[0],ymm2[0],ymm0[2],ymm2[2]
2055 ; AVX1-NEXT: vunpckhpd {{.*#+}} ymm0 = ymm0[1],ymm2[1],ymm0[3],ymm2[3]
2056 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm2
2057 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm3
2058 ; AVX1-NEXT: vpaddq %xmm2, %xmm3, %xmm2
2059 ; AVX1-NEXT: vpaddq %xmm0, %xmm1, %xmm0
2060 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
2063 ; AVX2-LABEL: add_v4i64_0246_1357:
2064 ; AVX2: # %bb.0: # %entry
2065 ; AVX2-NEXT: vpunpcklqdq {{.*#+}} ymm2 = ymm0[0],ymm1[0],ymm0[2],ymm1[2]
2066 ; AVX2-NEXT: vpermq {{.*#+}} ymm2 = ymm2[0,2,1,3]
2067 ; AVX2-NEXT: vpunpckhqdq {{.*#+}} ymm0 = ymm0[1],ymm1[1],ymm0[3],ymm1[3]
2068 ; AVX2-NEXT: vpermq {{.*#+}} ymm0 = ymm0[0,2,1,3]
2069 ; AVX2-NEXT: vpaddq %ymm0, %ymm2, %ymm0
2072 ; AVX512VL-SLOW-LABEL: add_v4i64_0246_1357:
2073 ; AVX512VL-SLOW: # %bb.0: # %entry
2074 ; AVX512VL-SLOW-NEXT: vpunpcklqdq {{.*#+}} ymm2 = ymm0[0],ymm1[0],ymm0[2],ymm1[2]
2075 ; AVX512VL-SLOW-NEXT: vpermq {{.*#+}} ymm2 = ymm2[0,2,1,3]
2076 ; AVX512VL-SLOW-NEXT: vpunpckhqdq {{.*#+}} ymm0 = ymm0[1],ymm1[1],ymm0[3],ymm1[3]
2077 ; AVX512VL-SLOW-NEXT: vpermq {{.*#+}} ymm0 = ymm0[0,2,1,3]
2078 ; AVX512VL-SLOW-NEXT: vpaddq %ymm0, %ymm2, %ymm0
2079 ; AVX512VL-SLOW-NEXT: retq
2081 ; AVX512VL-FAST-ALL-LABEL: add_v4i64_0246_1357:
2082 ; AVX512VL-FAST-ALL: # %bb.0: # %entry
2083 ; AVX512VL-FAST-ALL-NEXT: vpmovsxbq {{.*#+}} ymm2 = [0,2,4,6]
2084 ; AVX512VL-FAST-ALL-NEXT: vpermi2q %ymm1, %ymm0, %ymm2
2085 ; AVX512VL-FAST-ALL-NEXT: vpmovsxbq {{.*#+}} ymm3 = [1,3,5,7]
2086 ; AVX512VL-FAST-ALL-NEXT: vpermi2q %ymm1, %ymm0, %ymm3
2087 ; AVX512VL-FAST-ALL-NEXT: vpaddq %ymm3, %ymm2, %ymm0
2088 ; AVX512VL-FAST-ALL-NEXT: retq
2090 ; AVX512VL-FAST-PERLANE-LABEL: add_v4i64_0246_1357:
2091 ; AVX512VL-FAST-PERLANE: # %bb.0: # %entry
2092 ; AVX512VL-FAST-PERLANE-NEXT: vpunpcklqdq {{.*#+}} ymm2 = ymm0[0],ymm1[0],ymm0[2],ymm1[2]
2093 ; AVX512VL-FAST-PERLANE-NEXT: vpermq {{.*#+}} ymm2 = ymm2[0,2,1,3]
2094 ; AVX512VL-FAST-PERLANE-NEXT: vpunpckhqdq {{.*#+}} ymm0 = ymm0[1],ymm1[1],ymm0[3],ymm1[3]
2095 ; AVX512VL-FAST-PERLANE-NEXT: vpermq {{.*#+}} ymm0 = ymm0[0,2,1,3]
2096 ; AVX512VL-FAST-PERLANE-NEXT: vpaddq %ymm0, %ymm2, %ymm0
2097 ; AVX512VL-FAST-PERLANE-NEXT: retq
2099 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
2100 %shuffle1 = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
2101 %add = add <4 x i64> %shuffle, %shuffle1
2105 define <4 x i64> @add_v4i64_4602_5713(<4 x i64> %a, <4 x i64> %b) {
2106 ; AVX1-LABEL: add_v4i64_4602_5713:
2107 ; AVX1: # %bb.0: # %entry
2108 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm2 = ymm1[2,3],ymm0[2,3]
2109 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0
2110 ; AVX1-NEXT: vunpcklpd {{.*#+}} ymm1 = ymm0[0],ymm2[0],ymm0[2],ymm2[2]
2111 ; AVX1-NEXT: vunpckhpd {{.*#+}} ymm0 = ymm0[1],ymm2[1],ymm0[3],ymm2[3]
2112 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm2
2113 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm3
2114 ; AVX1-NEXT: vpaddq %xmm2, %xmm3, %xmm2
2115 ; AVX1-NEXT: vpaddq %xmm0, %xmm1, %xmm0
2116 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
2119 ; AVX2-LABEL: add_v4i64_4602_5713:
2120 ; AVX2: # %bb.0: # %entry
2121 ; AVX2-NEXT: vpunpcklqdq {{.*#+}} ymm2 = ymm1[0],ymm0[0],ymm1[2],ymm0[2]
2122 ; AVX2-NEXT: vpermq {{.*#+}} ymm2 = ymm2[0,2,1,3]
2123 ; AVX2-NEXT: vpunpckhqdq {{.*#+}} ymm0 = ymm1[1],ymm0[1],ymm1[3],ymm0[3]
2124 ; AVX2-NEXT: vpermq {{.*#+}} ymm0 = ymm0[0,2,1,3]
2125 ; AVX2-NEXT: vpaddq %ymm0, %ymm2, %ymm0
2128 ; AVX512VL-SLOW-LABEL: add_v4i64_4602_5713:
2129 ; AVX512VL-SLOW: # %bb.0: # %entry
2130 ; AVX512VL-SLOW-NEXT: vpunpcklqdq {{.*#+}} ymm2 = ymm1[0],ymm0[0],ymm1[2],ymm0[2]
2131 ; AVX512VL-SLOW-NEXT: vpermq {{.*#+}} ymm2 = ymm2[0,2,1,3]
2132 ; AVX512VL-SLOW-NEXT: vpunpckhqdq {{.*#+}} ymm0 = ymm1[1],ymm0[1],ymm1[3],ymm0[3]
2133 ; AVX512VL-SLOW-NEXT: vpermq {{.*#+}} ymm0 = ymm0[0,2,1,3]
2134 ; AVX512VL-SLOW-NEXT: vpaddq %ymm0, %ymm2, %ymm0
2135 ; AVX512VL-SLOW-NEXT: retq
2137 ; AVX512VL-FAST-ALL-LABEL: add_v4i64_4602_5713:
2138 ; AVX512VL-FAST-ALL: # %bb.0: # %entry
2139 ; AVX512VL-FAST-ALL-NEXT: vpmovsxbq {{.*#+}} ymm2 = [0,2,4,6]
2140 ; AVX512VL-FAST-ALL-NEXT: vpermi2q %ymm0, %ymm1, %ymm2
2141 ; AVX512VL-FAST-ALL-NEXT: vpmovsxbq {{.*#+}} ymm3 = [1,3,5,7]
2142 ; AVX512VL-FAST-ALL-NEXT: vpermi2q %ymm0, %ymm1, %ymm3
2143 ; AVX512VL-FAST-ALL-NEXT: vpaddq %ymm3, %ymm2, %ymm0
2144 ; AVX512VL-FAST-ALL-NEXT: retq
2146 ; AVX512VL-FAST-PERLANE-LABEL: add_v4i64_4602_5713:
2147 ; AVX512VL-FAST-PERLANE: # %bb.0: # %entry
2148 ; AVX512VL-FAST-PERLANE-NEXT: vpunpcklqdq {{.*#+}} ymm2 = ymm1[0],ymm0[0],ymm1[2],ymm0[2]
2149 ; AVX512VL-FAST-PERLANE-NEXT: vpermq {{.*#+}} ymm2 = ymm2[0,2,1,3]
2150 ; AVX512VL-FAST-PERLANE-NEXT: vpunpckhqdq {{.*#+}} ymm0 = ymm1[1],ymm0[1],ymm1[3],ymm0[3]
2151 ; AVX512VL-FAST-PERLANE-NEXT: vpermq {{.*#+}} ymm0 = ymm0[0,2,1,3]
2152 ; AVX512VL-FAST-PERLANE-NEXT: vpaddq %ymm0, %ymm2, %ymm0
2153 ; AVX512VL-FAST-PERLANE-NEXT: retq
2155 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 4, i32 6, i32 0, i32 2>
2156 %shuffle1 = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 5, i32 7, i32 1, i32 3>
2157 %add = add <4 x i64> %shuffle, %shuffle1
2161 define <4 x double> @shuffle_v4f64_0zzz_optsize(<4 x double> %a) optsize {
2162 ; ALL-LABEL: shuffle_v4f64_0zzz_optsize:
2164 ; ALL-NEXT: vmovq {{.*#+}} xmm0 = xmm0[0],zero
2166 %b = shufflevector <4 x double> %a, <4 x double> zeroinitializer, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
2170 define <4 x i64> @shuffle_v4i64_0zzz_optsize(<4 x i64> %a) optsize {
2171 ; ALL-LABEL: shuffle_v4i64_0zzz_optsize:
2173 ; ALL-NEXT: vmovq {{.*#+}} xmm0 = xmm0[0],zero
2175 %b = shufflevector <4 x i64> %a, <4 x i64> zeroinitializer, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
2179 define <8 x float> @shuffle_v8f32_0zzzzzzz_optsize(<8 x float> %a) optsize {
2180 ; ALL-LABEL: shuffle_v8f32_0zzzzzzz_optsize:
2182 ; ALL-NEXT: vxorps %xmm1, %xmm1, %xmm1
2183 ; ALL-NEXT: vmovss {{.*#+}} xmm0 = xmm0[0],xmm1[1,2,3]
2185 %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>
2189 define <8 x i32> @shuffle_v8i32_0zzzzzzz_optsize(<8 x i32> %a) optsize {
2190 ; ALL-LABEL: shuffle_v8i32_0zzzzzzz_optsize:
2192 ; ALL-NEXT: vxorps %xmm1, %xmm1, %xmm1
2193 ; ALL-NEXT: vmovss {{.*#+}} xmm0 = xmm0[0],xmm1[1,2,3]
2195 %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>
2199 define <4 x double> @shuffle_v4f64_0zzz_pgso(<4 x double> %a) !prof !14 {
2200 ; ALL-LABEL: shuffle_v4f64_0zzz_pgso:
2202 ; ALL-NEXT: vmovq {{.*#+}} xmm0 = xmm0[0],zero
2204 %b = shufflevector <4 x double> %a, <4 x double> zeroinitializer, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
2208 define <4 x i64> @shuffle_v4i64_0zzz_pgso(<4 x i64> %a) !prof !14 {
2209 ; ALL-LABEL: shuffle_v4i64_0zzz_pgso:
2211 ; ALL-NEXT: vmovq {{.*#+}} xmm0 = xmm0[0],zero
2213 %b = shufflevector <4 x i64> %a, <4 x i64> zeroinitializer, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
2217 define <8 x float> @shuffle_v8f32_0zzzzzzz_pgso(<8 x float> %a) !prof !14 {
2218 ; AVX1OR2-LABEL: shuffle_v8f32_0zzzzzzz_pgso:
2220 ; AVX1OR2-NEXT: vxorps %xmm1, %xmm1, %xmm1
2221 ; AVX1OR2-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0],xmm1[1,2,3]
2222 ; AVX1OR2-NEXT: retq
2224 ; AVX512VL-LABEL: shuffle_v8f32_0zzzzzzz_pgso:
2225 ; AVX512VL: # %bb.0:
2226 ; AVX512VL-NEXT: vxorps %xmm1, %xmm1, %xmm1
2227 ; AVX512VL-NEXT: vmovss {{.*#+}} xmm0 = xmm0[0],xmm1[1,2,3]
2228 ; AVX512VL-NEXT: retq
2229 %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>
2233 define <8 x i32> @shuffle_v8i32_0zzzzzzz_pgso(<8 x i32> %a) !prof !14 {
2234 ; AVX1OR2-LABEL: shuffle_v8i32_0zzzzzzz_pgso:
2236 ; AVX1OR2-NEXT: vxorps %xmm1, %xmm1, %xmm1
2237 ; AVX1OR2-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0],xmm1[1,2,3]
2238 ; AVX1OR2-NEXT: retq
2240 ; AVX512VL-LABEL: shuffle_v8i32_0zzzzzzz_pgso:
2241 ; AVX512VL: # %bb.0:
2242 ; AVX512VL-NEXT: vxorps %xmm1, %xmm1, %xmm1
2243 ; AVX512VL-NEXT: vmovss {{.*#+}} xmm0 = xmm0[0],xmm1[1,2,3]
2244 ; AVX512VL-NEXT: retq
2245 %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>
2249 define <4 x i64> @unpckh_v4i64(<4 x i64> %x, <4 x i64> %y) {
2250 ; ALL-LABEL: unpckh_v4i64:
2252 ; ALL-NEXT: vextractf128 $1, %ymm1, %xmm1
2253 ; ALL-NEXT: vunpckhpd {{.*#+}} xmm0 = xmm0[1],xmm1[1]
2255 %unpckh = shufflevector <4 x i64> %x, <4 x i64> %y, <4 x i32> <i32 1, i32 7, i32 undef, i32 undef>
2256 ret <4 x i64> %unpckh
2259 define <4 x double> @unpckh_v4f64(<4 x double> %x, <4 x double> %y) {
2260 ; ALL-LABEL: unpckh_v4f64:
2262 ; ALL-NEXT: vextractf128 $1, %ymm1, %xmm1
2263 ; ALL-NEXT: vunpckhpd {{.*#+}} xmm0 = xmm0[1],xmm1[1]
2265 %unpckh = shufflevector <4 x double> %x, <4 x double> %y, <4 x i32> <i32 1, i32 7, i32 undef, i32 undef>
2266 ret <4 x double> %unpckh
2269 !llvm.module.flags = !{!0}
2270 !0 = !{i32 1, !"ProfileSummary", !1}
2271 !1 = !{!2, !3, !4, !5, !6, !7, !8, !9}
2272 !2 = !{!"ProfileFormat", !"InstrProf"}
2273 !3 = !{!"TotalCount", i64 10000}
2274 !4 = !{!"MaxCount", i64 10}
2275 !5 = !{!"MaxInternalCount", i64 1}
2276 !6 = !{!"MaxFunctionCount", i64 1000}
2277 !7 = !{!"NumCounts", i64 3}
2278 !8 = !{!"NumFunctions", i64 3}
2279 !9 = !{!"DetailedSummary", !10}
2280 !10 = !{!11, !12, !13}
2281 !11 = !{i32 10000, i64 100, i32 1}
2282 !12 = !{i32 999000, i64 100, i32 1}
2283 !13 = !{i32 999999, i64 1, i32 2}
2284 !14 = !{!"function_entry_count", i64 0}