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
702 define <4 x double> @shuffle_v4f64_0z3z(<4 x double> %a, <4 x double> %b) {
703 ; ALL-LABEL: shuffle_v4f64_0z3z:
705 ; ALL-NEXT: vxorpd %xmm1, %xmm1, %xmm1
706 ; ALL-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[0],ymm1[0],ymm0[3],ymm1[2]
708 %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>
709 ret <4 x double> %shuffle
712 define <4 x double> @shuffle_v4f64_1z2z(<4 x double> %a, <4 x double> %b) {
713 ; ALL-LABEL: shuffle_v4f64_1z2z:
715 ; ALL-NEXT: vxorpd %xmm1, %xmm1, %xmm1
716 ; ALL-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1],ymm1[0],ymm0[2],ymm1[2]
718 %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>
722 define <4 x double> @shuffle_v4f64_0044(<4 x double> %a, <4 x double> %b) {
723 ; AVX1-LABEL: shuffle_v4f64_0044:
725 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
726 ; AVX1-NEXT: vmovddup {{.*#+}} ymm0 = ymm0[0,0,2,2]
729 ; AVX2-LABEL: shuffle_v4f64_0044:
731 ; AVX2-NEXT: vmovlhps {{.*#+}} xmm0 = xmm0[0],xmm1[0]
732 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,1,1]
735 ; AVX512VL-SLOW-LABEL: shuffle_v4f64_0044:
736 ; AVX512VL-SLOW: # %bb.0:
737 ; AVX512VL-SLOW-NEXT: vmovlhps {{.*#+}} xmm0 = xmm0[0],xmm1[0]
738 ; AVX512VL-SLOW-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,1,1]
739 ; AVX512VL-SLOW-NEXT: retq
741 ; AVX512VL-FAST-ALL-LABEL: shuffle_v4f64_0044:
742 ; AVX512VL-FAST-ALL: # %bb.0:
743 ; AVX512VL-FAST-ALL-NEXT: vmovapd {{.*#+}} ymm2 = [0,0,4,4]
744 ; AVX512VL-FAST-ALL-NEXT: vpermt2pd %ymm1, %ymm2, %ymm0
745 ; AVX512VL-FAST-ALL-NEXT: retq
747 ; AVX512VL-FAST-PERLANE-LABEL: shuffle_v4f64_0044:
748 ; AVX512VL-FAST-PERLANE: # %bb.0:
749 ; AVX512VL-FAST-PERLANE-NEXT: vmovlhps {{.*#+}} xmm0 = xmm0[0],xmm1[0]
750 ; AVX512VL-FAST-PERLANE-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,1,1]
751 ; AVX512VL-FAST-PERLANE-NEXT: retq
752 %1 = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 0, i32 0, i32 4, i32 4>
756 define <4 x double> @shuffle_v4f64_0044_v2f64(<2 x double> %a, <2 x double> %b) {
757 ; ALL-LABEL: shuffle_v4f64_0044_v2f64:
759 ; ALL-NEXT: # kill: def $xmm0 killed $xmm0 def $ymm0
760 ; ALL-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
761 ; ALL-NEXT: vmovddup {{.*#+}} ymm0 = ymm0[0,0,2,2]
763 %1 = shufflevector <2 x double> %a, <2 x double> undef, <2 x i32> <i32 0, i32 0>
764 %2 = shufflevector <2 x double> %b, <2 x double> undef, <2 x i32> <i32 0, i32 0>
765 %3 = shufflevector <2 x double> %1, <2 x double> %2, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
769 define <4 x double> @shuffle_v4f64_1032_v2f64(<2 x double> %a, <2 x double> %b) {
770 ; ALL-LABEL: shuffle_v4f64_1032_v2f64:
772 ; ALL-NEXT: # kill: def $xmm0 killed $xmm0 def $ymm0
773 ; ALL-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
774 ; ALL-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1,0,3,2]
776 %1 = shufflevector <2 x double> %a, <2 x double> undef, <2 x i32> <i32 1, i32 0>
777 %2 = shufflevector <2 x double> %b, <2 x double> undef, <2 x i32> <i32 1, i32 0>
778 %3 = shufflevector <2 x double> %1, <2 x double> %2, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
783 define <4 x double> @shuffle_v4f64_2345_0567_select(<4 x double> %vec1, <4 x double> %vec2, <4 x double> %vec3) {
784 ; ALL-LABEL: shuffle_v4f64_2345_0567_select:
786 ; ALL-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3],ymm1[0,1]
787 ; ALL-NEXT: vblendps {{.*#+}} ymm0 = ymm2[0,1],ymm0[2,3,4,5,6,7]
789 %shuf = shufflevector <4 x double> %vec1, <4 x double> %vec2, <4 x i32> <i32 2, i32 3, i32 4, i32 5>
790 %res = select <4 x i1> <i1 0, i1 1, i1 1, i1 1>, <4 x double> %shuf, <4 x double> %vec3
791 ret <4 x double> %res
794 define <4 x i64> @shuffle_v4i64_0000(<4 x i64> %a, <4 x i64> %b) {
795 ; AVX1-LABEL: shuffle_v4i64_0000:
797 ; AVX1-NEXT: vshufps {{.*#+}} xmm0 = xmm0[0,1,0,1]
798 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
801 ; AVX2-LABEL: shuffle_v4i64_0000:
803 ; AVX2-NEXT: vbroadcastsd %xmm0, %ymm0
806 ; AVX512VL-LABEL: shuffle_v4i64_0000:
808 ; AVX512VL-NEXT: vbroadcastsd %xmm0, %ymm0
809 ; AVX512VL-NEXT: retq
810 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
811 ret <4 x i64> %shuffle
814 define <4 x i64> @shuffle_v4i64_0001(<4 x i64> %a, <4 x i64> %b) {
815 ; AVX1-LABEL: shuffle_v4i64_0001:
817 ; AVX1-NEXT: vshufps {{.*#+}} xmm1 = xmm0[0,1,0,1]
818 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0
821 ; AVX2-LABEL: shuffle_v4i64_0001:
823 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,0,1]
826 ; AVX512VL-LABEL: shuffle_v4i64_0001:
828 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,0,1]
829 ; AVX512VL-NEXT: retq
830 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 0, i32 0, i32 1>
831 ret <4 x i64> %shuffle
834 define <4 x i64> @shuffle_v4i64_0020(<4 x i64> %a, <4 x i64> %b) {
835 ; AVX1-LABEL: shuffle_v4i64_0020:
837 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm1
838 ; AVX1-NEXT: vunpcklpd {{.*#+}} ymm0 = ymm0[0],ymm1[0],ymm0[2],ymm1[2]
841 ; AVX2-LABEL: shuffle_v4i64_0020:
843 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,2,0]
846 ; AVX512VL-LABEL: shuffle_v4i64_0020:
848 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,2,0]
849 ; AVX512VL-NEXT: retq
850 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 0, i32 2, i32 0>
851 ret <4 x i64> %shuffle
854 define <4 x i64> @shuffle_v4i64_0112(<4 x i64> %a, <4 x i64> %b) {
855 ; AVX1-LABEL: shuffle_v4i64_0112:
857 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm1
858 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm1[0],ymm0[1],ymm1[3],ymm0[2]
861 ; AVX2-LABEL: shuffle_v4i64_0112:
863 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,1,1,2]
866 ; AVX512VL-LABEL: shuffle_v4i64_0112:
868 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,1,1,2]
869 ; AVX512VL-NEXT: retq
870 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 1, i32 1, i32 2>
871 ret <4 x i64> %shuffle
874 define <4 x i64> @shuffle_v4i64_0300(<4 x i64> %a, <4 x i64> %b) {
875 ; AVX1-LABEL: shuffle_v4i64_0300:
877 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm1 = ymm0[2,3,0,1]
878 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
879 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[0],ymm1[1],ymm0[2],ymm1[2]
882 ; AVX2-LABEL: shuffle_v4i64_0300:
884 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,3,0,0]
887 ; AVX512VL-LABEL: shuffle_v4i64_0300:
889 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,3,0,0]
890 ; AVX512VL-NEXT: retq
891 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 3, i32 0, i32 0>
892 ret <4 x i64> %shuffle
895 define <4 x i64> @shuffle_v4i64_1000(<4 x i64> %a, <4 x i64> %b) {
896 ; AVX1-LABEL: shuffle_v4i64_1000:
898 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
899 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1,0,2,2]
902 ; AVX2-LABEL: shuffle_v4i64_1000:
904 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[1,0,0,0]
907 ; AVX512VL-LABEL: shuffle_v4i64_1000:
909 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[1,0,0,0]
910 ; AVX512VL-NEXT: retq
911 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 1, i32 0, i32 0, i32 0>
912 ret <4 x i64> %shuffle
915 define <4 x i64> @shuffle_v4i64_2200(<4 x i64> %a, <4 x i64> %b) {
916 ; AVX1-LABEL: shuffle_v4i64_2200:
918 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3,0,1]
919 ; AVX1-NEXT: vmovddup {{.*#+}} ymm0 = ymm0[0,0,2,2]
922 ; AVX2-LABEL: shuffle_v4i64_2200:
924 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,2,0,0]
927 ; AVX512VL-LABEL: shuffle_v4i64_2200:
929 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,2,0,0]
930 ; AVX512VL-NEXT: retq
931 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 2, i32 2, i32 0, i32 0>
932 ret <4 x i64> %shuffle
935 define <4 x i64> @shuffle_v4i64_3330(<4 x i64> %a, <4 x i64> %b) {
936 ; AVX1-LABEL: shuffle_v4i64_3330:
938 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm1 = ymm0[2,3,0,1]
939 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3,2,3]
940 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1],ymm1[1],ymm0[3],ymm1[2]
943 ; AVX2-LABEL: shuffle_v4i64_3330:
945 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[3,3,3,0]
948 ; AVX512VL-LABEL: shuffle_v4i64_3330:
950 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[3,3,3,0]
951 ; AVX512VL-NEXT: retq
952 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 3, i32 3, i32 3, i32 0>
953 ret <4 x i64> %shuffle
956 define <4 x i64> @shuffle_v4i64_3210(<4 x i64> %a, <4 x i64> %b) {
957 ; AVX1-LABEL: shuffle_v4i64_3210:
959 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3,0,1]
960 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1,0,3,2]
963 ; AVX2-LABEL: shuffle_v4i64_3210:
965 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[3,2,1,0]
968 ; AVX512VL-LABEL: shuffle_v4i64_3210:
970 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[3,2,1,0]
971 ; AVX512VL-NEXT: retq
972 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 3, i32 2, i32 1, i32 0>
973 ret <4 x i64> %shuffle
976 define <4 x i64> @shuffle_v4i64_0213(<4 x i64> %a, <4 x i64> %b) {
977 ; AVX1-LABEL: shuffle_v4i64_0213:
979 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm1 = ymm0[2,3,2,3]
980 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
981 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[0],ymm1[0],ymm0[3],ymm1[3]
984 ; AVX2-LABEL: shuffle_v4i64_0213:
986 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,2,1,3]
989 ; AVX512VL-LABEL: shuffle_v4i64_0213:
991 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,2,1,3]
992 ; AVX512VL-NEXT: retq
993 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 2, i32 1, i32 3>
994 ret <4 x i64> %shuffle
997 define <4 x i64> @shuffle_v4i64_0124(<4 x i64> %a, <4 x i64> %b) {
998 ; AVX1-LABEL: shuffle_v4i64_0124:
1000 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm1
1001 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[0],ymm1[1],ymm0[2],ymm1[2]
1004 ; AVX2-LABEL: shuffle_v4i64_0124:
1006 ; AVX2-NEXT: vbroadcastsd %xmm1, %ymm1
1007 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1,2,3,4,5],ymm1[6,7]
1010 ; AVX512VL-SLOW-LABEL: shuffle_v4i64_0124:
1011 ; AVX512VL-SLOW: # %bb.0:
1012 ; AVX512VL-SLOW-NEXT: vbroadcastsd %xmm1, %ymm1
1013 ; AVX512VL-SLOW-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1,2,3,4,5],ymm1[6,7]
1014 ; AVX512VL-SLOW-NEXT: retq
1016 ; AVX512VL-FAST-ALL-LABEL: shuffle_v4i64_0124:
1017 ; AVX512VL-FAST-ALL: # %bb.0:
1018 ; AVX512VL-FAST-ALL-NEXT: vmovdqa {{.*#+}} ymm2 = [0,1,2,4]
1019 ; AVX512VL-FAST-ALL-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
1020 ; AVX512VL-FAST-ALL-NEXT: retq
1022 ; AVX512VL-FAST-PERLANE-LABEL: shuffle_v4i64_0124:
1023 ; AVX512VL-FAST-PERLANE: # %bb.0:
1024 ; AVX512VL-FAST-PERLANE-NEXT: vbroadcastsd %xmm1, %ymm1
1025 ; AVX512VL-FAST-PERLANE-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1,2,3,4,5],ymm1[6,7]
1026 ; AVX512VL-FAST-PERLANE-NEXT: retq
1027 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 1, i32 2, i32 4>
1028 ret <4 x i64> %shuffle
1031 define <4 x i64> @shuffle_v4i64_0142(<4 x i64> %a, <4 x i64> %b) {
1032 ; AVX1-LABEL: shuffle_v4i64_0142:
1034 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm1
1035 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm1[0],ymm0[1],ymm1[2],ymm0[2]
1038 ; AVX2-LABEL: shuffle_v4i64_0142:
1040 ; AVX2-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm1
1041 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,1,2,2]
1042 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1,2,3],ymm1[4,5],ymm0[6,7]
1045 ; AVX512VL-LABEL: shuffle_v4i64_0142:
1046 ; AVX512VL: # %bb.0:
1047 ; AVX512VL-NEXT: vmovdqa {{.*#+}} ymm2 = [0,1,4,2]
1048 ; AVX512VL-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
1049 ; AVX512VL-NEXT: retq
1050 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 1, i32 4, i32 2>
1051 ret <4 x i64> %shuffle
1054 define <4 x i64> @shuffle_v4i64_0412(<4 x i64> %a, <4 x i64> %b) {
1055 ; AVX1-LABEL: shuffle_v4i64_0412:
1057 ; AVX1-NEXT: vblendpd {{.*#+}} ymm1 = ymm1[0,1],ymm0[2,3]
1058 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
1059 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[0],ymm1[0],ymm0[3],ymm1[2]
1062 ; AVX2-LABEL: shuffle_v4i64_0412:
1064 ; AVX2-NEXT: vmovddup {{.*#+}} xmm1 = xmm1[0,0]
1065 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,1,1,2]
1066 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1],ymm1[2,3],ymm0[4,5,6,7]
1069 ; AVX512VL-LABEL: shuffle_v4i64_0412:
1070 ; AVX512VL: # %bb.0:
1071 ; AVX512VL-NEXT: vmovdqa {{.*#+}} ymm2 = [0,4,1,2]
1072 ; AVX512VL-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
1073 ; AVX512VL-NEXT: retq
1074 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 4, i32 1, i32 2>
1075 ret <4 x i64> %shuffle
1078 define <4 x i64> @shuffle_v4i64_4012(<4 x i64> %a, <4 x i64> %b) {
1079 ; AVX1-LABEL: shuffle_v4i64_4012:
1081 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm1
1082 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm1[0],ymm0[0],ymm1[3],ymm0[2]
1085 ; AVX2-LABEL: shuffle_v4i64_4012:
1087 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,1,2]
1088 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3,4,5,6,7]
1091 ; AVX512VL-SLOW-LABEL: shuffle_v4i64_4012:
1092 ; AVX512VL-SLOW: # %bb.0:
1093 ; AVX512VL-SLOW-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,1,2]
1094 ; AVX512VL-SLOW-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3,4,5,6,7]
1095 ; AVX512VL-SLOW-NEXT: retq
1097 ; AVX512VL-FAST-ALL-LABEL: shuffle_v4i64_4012:
1098 ; AVX512VL-FAST-ALL: # %bb.0:
1099 ; AVX512VL-FAST-ALL-NEXT: vmovdqa {{.*#+}} ymm2 = [4,0,1,2]
1100 ; AVX512VL-FAST-ALL-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
1101 ; AVX512VL-FAST-ALL-NEXT: retq
1103 ; AVX512VL-FAST-PERLANE-LABEL: shuffle_v4i64_4012:
1104 ; AVX512VL-FAST-PERLANE: # %bb.0:
1105 ; AVX512VL-FAST-PERLANE-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,1,2]
1106 ; AVX512VL-FAST-PERLANE-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3,4,5,6,7]
1107 ; AVX512VL-FAST-PERLANE-NEXT: retq
1108 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 4, i32 0, i32 1, i32 2>
1109 ret <4 x i64> %shuffle
1112 define <4 x i64> @shuffle_v4i64_0145(<4 x i64> %a, <4 x i64> %b) {
1113 ; ALL-LABEL: shuffle_v4i64_0145:
1115 ; ALL-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
1117 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 1, i32 4, i32 5>
1118 ret <4 x i64> %shuffle
1121 define <4 x i64> @shuffle_v4i64_0451(<4 x i64> %a, <4 x i64> %b) {
1122 ; AVX1-LABEL: shuffle_v4i64_0451:
1124 ; AVX1-NEXT: vunpckhpd {{.*#+}} xmm2 = xmm1[1],xmm0[1]
1125 ; AVX1-NEXT: vmovlhps {{.*#+}} xmm0 = xmm0[0],xmm1[0]
1126 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
1129 ; AVX2-LABEL: shuffle_v4i64_0451:
1131 ; AVX2-NEXT: vpermpd {{.*#+}} ymm1 = ymm1[0,0,1,3]
1132 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,1,2,1]
1133 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1],ymm1[2,3,4,5],ymm0[6,7]
1136 ; AVX512VL-LABEL: shuffle_v4i64_0451:
1137 ; AVX512VL: # %bb.0:
1138 ; AVX512VL-NEXT: vmovdqa {{.*#+}} ymm2 = [0,4,5,1]
1139 ; AVX512VL-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
1140 ; AVX512VL-NEXT: retq
1141 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 4, i32 5, i32 1>
1142 ret <4 x i64> %shuffle
1145 define <4 x i64> @shuffle_v4i64_4501(<4 x i64> %a, <4 x i64> %b) {
1146 ; ALL-LABEL: shuffle_v4i64_4501:
1148 ; ALL-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0
1150 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 4, i32 5, i32 0, i32 1>
1151 ret <4 x i64> %shuffle
1154 define <4 x i64> @shuffle_v4i64_4015(<4 x i64> %a, <4 x i64> %b) {
1155 ; AVX1-LABEL: shuffle_v4i64_4015:
1157 ; AVX1-NEXT: vunpckhpd {{.*#+}} xmm2 = xmm0[1],xmm1[1]
1158 ; AVX1-NEXT: vmovlhps {{.*#+}} xmm0 = xmm1[0],xmm0[0]
1159 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
1162 ; AVX2-LABEL: shuffle_v4i64_4015:
1164 ; AVX2-NEXT: vpermpd {{.*#+}} ymm1 = ymm1[0,1,2,1]
1165 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,1,3]
1166 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3,4,5],ymm1[6,7]
1169 ; AVX512VL-LABEL: shuffle_v4i64_4015:
1170 ; AVX512VL: # %bb.0:
1171 ; AVX512VL-NEXT: vmovdqa {{.*#+}} ymm2 = [4,0,1,5]
1172 ; AVX512VL-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
1173 ; AVX512VL-NEXT: retq
1174 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 4, i32 0, i32 1, i32 5>
1175 ret <4 x i64> %shuffle
1178 define <4 x i64> @shuffle_v4i64_2u35(<4 x i64> %a, <4 x i64> %b) {
1179 ; AVX1-LABEL: shuffle_v4i64_2u35:
1181 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3,2,3]
1182 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm1
1183 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[0],ymm1[0],ymm0[3],ymm1[3]
1186 ; AVX2-LABEL: shuffle_v4i64_2u35:
1188 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
1189 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,1,3,1]
1192 ; AVX512VL-SLOW-LABEL: shuffle_v4i64_2u35:
1193 ; AVX512VL-SLOW: # %bb.0:
1194 ; AVX512VL-SLOW-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
1195 ; AVX512VL-SLOW-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,1,3,1]
1196 ; AVX512VL-SLOW-NEXT: retq
1198 ; AVX512VL-FAST-ALL-LABEL: shuffle_v4i64_2u35:
1199 ; AVX512VL-FAST-ALL: # %bb.0:
1200 ; AVX512VL-FAST-ALL-NEXT: vmovdqa {{.*#+}} ymm2 = [2,5,3,5]
1201 ; AVX512VL-FAST-ALL-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
1202 ; AVX512VL-FAST-ALL-NEXT: retq
1204 ; AVX512VL-FAST-PERLANE-LABEL: shuffle_v4i64_2u35:
1205 ; AVX512VL-FAST-PERLANE: # %bb.0:
1206 ; AVX512VL-FAST-PERLANE-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
1207 ; AVX512VL-FAST-PERLANE-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,1,3,1]
1208 ; AVX512VL-FAST-PERLANE-NEXT: retq
1209 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 2, i32 undef, i32 3, i32 5>
1210 ret <4 x i64> %shuffle
1213 define <4 x i64> @shuffle_v4i64_1251(<4 x i64> %a, <4 x i64> %b) {
1214 ; AVX1-LABEL: shuffle_v4i64_1251:
1216 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm2 = ymm0[2,3,0,1]
1217 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
1218 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1],ymm2[0],ymm0[3],ymm2[3]
1221 ; AVX2-LABEL: shuffle_v4i64_1251:
1223 ; AVX2-NEXT: vpermpd {{.*#+}} ymm1 = ymm1[1,1,1,1]
1224 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[1,2,2,1]
1225 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1,2,3],ymm1[4,5],ymm0[6,7]
1228 ; AVX512VL-LABEL: shuffle_v4i64_1251:
1229 ; AVX512VL: # %bb.0:
1230 ; AVX512VL-NEXT: vmovdqa {{.*#+}} ymm2 = [1,2,5,1]
1231 ; AVX512VL-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
1232 ; AVX512VL-NEXT: retq
1233 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 1, i32 2, i32 5, i32 1>
1234 ret <4 x i64> %shuffle
1237 define <4 x i64> @shuffle_v4i64_1054(<4 x i64> %a, <4 x i64> %b) {
1238 ; AVX1-LABEL: shuffle_v4i64_1054:
1240 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
1241 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1,0,3,2]
1244 ; AVX2-LABEL: shuffle_v4i64_1054:
1246 ; AVX2-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
1247 ; AVX2-NEXT: vshufps {{.*#+}} ymm0 = ymm0[2,3,0,1,6,7,4,5]
1250 ; AVX512VL-SLOW-LABEL: shuffle_v4i64_1054:
1251 ; AVX512VL-SLOW: # %bb.0:
1252 ; AVX512VL-SLOW-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
1253 ; AVX512VL-SLOW-NEXT: vshufps {{.*#+}} ymm0 = ymm0[2,3,0,1,6,7,4,5]
1254 ; AVX512VL-SLOW-NEXT: retq
1256 ; AVX512VL-FAST-ALL-LABEL: shuffle_v4i64_1054:
1257 ; AVX512VL-FAST-ALL: # %bb.0:
1258 ; AVX512VL-FAST-ALL-NEXT: vmovdqa {{.*#+}} ymm2 = [1,0,5,4]
1259 ; AVX512VL-FAST-ALL-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
1260 ; AVX512VL-FAST-ALL-NEXT: retq
1262 ; AVX512VL-FAST-PERLANE-LABEL: shuffle_v4i64_1054:
1263 ; AVX512VL-FAST-PERLANE: # %bb.0:
1264 ; AVX512VL-FAST-PERLANE-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
1265 ; AVX512VL-FAST-PERLANE-NEXT: vshufps {{.*#+}} ymm0 = ymm0[2,3,0,1,6,7,4,5]
1266 ; AVX512VL-FAST-PERLANE-NEXT: retq
1267 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 1, i32 0, i32 5, i32 4>
1268 ret <4 x i64> %shuffle
1271 define <4 x i64> @shuffle_v4i64_3254(<4 x i64> %a, <4 x i64> %b) {
1272 ; AVX1-LABEL: shuffle_v4i64_3254:
1274 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3],ymm1[0,1]
1275 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1,0,3,2]
1278 ; AVX2-LABEL: shuffle_v4i64_3254:
1280 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
1281 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[3,2,1,0]
1284 ; AVX512VL-SLOW-LABEL: shuffle_v4i64_3254:
1285 ; AVX512VL-SLOW: # %bb.0:
1286 ; AVX512VL-SLOW-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
1287 ; AVX512VL-SLOW-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[3,2,1,0]
1288 ; AVX512VL-SLOW-NEXT: retq
1290 ; AVX512VL-FAST-ALL-LABEL: shuffle_v4i64_3254:
1291 ; AVX512VL-FAST-ALL: # %bb.0:
1292 ; AVX512VL-FAST-ALL-NEXT: vmovdqa {{.*#+}} ymm2 = [3,2,5,4]
1293 ; AVX512VL-FAST-ALL-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
1294 ; AVX512VL-FAST-ALL-NEXT: retq
1296 ; AVX512VL-FAST-PERLANE-LABEL: shuffle_v4i64_3254:
1297 ; AVX512VL-FAST-PERLANE: # %bb.0:
1298 ; AVX512VL-FAST-PERLANE-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
1299 ; AVX512VL-FAST-PERLANE-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[3,2,1,0]
1300 ; AVX512VL-FAST-PERLANE-NEXT: retq
1301 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 3, i32 2, i32 5, i32 4>
1302 ret <4 x i64> %shuffle
1305 define <4 x i64> @shuffle_v4i64_3276(<4 x i64> %a, <4 x i64> %b) {
1306 ; AVX1-LABEL: shuffle_v4i64_3276:
1308 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3],ymm1[2,3]
1309 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1,0,3,2]
1312 ; AVX2-LABEL: shuffle_v4i64_3276:
1314 ; AVX2-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3],ymm1[2,3]
1315 ; AVX2-NEXT: vshufps {{.*#+}} ymm0 = ymm0[2,3,0,1,6,7,4,5]
1318 ; AVX512VL-SLOW-LABEL: shuffle_v4i64_3276:
1319 ; AVX512VL-SLOW: # %bb.0:
1320 ; AVX512VL-SLOW-NEXT: vperm2i128 {{.*#+}} ymm0 = ymm0[2,3],ymm1[2,3]
1321 ; AVX512VL-SLOW-NEXT: vpshufd {{.*#+}} ymm0 = ymm0[2,3,0,1,6,7,4,5]
1322 ; AVX512VL-SLOW-NEXT: retq
1324 ; AVX512VL-FAST-ALL-LABEL: shuffle_v4i64_3276:
1325 ; AVX512VL-FAST-ALL: # %bb.0:
1326 ; AVX512VL-FAST-ALL-NEXT: vmovdqa {{.*#+}} ymm2 = [3,2,7,6]
1327 ; AVX512VL-FAST-ALL-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
1328 ; AVX512VL-FAST-ALL-NEXT: retq
1330 ; AVX512VL-FAST-PERLANE-LABEL: shuffle_v4i64_3276:
1331 ; AVX512VL-FAST-PERLANE: # %bb.0:
1332 ; AVX512VL-FAST-PERLANE-NEXT: vperm2i128 {{.*#+}} ymm0 = ymm0[2,3],ymm1[2,3]
1333 ; AVX512VL-FAST-PERLANE-NEXT: vpshufd {{.*#+}} ymm0 = ymm0[2,3,0,1,6,7,4,5]
1334 ; AVX512VL-FAST-PERLANE-NEXT: retq
1335 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 3, i32 2, i32 7, i32 6>
1336 ret <4 x i64> %shuffle
1339 define <4 x i64> @shuffle_v4i64_1076(<4 x i64> %a, <4 x i64> %b) {
1340 ; AVX1-LABEL: shuffle_v4i64_1076:
1342 ; AVX1-NEXT: vblendpd {{.*#+}} ymm0 = ymm0[0,1],ymm1[2,3]
1343 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1,0,3,2]
1346 ; AVX2-LABEL: shuffle_v4i64_1076:
1348 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1,2,3],ymm1[4,5,6,7]
1349 ; AVX2-NEXT: vshufps {{.*#+}} ymm0 = ymm0[2,3,0,1,6,7,4,5]
1352 ; AVX512VL-SLOW-LABEL: shuffle_v4i64_1076:
1353 ; AVX512VL-SLOW: # %bb.0:
1354 ; AVX512VL-SLOW-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1,2,3],ymm1[4,5,6,7]
1355 ; AVX512VL-SLOW-NEXT: vshufps {{.*#+}} ymm0 = ymm0[2,3,0,1,6,7,4,5]
1356 ; AVX512VL-SLOW-NEXT: retq
1358 ; AVX512VL-FAST-LABEL: shuffle_v4i64_1076:
1359 ; AVX512VL-FAST: # %bb.0:
1360 ; AVX512VL-FAST-NEXT: vmovdqa {{.*#+}} ymm2 = [1,0,7,6]
1361 ; AVX512VL-FAST-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
1362 ; AVX512VL-FAST-NEXT: retq
1363 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 1, i32 0, i32 7, i32 6>
1364 ret <4 x i64> %shuffle
1367 define <4 x i64> @shuffle_v4i64_0415(<4 x i64> %a, <4 x i64> %b) {
1368 ; AVX1-LABEL: shuffle_v4i64_0415:
1370 ; AVX1-NEXT: vunpckhpd {{.*#+}} xmm2 = xmm0[1],xmm1[1]
1371 ; AVX1-NEXT: vmovlhps {{.*#+}} xmm0 = xmm0[0],xmm1[0]
1372 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
1375 ; AVX2-LABEL: shuffle_v4i64_0415:
1377 ; AVX2-NEXT: vpermpd {{.*#+}} ymm1 = ymm1[0,0,2,1]
1378 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,1,1,3]
1379 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1],ymm1[2,3],ymm0[4,5],ymm1[6,7]
1382 ; AVX512VL-LABEL: shuffle_v4i64_0415:
1383 ; AVX512VL: # %bb.0:
1384 ; AVX512VL-NEXT: vmovdqa {{.*#+}} ymm2 = [0,4,1,5]
1385 ; AVX512VL-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
1386 ; AVX512VL-NEXT: retq
1387 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 4, i32 1, i32 5>
1388 ret <4 x i64> %shuffle
1391 define <4 x i64> @shuffle_v4i64_2741(<4 x i64> %a, <4 x i64> %b) {
1392 ; AVX1-LABEL: shuffle_v4i64_2741:
1394 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm2 = ymm1[2,3],ymm0[0,1]
1395 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3],ymm1[0,1]
1396 ; AVX1-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1],ymm2[2,3],ymm0[4,5],ymm2[6,7]
1399 ; AVX2-LABEL: shuffle_v4i64_2741:
1401 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3,4,5],ymm1[6,7]
1402 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,3,0,1]
1405 ; AVX512VL-SLOW-LABEL: shuffle_v4i64_2741:
1406 ; AVX512VL-SLOW: # %bb.0:
1407 ; AVX512VL-SLOW-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3,4,5],ymm1[6,7]
1408 ; AVX512VL-SLOW-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,3,0,1]
1409 ; AVX512VL-SLOW-NEXT: retq
1411 ; AVX512VL-FAST-ALL-LABEL: shuffle_v4i64_2741:
1412 ; AVX512VL-FAST-ALL: # %bb.0:
1413 ; AVX512VL-FAST-ALL-NEXT: vmovdqa {{.*#+}} ymm2 = [2,7,4,1]
1414 ; AVX512VL-FAST-ALL-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
1415 ; AVX512VL-FAST-ALL-NEXT: retq
1417 ; AVX512VL-FAST-PERLANE-LABEL: shuffle_v4i64_2741:
1418 ; AVX512VL-FAST-PERLANE: # %bb.0:
1419 ; AVX512VL-FAST-PERLANE-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3,4,5],ymm1[6,7]
1420 ; AVX512VL-FAST-PERLANE-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,3,0,1]
1421 ; AVX512VL-FAST-PERLANE-NEXT: retq
1422 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 2, i32 7, i32 4, i32 1>
1423 ret <4 x i64> %shuffle
1427 define <4 x i64> @shuffle_v4i64_0437(<4 x i64> %a, <4 x i64> %b) {
1428 ; AVX1-LABEL: shuffle_v4i64_0437:
1430 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[0],ymm1[0],ymm0[3],ymm1[3]
1433 ; AVX2-LABEL: shuffle_v4i64_0437:
1435 ; AVX2-NEXT: vpermpd {{.*#+}} ymm1 = ymm1[0,0,2,3]
1436 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,1,3,3]
1437 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1],ymm1[2,3],ymm0[4,5],ymm1[6,7]
1440 ; AVX512VL-LABEL: shuffle_v4i64_0437:
1441 ; AVX512VL: # %bb.0:
1442 ; AVX512VL-NEXT: vmovdqa {{.*#+}} ymm2 = [0,4,3,7]
1443 ; AVX512VL-NEXT: vpermt2q %ymm1, %ymm2, %ymm0
1444 ; AVX512VL-NEXT: retq
1445 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 4, i32 3, i32 7>
1446 ret <4 x i64> %shuffle
1449 define <4 x i64> @shuffle_v4i64_z4z6(<4 x i64> %a) {
1450 ; AVX1-LABEL: shuffle_v4i64_z4z6:
1452 ; AVX1-NEXT: vxorps %xmm1, %xmm1, %xmm1
1453 ; AVX1-NEXT: vunpcklpd {{.*#+}} ymm0 = ymm1[0],ymm0[0],ymm1[2],ymm0[2]
1456 ; AVX2-LABEL: shuffle_v4i64_z4z6:
1458 ; 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]
1461 ; AVX512VL-LABEL: shuffle_v4i64_z4z6:
1462 ; AVX512VL: # %bb.0:
1463 ; 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]
1464 ; AVX512VL-NEXT: retq
1465 %shuffle = shufflevector <4 x i64> zeroinitializer, <4 x i64> %a, <4 x i32> <i32 0, i32 4, i32 0, i32 6>
1466 ret <4 x i64> %shuffle
1469 define <4 x i64> @shuffle_v4i64_5zuz(<4 x i64> %a) {
1470 ; AVX1-LABEL: shuffle_v4i64_5zuz:
1472 ; AVX1-NEXT: vxorps %xmm1, %xmm1, %xmm1
1473 ; AVX1-NEXT: vunpckhpd {{.*#+}} ymm0 = ymm0[1],ymm1[1],ymm0[3],ymm1[3]
1476 ; AVX2-LABEL: shuffle_v4i64_5zuz:
1478 ; 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
1481 ; AVX512VL-LABEL: shuffle_v4i64_5zuz:
1482 ; AVX512VL: # %bb.0:
1483 ; 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
1484 ; AVX512VL-NEXT: retq
1485 %shuffle = shufflevector <4 x i64> zeroinitializer, <4 x i64> %a, <4 x i32> <i32 5, i32 0, i32 undef, i32 0>
1486 ret <4 x i64> %shuffle
1489 define <4 x i64> @shuffle_v4i64_40u2(<4 x i64> %a, <4 x i64> %b) {
1490 ; ALL-LABEL: shuffle_v4i64_40u2:
1492 ; ALL-NEXT: vunpcklpd {{.*#+}} ymm0 = ymm1[0],ymm0[0],ymm1[2],ymm0[2]
1494 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 4, i32 0, i32 undef, i32 2>
1495 ret <4 x i64> %shuffle
1498 define <4 x i64> @shuffle_v4i64_15uu(<4 x i64> %a, <4 x i64> %b) {
1499 ; ALL-LABEL: shuffle_v4i64_15uu:
1501 ; ALL-NEXT: vunpckhpd {{.*#+}} xmm0 = xmm0[1],xmm1[1]
1503 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 1, i32 5, i32 undef, i32 undef>
1504 ret <4 x i64> %shuffle
1507 define <4 x i64> @shuffle_v4i64_11uu(<4 x i64> %a, <4 x i64> %b) {
1508 ; ALL-LABEL: shuffle_v4i64_11uu:
1510 ; ALL-NEXT: vshufps {{.*#+}} xmm0 = xmm0[2,3,2,3]
1512 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 1, i32 1, i32 undef, i32 undef>
1513 ret <4 x i64> %shuffle
1516 define <4 x i64> @shuffle_v4i64_22uu(<4 x i64> %a, <4 x i64> %b) {
1517 ; AVX1-LABEL: shuffle_v4i64_22uu:
1519 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm0
1520 ; AVX1-NEXT: vshufps {{.*#+}} xmm0 = xmm0[0,1,0,1]
1523 ; AVX2-LABEL: shuffle_v4i64_22uu:
1525 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,2,2,2]
1528 ; AVX512VL-LABEL: shuffle_v4i64_22uu:
1529 ; AVX512VL: # %bb.0:
1530 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[2,2,2,2]
1531 ; AVX512VL-NEXT: retq
1532 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 2, i32 2, i32 undef, i32 undef>
1533 ret <4 x i64> %shuffle
1536 define <4 x i64> @shuffle_v4i64_3333(<4 x i64> %a, <4 x i64> %b) {
1537 ; AVX1-LABEL: shuffle_v4i64_3333:
1539 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm0 = ymm0[2,3,2,3]
1540 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1,1,3,3]
1543 ; AVX2-LABEL: shuffle_v4i64_3333:
1545 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[3,3,3,3]
1548 ; AVX512VL-LABEL: shuffle_v4i64_3333:
1549 ; AVX512VL: # %bb.0:
1550 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[3,3,3,3]
1551 ; AVX512VL-NEXT: retq
1552 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 3, i32 3, i32 3, i32 3>
1553 ret <4 x i64> %shuffle
1556 define <4 x i64> @shuffle_v4i64_1z3z(<4 x i64> %a, <4 x i64> %b) {
1557 ; AVX1-LABEL: shuffle_v4i64_1z3z:
1559 ; AVX1-NEXT: vxorps %xmm1, %xmm1, %xmm1
1560 ; AVX1-NEXT: vunpckhpd {{.*#+}} ymm0 = ymm0[1],ymm1[1],ymm0[3],ymm1[3]
1563 ; AVX2-LABEL: shuffle_v4i64_1z3z:
1565 ; 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
1568 ; AVX512VL-LABEL: shuffle_v4i64_1z3z:
1569 ; AVX512VL: # %bb.0:
1570 ; 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
1571 ; AVX512VL-NEXT: retq
1572 %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>
1573 ret <4 x i64> %shuffle
1576 define <4 x i64> @shuffle_v4i64_0044_v2i64(<2 x i64> %a, <2 x i64> %b) {
1577 ; AVX1-LABEL: shuffle_v4i64_0044_v2i64:
1579 ; AVX1-NEXT: # kill: def $xmm0 killed $xmm0 def $ymm0
1580 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
1581 ; AVX1-NEXT: vmovddup {{.*#+}} ymm0 = ymm0[0,0,2,2]
1584 ; AVX2-LABEL: shuffle_v4i64_0044_v2i64:
1586 ; AVX2-NEXT: # kill: def $xmm0 killed $xmm0 def $ymm0
1587 ; AVX2-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
1588 ; AVX2-NEXT: vshufps {{.*#+}} ymm0 = ymm0[0,1,0,1,4,5,4,5]
1591 ; AVX512VL-LABEL: shuffle_v4i64_0044_v2i64:
1592 ; AVX512VL: # %bb.0:
1593 ; AVX512VL-NEXT: # kill: def $xmm0 killed $xmm0 def $ymm0
1594 ; AVX512VL-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
1595 ; AVX512VL-NEXT: vshufps {{.*#+}} ymm0 = ymm0[0,1,0,1,4,5,4,5]
1596 ; AVX512VL-NEXT: retq
1597 %1 = shufflevector <2 x i64> %a, <2 x i64> undef, <2 x i32> <i32 0, i32 0>
1598 %2 = shufflevector <2 x i64> %b, <2 x i64> undef, <2 x i32> <i32 0, i32 0>
1599 %3 = shufflevector <2 x i64> %1, <2 x i64> %2, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
1603 define <4 x i64> @shuffle_v4i64_1032_v2i64(<2 x i64> %a, <2 x i64> %b) {
1604 ; ALL-LABEL: shuffle_v4i64_1032_v2i64:
1606 ; ALL-NEXT: # kill: def $xmm0 killed $xmm0 def $ymm0
1607 ; ALL-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
1608 ; ALL-NEXT: vshufps {{.*#+}} ymm0 = ymm0[2,3,0,1,6,7,4,5]
1610 %1 = shufflevector <2 x i64> %a, <2 x i64> undef, <2 x i32> <i32 1, i32 0>
1611 %2 = shufflevector <2 x i64> %b, <2 x i64> undef, <2 x i32> <i32 1, i32 0>
1612 %3 = shufflevector <2 x i64> %1, <2 x i64> %2, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
1616 define <4 x i64> @stress_test1(<4 x i64> %a, <4 x i64> %b) {
1617 ; ALL-LABEL: stress_test1:
1619 %c = shufflevector <4 x i64> %b, <4 x i64> undef, <4 x i32> <i32 3, i32 1, i32 1, i32 0>
1620 %d = shufflevector <4 x i64> %c, <4 x i64> undef, <4 x i32> <i32 3, i32 undef, i32 2, i32 undef>
1621 %e = shufflevector <4 x i64> %b, <4 x i64> undef, <4 x i32> <i32 3, i32 3, i32 1, i32 undef>
1622 %f = shufflevector <4 x i64> %d, <4 x i64> %e, <4 x i32> <i32 5, i32 1, i32 1, i32 0>
1627 define <4 x i64> @insert_reg_and_zero_v4i64(i64 %a) {
1628 ; ALL-LABEL: insert_reg_and_zero_v4i64:
1630 ; ALL-NEXT: vmovq %rdi, %xmm0
1632 %v = insertelement <4 x i64> undef, i64 %a, i64 0
1633 %shuffle = shufflevector <4 x i64> %v, <4 x i64> zeroinitializer, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
1634 ret <4 x i64> %shuffle
1637 define <4 x i64> @insert_mem_and_zero_v4i64(ptr %ptr) {
1638 ; ALL-LABEL: insert_mem_and_zero_v4i64:
1640 ; ALL-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
1642 %a = load i64, ptr %ptr
1643 %v = insertelement <4 x i64> undef, i64 %a, i64 0
1644 %shuffle = shufflevector <4 x i64> %v, <4 x i64> zeroinitializer, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
1645 ret <4 x i64> %shuffle
1648 define <4 x double> @insert_reg_and_zero_v4f64(double %a) {
1649 ; ALL-LABEL: insert_reg_and_zero_v4f64:
1651 ; ALL-NEXT: vmovq {{.*#+}} xmm0 = xmm0[0],zero
1653 %v = insertelement <4 x double> undef, double %a, i32 0
1654 %shuffle = shufflevector <4 x double> %v, <4 x double> zeroinitializer, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
1655 ret <4 x double> %shuffle
1658 define <4 x double> @insert_mem_and_zero_v4f64(ptr %ptr) {
1659 ; ALL-LABEL: insert_mem_and_zero_v4f64:
1661 ; ALL-NEXT: vmovsd {{.*#+}} xmm0 = mem[0],zero
1663 %a = load double, ptr %ptr
1664 %v = insertelement <4 x double> undef, double %a, i32 0
1665 %shuffle = shufflevector <4 x double> %v, <4 x double> zeroinitializer, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
1666 ret <4 x double> %shuffle
1669 define <4 x double> @splat_mem_v4f64(ptr %ptr) {
1670 ; ALL-LABEL: splat_mem_v4f64:
1672 ; ALL-NEXT: vbroadcastsd (%rdi), %ymm0
1674 %a = load double, ptr %ptr
1675 %v = insertelement <4 x double> undef, double %a, i32 0
1676 %shuffle = shufflevector <4 x double> %v, <4 x double> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
1677 ret <4 x double> %shuffle
1680 define <4 x i64> @splat_mem_v4i64(ptr %ptr) {
1681 ; ALL-LABEL: splat_mem_v4i64:
1683 ; ALL-NEXT: vbroadcastsd (%rdi), %ymm0
1685 %a = load i64, ptr %ptr
1686 %v = insertelement <4 x i64> undef, i64 %a, i64 0
1687 %shuffle = shufflevector <4 x i64> %v, <4 x i64> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
1688 ret <4 x i64> %shuffle
1691 define <4 x double> @splat_mem_v4f64_2(ptr %p) {
1692 ; ALL-LABEL: splat_mem_v4f64_2:
1694 ; ALL-NEXT: vbroadcastsd (%rdi), %ymm0
1696 %1 = load double, ptr %p
1697 %2 = insertelement <2 x double> undef, double %1, i32 0
1698 %3 = shufflevector <2 x double> %2, <2 x double> undef, <4 x i32> zeroinitializer
1702 define <4 x double> @splat_v4f64(<2 x double> %r) {
1703 ; AVX1-LABEL: splat_v4f64:
1705 ; AVX1-NEXT: vmovddup {{.*#+}} xmm0 = xmm0[0,0]
1706 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
1709 ; AVX2-LABEL: splat_v4f64:
1711 ; AVX2-NEXT: vbroadcastsd %xmm0, %ymm0
1714 ; AVX512VL-LABEL: splat_v4f64:
1715 ; AVX512VL: # %bb.0:
1716 ; AVX512VL-NEXT: vbroadcastsd %xmm0, %ymm0
1717 ; AVX512VL-NEXT: retq
1718 %1 = shufflevector <2 x double> %r, <2 x double> undef, <4 x i32> zeroinitializer
1722 define <4 x i64> @splat_mem_v4i64_from_v2i64(ptr %ptr) {
1723 ; ALL-LABEL: splat_mem_v4i64_from_v2i64:
1725 ; ALL-NEXT: vbroadcastsd (%rdi), %ymm0
1727 %v = load <2 x i64>, ptr %ptr
1728 %shuffle = shufflevector <2 x i64> %v, <2 x i64> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
1729 ret <4 x i64> %shuffle
1732 define <4 x double> @splat_mem_v4f64_from_v2f64(ptr %ptr) {
1733 ; ALL-LABEL: splat_mem_v4f64_from_v2f64:
1735 ; ALL-NEXT: vbroadcastsd (%rdi), %ymm0
1737 %v = load <2 x double>, ptr %ptr
1738 %shuffle = shufflevector <2 x double> %v, <2 x double> undef, <4 x i32> <i32 0, i32 0, i32 0, i32 0>
1739 ret <4 x double> %shuffle
1742 define <4 x i64> @splat128_mem_v4i64_from_v2i64(ptr %ptr) {
1743 ; AVX1OR2-LABEL: splat128_mem_v4i64_from_v2i64:
1745 ; AVX1OR2-NEXT: vbroadcastf128 {{.*#+}} ymm0 = mem[0,1,0,1]
1746 ; AVX1OR2-NEXT: retq
1748 ; AVX512VL-LABEL: splat128_mem_v4i64_from_v2i64:
1749 ; AVX512VL: # %bb.0:
1750 ; AVX512VL-NEXT: vbroadcasti128 {{.*#+}} ymm0 = mem[0,1,0,1]
1751 ; AVX512VL-NEXT: retq
1752 %v = load <2 x i64>, ptr %ptr
1753 %shuffle = shufflevector <2 x i64> %v, <2 x i64> undef, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
1754 ret <4 x i64> %shuffle
1757 define <4 x double> @splat128_mem_v4f64_from_v2f64(ptr %ptr) {
1758 ; ALL-LABEL: splat128_mem_v4f64_from_v2f64:
1760 ; ALL-NEXT: vbroadcastf128 {{.*#+}} ymm0 = mem[0,1,0,1]
1762 %v = load <2 x double>, ptr %ptr
1763 %shuffle = shufflevector <2 x double> %v, <2 x double> undef, <4 x i32> <i32 0, i32 1, i32 0, i32 1>
1764 ret <4 x double> %shuffle
1767 define <4 x double> @broadcast_v4f64_0000_from_v2i64(<2 x i64> %a0) {
1768 ; AVX1-LABEL: broadcast_v4f64_0000_from_v2i64:
1770 ; AVX1-NEXT: vshufps {{.*#+}} xmm0 = xmm0[0,1,0,1]
1771 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm0, %ymm0
1774 ; AVX2-LABEL: broadcast_v4f64_0000_from_v2i64:
1776 ; AVX2-NEXT: vbroadcastsd %xmm0, %ymm0
1779 ; AVX512VL-LABEL: broadcast_v4f64_0000_from_v2i64:
1780 ; AVX512VL: # %bb.0:
1781 ; AVX512VL-NEXT: vbroadcastsd %xmm0, %ymm0
1782 ; AVX512VL-NEXT: retq
1783 %1 = shufflevector <2 x i64> %a0, <2 x i64> undef, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
1784 %2 = bitcast <4 x i64> %1 to <4 x double>
1785 %3 = shufflevector <4 x double> %2, <4 x double> undef, <4 x i32> zeroinitializer
1789 define <4 x double> @bitcast_v4f64_0426(<4 x double> %a, <4 x double> %b) {
1790 ; ALL-LABEL: bitcast_v4f64_0426:
1792 ; ALL-NEXT: vunpcklpd {{.*#+}} ymm0 = ymm0[0],ymm1[0],ymm0[2],ymm1[2]
1794 %shuffle64 = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 4, i32 0, i32 6, i32 2>
1795 %bitcast32 = bitcast <4 x double> %shuffle64 to <8 x float>
1796 %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>
1797 %bitcast16 = bitcast <8 x float> %shuffle32 to <16 x i16>
1798 %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>
1799 %bitcast64 = bitcast <16 x i16> %shuffle16 to <4 x double>
1800 ret <4 x double> %bitcast64
1803 define <4 x i64> @concat_v4i64_0167(<4 x i64> %a0, <4 x i64> %a1) {
1804 ; ALL-LABEL: concat_v4i64_0167:
1806 ; ALL-NEXT: vblendps {{.*#+}} ymm0 = ymm0[0,1,2,3],ymm1[4,5,6,7]
1808 %a0lo = shufflevector <4 x i64> %a0, <4 x i64> %a1, <2 x i32> <i32 0, i32 1>
1809 %a1hi = shufflevector <4 x i64> %a0, <4 x i64> %a1, <2 x i32> <i32 6, i32 7>
1810 %shuffle64 = shufflevector <2 x i64> %a0lo, <2 x i64> %a1hi, <4 x i32> <i32 0, i32 1, i32 2, i32 3>
1811 ret <4 x i64> %shuffle64
1814 define <4 x i64> @concat_v4i64_0145_bc(<4 x i64> %a0, <4 x i64> %a1) {
1815 ; ALL-LABEL: concat_v4i64_0145_bc:
1817 ; ALL-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
1819 %a0lo = shufflevector <4 x i64> %a0, <4 x i64> %a1, <2 x i32> <i32 0, i32 1>
1820 %a1lo = shufflevector <4 x i64> %a0, <4 x i64> %a1, <2 x i32> <i32 4, i32 5>
1821 %bc0lo = bitcast <2 x i64> %a0lo to <4 x i32>
1822 %bc1lo = bitcast <2 x i64> %a1lo to <4 x i32>
1823 %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>
1824 %shuffle64 = bitcast <8 x i32> %shuffle32 to <4 x i64>
1825 ret <4 x i64> %shuffle64
1828 define <4 x i64> @insert_dup_mem_v4i64(ptr %ptr) {
1829 ; ALL-LABEL: insert_dup_mem_v4i64:
1831 ; ALL-NEXT: vbroadcastsd (%rdi), %ymm0
1833 %tmp = load i64, ptr %ptr, align 1
1834 %tmp1 = insertelement <2 x i64> undef, i64 %tmp, i32 0
1835 %tmp2 = shufflevector <2 x i64> %tmp1, <2 x i64> undef, <4 x i32> zeroinitializer
1839 define <4 x i64> @shuffle_v4i64_1234(<4 x i64> %a, <4 x i64> %b) {
1840 ; AVX1-LABEL: shuffle_v4i64_1234:
1842 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm1 = ymm0[2,3],ymm1[0,1]
1843 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1],ymm1[0],ymm0[3],ymm1[2]
1846 ; AVX2-LABEL: shuffle_v4i64_1234:
1848 ; AVX2-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3,4,5,6,7]
1849 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[1,2,3,0]
1852 ; AVX512VL-LABEL: shuffle_v4i64_1234:
1853 ; AVX512VL: # %bb.0:
1854 ; AVX512VL-NEXT: valignq {{.*#+}} ymm0 = ymm0[1,2,3],ymm1[0]
1855 ; AVX512VL-NEXT: retq
1856 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 1, i32 2, i32 3, i32 4>
1857 ret <4 x i64> %shuffle
1860 define <4 x i64> @shuffle_v4i64_1230(<4 x i64> %a) {
1861 ; AVX1-LABEL: shuffle_v4i64_1230:
1863 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm1 = ymm0[2,3,0,1]
1864 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1],ymm1[0],ymm0[3],ymm1[2]
1867 ; AVX2-LABEL: shuffle_v4i64_1230:
1869 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[1,2,3,0]
1872 ; AVX512VL-LABEL: shuffle_v4i64_1230:
1873 ; AVX512VL: # %bb.0:
1874 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[1,2,3,0]
1875 ; AVX512VL-NEXT: retq
1876 %shuffle = shufflevector <4 x i64> %a, <4 x i64> undef, <4 x i32> <i32 1, i32 2, i32 3, i32 0>
1877 ret <4 x i64> %shuffle
1880 define <4 x i64> @shuffle_v4i64_z0z3(<4 x i64> %a, <4 x i64> %b) {
1881 ; AVX1-LABEL: shuffle_v4i64_z0z3:
1883 ; AVX1-NEXT: vxorpd %xmm1, %xmm1, %xmm1
1884 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm1[0],ymm0[0],ymm1[2],ymm0[3]
1887 ; AVX2-SLOW-LABEL: shuffle_v4i64_z0z3:
1888 ; AVX2-SLOW: # %bb.0:
1889 ; AVX2-SLOW-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,2,3]
1890 ; AVX2-SLOW-NEXT: vxorps %xmm1, %xmm1, %xmm1
1891 ; AVX2-SLOW-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3],ymm1[4,5],ymm0[6,7]
1892 ; AVX2-SLOW-NEXT: retq
1894 ; AVX2-FAST-LABEL: shuffle_v4i64_z0z3:
1895 ; AVX2-FAST: # %bb.0:
1896 ; 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]
1897 ; AVX2-FAST-NEXT: retq
1899 ; AVX512VL-SLOW-LABEL: shuffle_v4i64_z0z3:
1900 ; AVX512VL-SLOW: # %bb.0:
1901 ; AVX512VL-SLOW-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,2,3]
1902 ; AVX512VL-SLOW-NEXT: vxorps %xmm1, %xmm1, %xmm1
1903 ; AVX512VL-SLOW-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3],ymm1[4,5],ymm0[6,7]
1904 ; AVX512VL-SLOW-NEXT: retq
1906 ; AVX512VL-FAST-LABEL: shuffle_v4i64_z0z3:
1907 ; AVX512VL-FAST: # %bb.0:
1908 ; 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]
1909 ; AVX512VL-FAST-NEXT: retq
1910 %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>
1914 define <4 x i64> @shuffle_v4i64_1z2z(<4 x i64> %a, <4 x i64> %b) {
1915 ; AVX1-LABEL: shuffle_v4i64_1z2z:
1917 ; AVX1-NEXT: vxorpd %xmm1, %xmm1, %xmm1
1918 ; AVX1-NEXT: vshufpd {{.*#+}} ymm0 = ymm0[1],ymm1[0],ymm0[2],ymm1[2]
1921 ; AVX2-SLOW-LABEL: shuffle_v4i64_1z2z:
1922 ; AVX2-SLOW: # %bb.0:
1923 ; AVX2-SLOW-NEXT: vxorps %xmm1, %xmm1, %xmm1
1924 ; AVX2-SLOW-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3,4,5,6,7]
1925 ; AVX2-SLOW-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[1,0,2,0]
1926 ; AVX2-SLOW-NEXT: retq
1928 ; AVX2-FAST-LABEL: shuffle_v4i64_1z2z:
1929 ; AVX2-FAST: # %bb.0:
1930 ; 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
1931 ; AVX2-FAST-NEXT: retq
1933 ; AVX512VL-SLOW-LABEL: shuffle_v4i64_1z2z:
1934 ; AVX512VL-SLOW: # %bb.0:
1935 ; AVX512VL-SLOW-NEXT: vxorps %xmm1, %xmm1, %xmm1
1936 ; AVX512VL-SLOW-NEXT: vblendps {{.*#+}} ymm0 = ymm1[0,1],ymm0[2,3,4,5,6,7]
1937 ; AVX512VL-SLOW-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[1,0,2,0]
1938 ; AVX512VL-SLOW-NEXT: retq
1940 ; AVX512VL-FAST-LABEL: shuffle_v4i64_1z2z:
1941 ; AVX512VL-FAST: # %bb.0:
1942 ; 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
1943 ; AVX512VL-FAST-NEXT: retq
1944 %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>
1948 define <4 x double> @add_v4f64_0246_1357(<4 x double> %a, <4 x double> %b) {
1949 ; AVX1-LABEL: add_v4f64_0246_1357:
1950 ; AVX1: # %bb.0: # %entry
1951 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm2 = ymm0[2,3],ymm1[2,3]
1952 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
1953 ; AVX1-NEXT: vhaddpd %ymm2, %ymm0, %ymm0
1956 ; AVX2-LABEL: add_v4f64_0246_1357:
1957 ; AVX2: # %bb.0: # %entry
1958 ; AVX2-NEXT: vhaddpd %ymm1, %ymm0, %ymm0
1959 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,2,1,3]
1962 ; AVX512VL-LABEL: add_v4f64_0246_1357:
1963 ; AVX512VL: # %bb.0: # %entry
1964 ; AVX512VL-NEXT: vhaddpd %ymm1, %ymm0, %ymm0
1965 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,2,1,3]
1966 ; AVX512VL-NEXT: retq
1968 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
1969 %shuffle1 = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
1970 %add = fadd <4 x double> %shuffle, %shuffle1
1971 ret <4 x double> %add
1974 define <4 x double> @add_v4f64_4602_5713(<4 x double> %a, <4 x double> %b) {
1975 ; AVX1-LABEL: add_v4f64_4602_5713:
1976 ; AVX1: # %bb.0: # %entry
1977 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm2 = ymm1[2,3],ymm0[2,3]
1978 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0
1979 ; AVX1-NEXT: vhaddpd %ymm2, %ymm0, %ymm0
1982 ; AVX2-LABEL: add_v4f64_4602_5713:
1983 ; AVX2: # %bb.0: # %entry
1984 ; AVX2-NEXT: vhaddpd %ymm1, %ymm0, %ymm0
1985 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[1,3,0,2]
1988 ; AVX512VL-LABEL: add_v4f64_4602_5713:
1989 ; AVX512VL: # %bb.0: # %entry
1990 ; AVX512VL-NEXT: vhaddpd %ymm1, %ymm0, %ymm0
1991 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[1,3,0,2]
1992 ; AVX512VL-NEXT: retq
1994 %shuffle = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 4, i32 6, i32 0, i32 2>
1995 %shuffle1 = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 5, i32 7, i32 1, i32 3>
1996 %add = fadd <4 x double> %shuffle, %shuffle1
1997 ret <4 x double> %add
2000 define <4 x double> @add_v4f64_024u_135u_reverse(<4 x double> %a, <4 x double> %b) {
2001 ; AVX1-LABEL: add_v4f64_024u_135u_reverse:
2003 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm1
2004 ; AVX1-NEXT: vshufpd {{.*#+}} ymm2 = ymm0[0],ymm1[1],ymm0[3],ymm1[3]
2005 ; AVX1-NEXT: vunpcklpd {{.*#+}} ymm0 = ymm0[0],ymm1[0],ymm0[2],ymm1[2]
2006 ; AVX1-NEXT: vaddpd %ymm2, %ymm0, %ymm0
2009 ; AVX2-LABEL: add_v4f64_024u_135u_reverse:
2011 ; AVX2-NEXT: vhaddpd %ymm0, %ymm1, %ymm0
2012 ; AVX2-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,3,1]
2015 ; AVX512VL-LABEL: add_v4f64_024u_135u_reverse:
2016 ; AVX512VL: # %bb.0:
2017 ; AVX512VL-NEXT: vhaddpd %ymm0, %ymm1, %ymm0
2018 ; AVX512VL-NEXT: vpermpd {{.*#+}} ymm0 = ymm0[0,0,3,1]
2019 ; AVX512VL-NEXT: retq
2020 %shuffle0 = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 0, i32 2, i32 4, i32 undef>
2021 %shuffle1 = shufflevector <4 x double> %a, <4 x double> %b, <4 x i32> <i32 1, i32 3, i32 5, i32 undef>
2022 %add = fadd <4 x double> %shuffle0, %shuffle1
2023 %shuffle = shufflevector <4 x double> %add, <4 x double> poison, <4 x i32> <i32 undef, i32 2, i32 1, i32 0>
2024 ret <4 x double> %shuffle
2027 define <4 x i64> @add_v4i64_0246_1357(<4 x i64> %a, <4 x i64> %b) {
2028 ; AVX1-LABEL: add_v4i64_0246_1357:
2029 ; AVX1: # %bb.0: # %entry
2030 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm2 = ymm0[2,3],ymm1[2,3]
2031 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
2032 ; AVX1-NEXT: vunpcklpd {{.*#+}} ymm1 = ymm0[0],ymm2[0],ymm0[2],ymm2[2]
2033 ; AVX1-NEXT: vunpckhpd {{.*#+}} ymm0 = ymm0[1],ymm2[1],ymm0[3],ymm2[3]
2034 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm2
2035 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm3
2036 ; AVX1-NEXT: vpaddq %xmm2, %xmm3, %xmm2
2037 ; AVX1-NEXT: vpaddq %xmm0, %xmm1, %xmm0
2038 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
2041 ; AVX2-LABEL: add_v4i64_0246_1357:
2042 ; AVX2: # %bb.0: # %entry
2043 ; AVX2-NEXT: vpunpcklqdq {{.*#+}} ymm2 = ymm0[0],ymm1[0],ymm0[2],ymm1[2]
2044 ; AVX2-NEXT: vpermq {{.*#+}} ymm2 = ymm2[0,2,1,3]
2045 ; AVX2-NEXT: vpunpckhqdq {{.*#+}} ymm0 = ymm0[1],ymm1[1],ymm0[3],ymm1[3]
2046 ; AVX2-NEXT: vpermq {{.*#+}} ymm0 = ymm0[0,2,1,3]
2047 ; AVX2-NEXT: vpaddq %ymm0, %ymm2, %ymm0
2050 ; AVX512VL-SLOW-LABEL: add_v4i64_0246_1357:
2051 ; AVX512VL-SLOW: # %bb.0: # %entry
2052 ; AVX512VL-SLOW-NEXT: vpunpcklqdq {{.*#+}} ymm2 = ymm0[0],ymm1[0],ymm0[2],ymm1[2]
2053 ; AVX512VL-SLOW-NEXT: vpermq {{.*#+}} ymm2 = ymm2[0,2,1,3]
2054 ; AVX512VL-SLOW-NEXT: vpunpckhqdq {{.*#+}} ymm0 = ymm0[1],ymm1[1],ymm0[3],ymm1[3]
2055 ; AVX512VL-SLOW-NEXT: vpermq {{.*#+}} ymm0 = ymm0[0,2,1,3]
2056 ; AVX512VL-SLOW-NEXT: vpaddq %ymm0, %ymm2, %ymm0
2057 ; AVX512VL-SLOW-NEXT: retq
2059 ; AVX512VL-FAST-ALL-LABEL: add_v4i64_0246_1357:
2060 ; AVX512VL-FAST-ALL: # %bb.0: # %entry
2061 ; AVX512VL-FAST-ALL-NEXT: vmovdqa {{.*#+}} ymm2 = [0,2,4,6]
2062 ; AVX512VL-FAST-ALL-NEXT: vpermi2q %ymm1, %ymm0, %ymm2
2063 ; AVX512VL-FAST-ALL-NEXT: vmovdqa {{.*#+}} ymm3 = [1,3,5,7]
2064 ; AVX512VL-FAST-ALL-NEXT: vpermi2q %ymm1, %ymm0, %ymm3
2065 ; AVX512VL-FAST-ALL-NEXT: vpaddq %ymm3, %ymm2, %ymm0
2066 ; AVX512VL-FAST-ALL-NEXT: retq
2068 ; AVX512VL-FAST-PERLANE-LABEL: add_v4i64_0246_1357:
2069 ; AVX512VL-FAST-PERLANE: # %bb.0: # %entry
2070 ; AVX512VL-FAST-PERLANE-NEXT: vpunpcklqdq {{.*#+}} ymm2 = ymm0[0],ymm1[0],ymm0[2],ymm1[2]
2071 ; AVX512VL-FAST-PERLANE-NEXT: vpermq {{.*#+}} ymm2 = ymm2[0,2,1,3]
2072 ; AVX512VL-FAST-PERLANE-NEXT: vpunpckhqdq {{.*#+}} ymm0 = ymm0[1],ymm1[1],ymm0[3],ymm1[3]
2073 ; AVX512VL-FAST-PERLANE-NEXT: vpermq {{.*#+}} ymm0 = ymm0[0,2,1,3]
2074 ; AVX512VL-FAST-PERLANE-NEXT: vpaddq %ymm0, %ymm2, %ymm0
2075 ; AVX512VL-FAST-PERLANE-NEXT: retq
2077 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 0, i32 2, i32 4, i32 6>
2078 %shuffle1 = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 1, i32 3, i32 5, i32 7>
2079 %add = add <4 x i64> %shuffle, %shuffle1
2083 define <4 x i64> @add_v4i64_4602_5713(<4 x i64> %a, <4 x i64> %b) {
2084 ; AVX1-LABEL: add_v4i64_4602_5713:
2085 ; AVX1: # %bb.0: # %entry
2086 ; AVX1-NEXT: vperm2f128 {{.*#+}} ymm2 = ymm1[2,3],ymm0[2,3]
2087 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0
2088 ; AVX1-NEXT: vunpcklpd {{.*#+}} ymm1 = ymm0[0],ymm2[0],ymm0[2],ymm2[2]
2089 ; AVX1-NEXT: vunpckhpd {{.*#+}} ymm0 = ymm0[1],ymm2[1],ymm0[3],ymm2[3]
2090 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm2
2091 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm3
2092 ; AVX1-NEXT: vpaddq %xmm2, %xmm3, %xmm2
2093 ; AVX1-NEXT: vpaddq %xmm0, %xmm1, %xmm0
2094 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
2097 ; AVX2-LABEL: add_v4i64_4602_5713:
2098 ; AVX2: # %bb.0: # %entry
2099 ; AVX2-NEXT: vpunpcklqdq {{.*#+}} ymm2 = ymm1[0],ymm0[0],ymm1[2],ymm0[2]
2100 ; AVX2-NEXT: vpermq {{.*#+}} ymm2 = ymm2[0,2,1,3]
2101 ; AVX2-NEXT: vpunpckhqdq {{.*#+}} ymm0 = ymm1[1],ymm0[1],ymm1[3],ymm0[3]
2102 ; AVX2-NEXT: vpermq {{.*#+}} ymm0 = ymm0[0,2,1,3]
2103 ; AVX2-NEXT: vpaddq %ymm0, %ymm2, %ymm0
2106 ; AVX512VL-SLOW-LABEL: add_v4i64_4602_5713:
2107 ; AVX512VL-SLOW: # %bb.0: # %entry
2108 ; AVX512VL-SLOW-NEXT: vpunpcklqdq {{.*#+}} ymm2 = ymm1[0],ymm0[0],ymm1[2],ymm0[2]
2109 ; AVX512VL-SLOW-NEXT: vpermq {{.*#+}} ymm2 = ymm2[0,2,1,3]
2110 ; AVX512VL-SLOW-NEXT: vpunpckhqdq {{.*#+}} ymm0 = ymm1[1],ymm0[1],ymm1[3],ymm0[3]
2111 ; AVX512VL-SLOW-NEXT: vpermq {{.*#+}} ymm0 = ymm0[0,2,1,3]
2112 ; AVX512VL-SLOW-NEXT: vpaddq %ymm0, %ymm2, %ymm0
2113 ; AVX512VL-SLOW-NEXT: retq
2115 ; AVX512VL-FAST-ALL-LABEL: add_v4i64_4602_5713:
2116 ; AVX512VL-FAST-ALL: # %bb.0: # %entry
2117 ; AVX512VL-FAST-ALL-NEXT: vmovdqa {{.*#+}} ymm2 = [0,2,4,6]
2118 ; AVX512VL-FAST-ALL-NEXT: vpermi2q %ymm0, %ymm1, %ymm2
2119 ; AVX512VL-FAST-ALL-NEXT: vmovdqa {{.*#+}} ymm3 = [1,3,5,7]
2120 ; AVX512VL-FAST-ALL-NEXT: vpermi2q %ymm0, %ymm1, %ymm3
2121 ; AVX512VL-FAST-ALL-NEXT: vpaddq %ymm3, %ymm2, %ymm0
2122 ; AVX512VL-FAST-ALL-NEXT: retq
2124 ; AVX512VL-FAST-PERLANE-LABEL: add_v4i64_4602_5713:
2125 ; AVX512VL-FAST-PERLANE: # %bb.0: # %entry
2126 ; AVX512VL-FAST-PERLANE-NEXT: vpunpcklqdq {{.*#+}} ymm2 = ymm1[0],ymm0[0],ymm1[2],ymm0[2]
2127 ; AVX512VL-FAST-PERLANE-NEXT: vpermq {{.*#+}} ymm2 = ymm2[0,2,1,3]
2128 ; AVX512VL-FAST-PERLANE-NEXT: vpunpckhqdq {{.*#+}} ymm0 = ymm1[1],ymm0[1],ymm1[3],ymm0[3]
2129 ; AVX512VL-FAST-PERLANE-NEXT: vpermq {{.*#+}} ymm0 = ymm0[0,2,1,3]
2130 ; AVX512VL-FAST-PERLANE-NEXT: vpaddq %ymm0, %ymm2, %ymm0
2131 ; AVX512VL-FAST-PERLANE-NEXT: retq
2133 %shuffle = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 4, i32 6, i32 0, i32 2>
2134 %shuffle1 = shufflevector <4 x i64> %a, <4 x i64> %b, <4 x i32> <i32 5, i32 7, i32 1, i32 3>
2135 %add = add <4 x i64> %shuffle, %shuffle1
2139 define <4 x double> @shuffle_v4f64_0zzz_optsize(<4 x double> %a) optsize {
2140 ; ALL-LABEL: shuffle_v4f64_0zzz_optsize:
2142 ; ALL-NEXT: vmovq {{.*#+}} xmm0 = xmm0[0],zero
2144 %b = shufflevector <4 x double> %a, <4 x double> zeroinitializer, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
2148 define <4 x i64> @shuffle_v4i64_0zzz_optsize(<4 x i64> %a) optsize {
2149 ; ALL-LABEL: shuffle_v4i64_0zzz_optsize:
2151 ; ALL-NEXT: vmovq {{.*#+}} xmm0 = xmm0[0],zero
2153 %b = shufflevector <4 x i64> %a, <4 x i64> zeroinitializer, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
2157 define <8 x float> @shuffle_v8f32_0zzzzzzz_optsize(<8 x float> %a) optsize {
2158 ; ALL-LABEL: shuffle_v8f32_0zzzzzzz_optsize:
2160 ; ALL-NEXT: vxorps %xmm1, %xmm1, %xmm1
2161 ; ALL-NEXT: vmovss {{.*#+}} xmm0 = xmm0[0],xmm1[1,2,3]
2163 %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>
2167 define <8 x i32> @shuffle_v8i32_0zzzzzzz_optsize(<8 x i32> %a) optsize {
2168 ; ALL-LABEL: shuffle_v8i32_0zzzzzzz_optsize:
2170 ; ALL-NEXT: vxorps %xmm1, %xmm1, %xmm1
2171 ; ALL-NEXT: vmovss {{.*#+}} xmm0 = xmm0[0],xmm1[1,2,3]
2173 %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>
2177 define <4 x double> @shuffle_v4f64_0zzz_pgso(<4 x double> %a) !prof !14 {
2178 ; ALL-LABEL: shuffle_v4f64_0zzz_pgso:
2180 ; ALL-NEXT: vmovq {{.*#+}} xmm0 = xmm0[0],zero
2182 %b = shufflevector <4 x double> %a, <4 x double> zeroinitializer, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
2186 define <4 x i64> @shuffle_v4i64_0zzz_pgso(<4 x i64> %a) !prof !14 {
2187 ; ALL-LABEL: shuffle_v4i64_0zzz_pgso:
2189 ; ALL-NEXT: vmovq {{.*#+}} xmm0 = xmm0[0],zero
2191 %b = shufflevector <4 x i64> %a, <4 x i64> zeroinitializer, <4 x i32> <i32 0, i32 5, i32 6, i32 7>
2195 define <8 x float> @shuffle_v8f32_0zzzzzzz_pgso(<8 x float> %a) !prof !14 {
2196 ; AVX1OR2-LABEL: shuffle_v8f32_0zzzzzzz_pgso:
2198 ; AVX1OR2-NEXT: vxorps %xmm1, %xmm1, %xmm1
2199 ; AVX1OR2-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0],xmm1[1,2,3]
2200 ; AVX1OR2-NEXT: retq
2202 ; AVX512VL-LABEL: shuffle_v8f32_0zzzzzzz_pgso:
2203 ; AVX512VL: # %bb.0:
2204 ; AVX512VL-NEXT: vxorps %xmm1, %xmm1, %xmm1
2205 ; AVX512VL-NEXT: vmovss {{.*#+}} xmm0 = xmm0[0],xmm1[1,2,3]
2206 ; AVX512VL-NEXT: retq
2207 %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>
2211 define <8 x i32> @shuffle_v8i32_0zzzzzzz_pgso(<8 x i32> %a) !prof !14 {
2212 ; AVX1OR2-LABEL: shuffle_v8i32_0zzzzzzz_pgso:
2214 ; AVX1OR2-NEXT: vxorps %xmm1, %xmm1, %xmm1
2215 ; AVX1OR2-NEXT: vblendps {{.*#+}} xmm0 = xmm0[0],xmm1[1,2,3]
2216 ; AVX1OR2-NEXT: retq
2218 ; AVX512VL-LABEL: shuffle_v8i32_0zzzzzzz_pgso:
2219 ; AVX512VL: # %bb.0:
2220 ; AVX512VL-NEXT: vxorps %xmm1, %xmm1, %xmm1
2221 ; AVX512VL-NEXT: vmovss {{.*#+}} xmm0 = xmm0[0],xmm1[1,2,3]
2222 ; AVX512VL-NEXT: retq
2223 %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>
2227 define <4 x i64> @unpckh_v4i64(<4 x i64> %x, <4 x i64> %y) {
2228 ; ALL-LABEL: unpckh_v4i64:
2230 ; ALL-NEXT: vextractf128 $1, %ymm1, %xmm1
2231 ; ALL-NEXT: vunpckhpd {{.*#+}} xmm0 = xmm0[1],xmm1[1]
2233 %unpckh = shufflevector <4 x i64> %x, <4 x i64> %y, <4 x i32> <i32 1, i32 7, i32 undef, i32 undef>
2234 ret <4 x i64> %unpckh
2237 define <4 x double> @unpckh_v4f64(<4 x double> %x, <4 x double> %y) {
2238 ; ALL-LABEL: unpckh_v4f64:
2240 ; ALL-NEXT: vextractf128 $1, %ymm1, %xmm1
2241 ; ALL-NEXT: vunpckhpd {{.*#+}} xmm0 = xmm0[1],xmm1[1]
2243 %unpckh = shufflevector <4 x double> %x, <4 x double> %y, <4 x i32> <i32 1, i32 7, i32 undef, i32 undef>
2244 ret <4 x double> %unpckh
2247 !llvm.module.flags = !{!0}
2248 !0 = !{i32 1, !"ProfileSummary", !1}
2249 !1 = !{!2, !3, !4, !5, !6, !7, !8, !9}
2250 !2 = !{!"ProfileFormat", !"InstrProf"}
2251 !3 = !{!"TotalCount", i64 10000}
2252 !4 = !{!"MaxCount", i64 10}
2253 !5 = !{!"MaxInternalCount", i64 1}
2254 !6 = !{!"MaxFunctionCount", i64 1000}
2255 !7 = !{!"NumCounts", i64 3}
2256 !8 = !{!"NumFunctions", i64 3}
2257 !9 = !{!"DetailedSummary", !10}
2258 !10 = !{!11, !12, !13}
2259 !11 = !{i32 10000, i64 100, i32 1}
2260 !12 = !{i32 999000, i64 100, i32 1}
2261 !13 = !{i32 999999, i64 1, i32 2}
2262 !14 = !{!"function_entry_count", i64 0}