1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-pc-linux -mattr=+ssse3 | FileCheck %s --check-prefixes=CHECK,SSE
3 ; RUN: llc < %s -mtriple=x86_64-pc-linux -mattr=+xop | FileCheck %s --check-prefixes=CHECK,XOP
4 ; RUN: llc < %s -mtriple=x86_64-pc-linux -mattr=+avx2 | FileCheck %s --check-prefixes=CHECK,AVX2
5 ; RUN: llc < %s -mtriple=x86_64-pc-linux -mattr=+avx512f,+avx512vl | FileCheck %s --check-prefixes=CHECK,AVX512,AVX512F
6 ; RUN: llc < %s -mtriple=x86_64-pc-linux -mattr=+avx512f,+avx512vl,+avx512bw | FileCheck %s --check-prefixes=CHECK,AVX512,AVX512BW
7 ; RUN: llc < %s -mtriple=x86_64-pc-linux -mattr=+avx512f,+avx512vl,+avx512vbmi | FileCheck %s --check-prefixes=CHECK,AVX512,AVX512VBMI
9 define <32 x i8> @foo(<48 x i8>* %x0) {
12 ; SSE-NEXT: movdqu (%rdi), %xmm0
13 ; SSE-NEXT: movdqu 16(%rdi), %xmm2
14 ; SSE-NEXT: movdqu 32(%rdi), %xmm1
15 ; SSE-NEXT: movdqa %xmm2, %xmm3
16 ; SSE-NEXT: pshufb {{.*#+}} xmm3 = zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,xmm3[0,2,3,5,6]
17 ; SSE-NEXT: pshufb {{.*#+}} xmm0 = xmm0[0,1,3,4,6,7,9,10,12,13,15],zero,zero,zero,zero,zero
18 ; SSE-NEXT: por %xmm3, %xmm0
19 ; SSE-NEXT: pshufb {{.*#+}} xmm2 = xmm2[8,9,11,12,14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
20 ; SSE-NEXT: pshufb {{.*#+}} xmm1 = zero,zero,zero,zero,zero,zero,xmm1[1,2,4,5,7,8,10,11,13,14]
21 ; SSE-NEXT: por %xmm2, %xmm1
26 ; XOP-NEXT: vmovdqu (%rdi), %xmm0
27 ; XOP-NEXT: vmovdqu 16(%rdi), %xmm1
28 ; XOP-NEXT: vmovdqu 32(%rdi), %xmm2
29 ; XOP-NEXT: vpshufb {{.*#+}} xmm3 = xmm1[8,9,11,12,14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
30 ; XOP-NEXT: vpshufb {{.*#+}} xmm2 = zero,zero,zero,zero,zero,zero,xmm2[1,2,4,5,7,8,10,11,13,14]
31 ; XOP-NEXT: vpor %xmm3, %xmm2, %xmm2
32 ; XOP-NEXT: vpshufb {{.*#+}} xmm1 = zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,xmm1[0,2,3,5,6]
33 ; XOP-NEXT: vpshufb {{.*#+}} xmm0 = xmm0[0,1,3,4,6,7,9,10,12,13,15],zero,zero,zero,zero,zero
34 ; XOP-NEXT: vpor %xmm1, %xmm0, %xmm0
35 ; XOP-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
40 ; AVX2-NEXT: vmovdqu 32(%rdi), %xmm0
41 ; AVX2-NEXT: vmovdqu (%rdi), %ymm1
42 ; AVX2-NEXT: vmovdqu 16(%rdi), %xmm2
43 ; AVX2-NEXT: vpshufb {{.*#+}} xmm2 = xmm2[u,u,u,u,u,u,u,u,u,u,u,0,2,3,5,6]
44 ; AVX2-NEXT: vpshufb {{.*#+}} ymm1 = ymm1[0,1,3,4,6,7,9,10,12,13,15,u,u,u,u,u,24,25,27,28,30,31,u,u,u,u,u,u,u,u,u,u]
45 ; AVX2-NEXT: vmovdqa {{.*#+}} ymm3 = <255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,255,255,255,255,255,255,u,u,u,u,u,u,u,u,u,u>
46 ; AVX2-NEXT: vpblendvb %ymm3, %ymm1, %ymm2, %ymm1
47 ; AVX2-NEXT: vpshufb {{.*#+}} xmm0 = xmm0[u,u,u,u,u,u,1,2,4,5,7,8,10,11,13,14]
48 ; AVX2-NEXT: vinserti128 $1, %xmm0, %ymm0, %ymm0
49 ; AVX2-NEXT: vpblendw {{.*#+}} ymm0 = ymm1[0,1,2],ymm0[3,4,5,6,7],ymm1[8,9,10],ymm0[11,12,13,14,15]
50 ; AVX2-NEXT: vpblendd {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
55 ; AVX512F-NEXT: vmovdqu 32(%rdi), %xmm0
56 ; AVX512F-NEXT: vmovdqu (%rdi), %ymm1
57 ; AVX512F-NEXT: vmovdqu 16(%rdi), %xmm2
58 ; AVX512F-NEXT: vpshufb {{.*#+}} xmm2 = xmm2[u,u,u,u,u,u,u,u,u,u,u,0,2,3,5,6]
59 ; AVX512F-NEXT: vpshufb {{.*#+}} ymm1 = ymm1[0,1,3,4,6,7,9,10,12,13,15,u,u,u,u,u,24,25,27,28,30,31,u,u,u,u,u,u,u,u,u,u]
60 ; AVX512F-NEXT: vmovdqa {{.*#+}} ymm3 = <255,255,255,255,255,255,255,255,255,255,255,0,0,0,0,0,255,255,255,255,255,255,u,u,u,u,u,u,u,u,u,u>
61 ; AVX512F-NEXT: vpblendvb %ymm3, %ymm1, %ymm2, %ymm1
62 ; AVX512F-NEXT: vpshufb {{.*#+}} xmm0 = xmm0[u,u,u,u,u,u,1,2,4,5,7,8,10,11,13,14]
63 ; AVX512F-NEXT: vinserti128 $1, %xmm0, %ymm0, %ymm0
64 ; AVX512F-NEXT: vpblendw {{.*#+}} ymm0 = ymm1[0,1,2],ymm0[3,4,5,6,7],ymm1[8,9,10],ymm0[11,12,13,14,15]
65 ; AVX512F-NEXT: vpblendd {{.*#+}} ymm0 = ymm1[0,1,2,3],ymm0[4,5,6,7]
68 ; AVX512BW-LABEL: foo:
70 ; AVX512BW-NEXT: vmovdqu 32(%rdi), %xmm0
71 ; AVX512BW-NEXT: vmovdqu (%rdi), %ymm1
72 ; AVX512BW-NEXT: vmovdqu 16(%rdi), %xmm2
73 ; AVX512BW-NEXT: vpshufb {{.*#+}} xmm2 = xmm2[u,u,u,u,u,u,u,u,u,u,u,0,2,3,5,6]
74 ; AVX512BW-NEXT: vpshufb {{.*#+}} ymm1 = ymm1[0,1,3,4,6,7,9,10,12,13,15,u,u,u,u,u,24,25,27,28,30,31,u,u,u,u,u,u,u,u,u,u]
75 ; AVX512BW-NEXT: movl $63488, %eax # imm = 0xF800
76 ; AVX512BW-NEXT: kmovd %eax, %k1
77 ; AVX512BW-NEXT: vmovdqu8 %ymm2, %ymm1 {%k1}
78 ; AVX512BW-NEXT: vpshufb {{.*#+}} xmm0 = xmm0[u,u,u,u,u,u,1,2,4,5,7,8,10,11,13,14]
79 ; AVX512BW-NEXT: vinserti128 $1, %xmm0, %ymm0, %ymm2
80 ; AVX512BW-NEXT: vmovdqa {{.*#+}} ymm0 = [0,1,2,3,4,5,6,7,8,9,10,27,28,29,30,31]
81 ; AVX512BW-NEXT: vpermi2w %ymm2, %ymm1, %ymm0
84 ; AVX512VBMI-LABEL: foo:
85 ; AVX512VBMI: # %bb.0:
86 ; AVX512VBMI-NEXT: vmovdqu (%rdi), %ymm1
87 ; AVX512VBMI-NEXT: vmovdqu 32(%rdi), %xmm2
88 ; AVX512VBMI-NEXT: vmovdqa {{.*#+}} ymm0 = [0,1,3,4,6,7,9,10,12,13,15,16,18,19,21,22,24,25,27,28,30,31,33,34,36,37,39,40,42,43,45,46]
89 ; AVX512VBMI-NEXT: vpermi2b %ymm2, %ymm1, %ymm0
90 ; AVX512VBMI-NEXT: retq
91 %1 = load <48 x i8>, <48 x i8>* %x0, align 1
92 %2 = shufflevector <48 x i8> %1, <48 x i8> undef, <32 x i32> <i32 0, i32 1, i32 3, i32 4, i32 6, i32 7, i32 9, i32 10, i32 12, i32 13, i32 15, i32 16, i32 18, i32 19, i32 21, i32 22, i32 24, i32 25, i32 27, i32 28, i32 30, i32 31, i32 33, i32 34, i32 36, i32 37, i32 39, i32 40, i32 42, i32 43, i32 45, i32 46>