• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+avx512vbmi,+avx512vl --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,X86
3; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512vbmi,+avx512vl --show-mc-encoding | FileCheck %s --check-prefixes=CHECK,X64
4
5declare <16 x i8> @llvm.x86.avx512.permvar.qi.128(<16 x i8>, <16 x i8>)
6
7define <16 x i8>@test_int_x86_avx512_permvar_qi_128(<16 x i8> %x0, <16 x i8> %x1, <16 x i8> %x2) {
8; CHECK-LABEL: test_int_x86_avx512_permvar_qi_128:
9; CHECK:       # %bb.0:
10; CHECK-NEXT:    vpermb %xmm0, %xmm1, %xmm0 # encoding: [0x62,0xf2,0x75,0x08,0x8d,0xc0]
11; CHECK-NEXT:    ret{{[l|q]}} # encoding: [0xc3]
12  %1 = call <16 x i8> @llvm.x86.avx512.permvar.qi.128(<16 x i8> %x0, <16 x i8> %x1)
13  ret <16 x i8> %1
14}
15
16define <16 x i8>@test_int_x86_avx512_mask_permvar_qi_128(<16 x i8> %x0, <16 x i8> %x1, <16 x i8> %x2, i16 %x3) {
17; X86-LABEL: test_int_x86_avx512_mask_permvar_qi_128:
18; X86:       # %bb.0:
19; X86-NEXT:    kmovw {{[0-9]+}}(%esp), %k1 # encoding: [0xc5,0xf8,0x90,0x4c,0x24,0x04]
20; X86-NEXT:    vpermb %xmm0, %xmm1, %xmm2 {%k1} # encoding: [0x62,0xf2,0x75,0x09,0x8d,0xd0]
21; X86-NEXT:    vmovdqa %xmm2, %xmm0 # EVEX TO VEX Compression encoding: [0xc5,0xf9,0x6f,0xc2]
22; X86-NEXT:    retl # encoding: [0xc3]
23;
24; X64-LABEL: test_int_x86_avx512_mask_permvar_qi_128:
25; X64:       # %bb.0:
26; X64-NEXT:    kmovd %edi, %k1 # encoding: [0xc5,0xfb,0x92,0xcf]
27; X64-NEXT:    vpermb %xmm0, %xmm1, %xmm2 {%k1} # encoding: [0x62,0xf2,0x75,0x09,0x8d,0xd0]
28; X64-NEXT:    vmovdqa %xmm2, %xmm0 # EVEX TO VEX Compression encoding: [0xc5,0xf9,0x6f,0xc2]
29; X64-NEXT:    retq # encoding: [0xc3]
30  %1 = call <16 x i8> @llvm.x86.avx512.permvar.qi.128(<16 x i8> %x0, <16 x i8> %x1)
31  %2 = bitcast i16 %x3 to <16 x i1>
32  %3 = select <16 x i1> %2, <16 x i8> %1, <16 x i8> %x2
33  ret <16 x i8> %3
34}
35
36define <16 x i8>@test_int_x86_avx512_maskz_permvar_qi_128(<16 x i8> %x0, <16 x i8> %x1, i16 %x3) {
37; X86-LABEL: test_int_x86_avx512_maskz_permvar_qi_128:
38; X86:       # %bb.0:
39; X86-NEXT:    kmovw {{[0-9]+}}(%esp), %k1 # encoding: [0xc5,0xf8,0x90,0x4c,0x24,0x04]
40; X86-NEXT:    vpermb %xmm0, %xmm1, %xmm0 {%k1} {z} # encoding: [0x62,0xf2,0x75,0x89,0x8d,0xc0]
41; X86-NEXT:    retl # encoding: [0xc3]
42;
43; X64-LABEL: test_int_x86_avx512_maskz_permvar_qi_128:
44; X64:       # %bb.0:
45; X64-NEXT:    kmovd %edi, %k1 # encoding: [0xc5,0xfb,0x92,0xcf]
46; X64-NEXT:    vpermb %xmm0, %xmm1, %xmm0 {%k1} {z} # encoding: [0x62,0xf2,0x75,0x89,0x8d,0xc0]
47; X64-NEXT:    retq # encoding: [0xc3]
48  %1 = call <16 x i8> @llvm.x86.avx512.permvar.qi.128(<16 x i8> %x0, <16 x i8> %x1)
49  %2 = bitcast i16 %x3 to <16 x i1>
50  %3 = select <16 x i1> %2, <16 x i8> %1, <16 x i8> zeroinitializer
51  ret <16 x i8> %3
52}
53
54declare <32 x i8> @llvm.x86.avx512.permvar.qi.256(<32 x i8>, <32 x i8>)
55
56define <32 x i8>@test_int_x86_avx512_permvar_qi_256(<32 x i8> %x0, <32 x i8> %x1, <32 x i8> %x2) {
57; CHECK-LABEL: test_int_x86_avx512_permvar_qi_256:
58; CHECK:       # %bb.0:
59; CHECK-NEXT:    vpermb %ymm0, %ymm1, %ymm0 # encoding: [0x62,0xf2,0x75,0x28,0x8d,0xc0]
60; CHECK-NEXT:    ret{{[l|q]}} # encoding: [0xc3]
61  %1 = call <32 x i8> @llvm.x86.avx512.permvar.qi.256(<32 x i8> %x0, <32 x i8> %x1)
62  ret <32 x i8> %1
63}
64
65define <32 x i8>@test_int_x86_avx512_mask_permvar_qi_256(<32 x i8> %x0, <32 x i8> %x1, <32 x i8> %x2, i32 %x3) {
66; X86-LABEL: test_int_x86_avx512_mask_permvar_qi_256:
67; X86:       # %bb.0:
68; X86-NEXT:    kmovd {{[0-9]+}}(%esp), %k1 # encoding: [0xc4,0xe1,0xf9,0x90,0x4c,0x24,0x04]
69; X86-NEXT:    vpermb %ymm0, %ymm1, %ymm2 {%k1} # encoding: [0x62,0xf2,0x75,0x29,0x8d,0xd0]
70; X86-NEXT:    vmovdqa %ymm2, %ymm0 # EVEX TO VEX Compression encoding: [0xc5,0xfd,0x6f,0xc2]
71; X86-NEXT:    retl # encoding: [0xc3]
72;
73; X64-LABEL: test_int_x86_avx512_mask_permvar_qi_256:
74; X64:       # %bb.0:
75; X64-NEXT:    kmovd %edi, %k1 # encoding: [0xc5,0xfb,0x92,0xcf]
76; X64-NEXT:    vpermb %ymm0, %ymm1, %ymm2 {%k1} # encoding: [0x62,0xf2,0x75,0x29,0x8d,0xd0]
77; X64-NEXT:    vmovdqa %ymm2, %ymm0 # EVEX TO VEX Compression encoding: [0xc5,0xfd,0x6f,0xc2]
78; X64-NEXT:    retq # encoding: [0xc3]
79  %1 = call <32 x i8> @llvm.x86.avx512.permvar.qi.256(<32 x i8> %x0, <32 x i8> %x1)
80  %2 = bitcast i32 %x3 to <32 x i1>
81  %3 = select <32 x i1> %2, <32 x i8> %1, <32 x i8> %x2
82  ret <32 x i8> %3
83}
84
85define <32 x i8>@test_int_x86_avx512_maskz_permvar_qi_256(<32 x i8> %x0, <32 x i8> %x1, i32 %x3) {
86; X86-LABEL: test_int_x86_avx512_maskz_permvar_qi_256:
87; X86:       # %bb.0:
88; X86-NEXT:    kmovd {{[0-9]+}}(%esp), %k1 # encoding: [0xc4,0xe1,0xf9,0x90,0x4c,0x24,0x04]
89; X86-NEXT:    vpermb %ymm0, %ymm1, %ymm0 {%k1} {z} # encoding: [0x62,0xf2,0x75,0xa9,0x8d,0xc0]
90; X86-NEXT:    retl # encoding: [0xc3]
91;
92; X64-LABEL: test_int_x86_avx512_maskz_permvar_qi_256:
93; X64:       # %bb.0:
94; X64-NEXT:    kmovd %edi, %k1 # encoding: [0xc5,0xfb,0x92,0xcf]
95; X64-NEXT:    vpermb %ymm0, %ymm1, %ymm0 {%k1} {z} # encoding: [0x62,0xf2,0x75,0xa9,0x8d,0xc0]
96; X64-NEXT:    retq # encoding: [0xc3]
97  %1 = call <32 x i8> @llvm.x86.avx512.permvar.qi.256(<32 x i8> %x0, <32 x i8> %x1)
98  %2 = bitcast i32 %x3 to <32 x i1>
99  %3 = select <32 x i1> %2, <32 x i8> %1, <32 x i8> zeroinitializer
100  ret <32 x i8> %3
101}
102
103declare <16 x i8> @llvm.x86.avx512.pmultishift.qb.128(<16 x i8>, <16 x i8>)
104
105define <16 x i8>@test_int_x86_avx512_pmultishift_qb_128(<16 x i8> %x0, <16 x i8> %x1, <16 x i8> %x2) {
106; CHECK-LABEL: test_int_x86_avx512_pmultishift_qb_128:
107; CHECK:       # %bb.0:
108; CHECK-NEXT:    vpmultishiftqb %xmm1, %xmm0, %xmm0 # encoding: [0x62,0xf2,0xfd,0x08,0x83,0xc1]
109; CHECK-NEXT:    ret{{[l|q]}} # encoding: [0xc3]
110  %1 = call <16 x i8> @llvm.x86.avx512.pmultishift.qb.128(<16 x i8> %x0, <16 x i8> %x1)
111  ret <16 x i8> %1
112}
113
114define <16 x i8>@test_int_x86_avx512_mask_pmultishift_qb_128(<16 x i8> %x0, <16 x i8> %x1, <16 x i8> %x2, i16 %x3) {
115; X86-LABEL: test_int_x86_avx512_mask_pmultishift_qb_128:
116; X86:       # %bb.0:
117; X86-NEXT:    kmovw {{[0-9]+}}(%esp), %k1 # encoding: [0xc5,0xf8,0x90,0x4c,0x24,0x04]
118; X86-NEXT:    vpmultishiftqb %xmm1, %xmm0, %xmm2 {%k1} # encoding: [0x62,0xf2,0xfd,0x09,0x83,0xd1]
119; X86-NEXT:    vmovdqa %xmm2, %xmm0 # EVEX TO VEX Compression encoding: [0xc5,0xf9,0x6f,0xc2]
120; X86-NEXT:    retl # encoding: [0xc3]
121;
122; X64-LABEL: test_int_x86_avx512_mask_pmultishift_qb_128:
123; X64:       # %bb.0:
124; X64-NEXT:    kmovd %edi, %k1 # encoding: [0xc5,0xfb,0x92,0xcf]
125; X64-NEXT:    vpmultishiftqb %xmm1, %xmm0, %xmm2 {%k1} # encoding: [0x62,0xf2,0xfd,0x09,0x83,0xd1]
126; X64-NEXT:    vmovdqa %xmm2, %xmm0 # EVEX TO VEX Compression encoding: [0xc5,0xf9,0x6f,0xc2]
127; X64-NEXT:    retq # encoding: [0xc3]
128  %1 = call <16 x i8> @llvm.x86.avx512.pmultishift.qb.128(<16 x i8> %x0, <16 x i8> %x1)
129  %2 = bitcast i16 %x3 to <16 x i1>
130  %3 = select <16 x i1> %2, <16 x i8> %1, <16 x i8> %x2
131  ret <16 x i8> %3
132}
133
134define <16 x i8>@test_int_x86_avx512_maskz_pmultishift_qb_128(<16 x i8> %x0, <16 x i8> %x1, i16 %x3) {
135; X86-LABEL: test_int_x86_avx512_maskz_pmultishift_qb_128:
136; X86:       # %bb.0:
137; X86-NEXT:    kmovw {{[0-9]+}}(%esp), %k1 # encoding: [0xc5,0xf8,0x90,0x4c,0x24,0x04]
138; X86-NEXT:    vpmultishiftqb %xmm1, %xmm0, %xmm0 {%k1} {z} # encoding: [0x62,0xf2,0xfd,0x89,0x83,0xc1]
139; X86-NEXT:    retl # encoding: [0xc3]
140;
141; X64-LABEL: test_int_x86_avx512_maskz_pmultishift_qb_128:
142; X64:       # %bb.0:
143; X64-NEXT:    kmovd %edi, %k1 # encoding: [0xc5,0xfb,0x92,0xcf]
144; X64-NEXT:    vpmultishiftqb %xmm1, %xmm0, %xmm0 {%k1} {z} # encoding: [0x62,0xf2,0xfd,0x89,0x83,0xc1]
145; X64-NEXT:    retq # encoding: [0xc3]
146  %1 = call <16 x i8> @llvm.x86.avx512.pmultishift.qb.128(<16 x i8> %x0, <16 x i8> %x1)
147  %2 = bitcast i16 %x3 to <16 x i1>
148  %3 = select <16 x i1> %2, <16 x i8> %1, <16 x i8> zeroinitializer
149  ret <16 x i8> %3
150}
151
152declare <32 x i8> @llvm.x86.avx512.pmultishift.qb.256(<32 x i8>, <32 x i8>)
153
154define <32 x i8>@test_int_x86_avx512_pmultishift_qb_256(<32 x i8> %x0, <32 x i8> %x1) {
155; CHECK-LABEL: test_int_x86_avx512_pmultishift_qb_256:
156; CHECK:       # %bb.0:
157; CHECK-NEXT:    vpmultishiftqb %ymm1, %ymm0, %ymm0 # encoding: [0x62,0xf2,0xfd,0x28,0x83,0xc1]
158; CHECK-NEXT:    ret{{[l|q]}} # encoding: [0xc3]
159  %1 = call <32 x i8> @llvm.x86.avx512.pmultishift.qb.256(<32 x i8> %x0, <32 x i8> %x1)
160  ret <32 x i8> %1
161}
162
163define <32 x i8>@test_int_x86_avx512_mask_pmultishift_qb_256(<32 x i8> %x0, <32 x i8> %x1, <32 x i8> %x2, i32 %x3) {
164; X86-LABEL: test_int_x86_avx512_mask_pmultishift_qb_256:
165; X86:       # %bb.0:
166; X86-NEXT:    kmovd {{[0-9]+}}(%esp), %k1 # encoding: [0xc4,0xe1,0xf9,0x90,0x4c,0x24,0x04]
167; X86-NEXT:    vpmultishiftqb %ymm1, %ymm0, %ymm2 {%k1} # encoding: [0x62,0xf2,0xfd,0x29,0x83,0xd1]
168; X86-NEXT:    vmovdqa %ymm2, %ymm0 # EVEX TO VEX Compression encoding: [0xc5,0xfd,0x6f,0xc2]
169; X86-NEXT:    retl # encoding: [0xc3]
170;
171; X64-LABEL: test_int_x86_avx512_mask_pmultishift_qb_256:
172; X64:       # %bb.0:
173; X64-NEXT:    kmovd %edi, %k1 # encoding: [0xc5,0xfb,0x92,0xcf]
174; X64-NEXT:    vpmultishiftqb %ymm1, %ymm0, %ymm2 {%k1} # encoding: [0x62,0xf2,0xfd,0x29,0x83,0xd1]
175; X64-NEXT:    vmovdqa %ymm2, %ymm0 # EVEX TO VEX Compression encoding: [0xc5,0xfd,0x6f,0xc2]
176; X64-NEXT:    retq # encoding: [0xc3]
177  %1 = call <32 x i8> @llvm.x86.avx512.pmultishift.qb.256(<32 x i8> %x0, <32 x i8> %x1)
178  %2 = bitcast i32 %x3 to <32 x i1>
179  %3 = select <32 x i1> %2, <32 x i8> %1, <32 x i8> %x2
180  ret <32 x i8> %3
181}
182
183define <32 x i8>@test_int_x86_avx512_maskz_pmultishift_qb_256(<32 x i8> %x0, <32 x i8> %x1, i32 %x3) {
184; X86-LABEL: test_int_x86_avx512_maskz_pmultishift_qb_256:
185; X86:       # %bb.0:
186; X86-NEXT:    kmovd {{[0-9]+}}(%esp), %k1 # encoding: [0xc4,0xe1,0xf9,0x90,0x4c,0x24,0x04]
187; X86-NEXT:    vpmultishiftqb %ymm1, %ymm0, %ymm0 {%k1} {z} # encoding: [0x62,0xf2,0xfd,0xa9,0x83,0xc1]
188; X86-NEXT:    retl # encoding: [0xc3]
189;
190; X64-LABEL: test_int_x86_avx512_maskz_pmultishift_qb_256:
191; X64:       # %bb.0:
192; X64-NEXT:    kmovd %edi, %k1 # encoding: [0xc5,0xfb,0x92,0xcf]
193; X64-NEXT:    vpmultishiftqb %ymm1, %ymm0, %ymm0 {%k1} {z} # encoding: [0x62,0xf2,0xfd,0xa9,0x83,0xc1]
194; X64-NEXT:    retq # encoding: [0xc3]
195  %1 = call <32 x i8> @llvm.x86.avx512.pmultishift.qb.256(<32 x i8> %x0, <32 x i8> %x1)
196  %2 = bitcast i32 %x3 to <32 x i1>
197  %3 = select <32 x i1> %2, <32 x i8> %1, <32 x i8> zeroinitializer
198  ret <32 x i8> %3
199}
200
201declare <16 x i8> @llvm.x86.avx512.vpermi2var.qi.128(<16 x i8>, <16 x i8>, <16 x i8>)
202
203define <16 x i8>@test_int_x86_avx512_vpermi2var_qi_128(<16 x i8> %x0, <16 x i8> %x1, <16 x i8> %x2) {
204; CHECK-LABEL: test_int_x86_avx512_vpermi2var_qi_128:
205; CHECK:       # %bb.0:
206; CHECK-NEXT:    vpermt2b %xmm2, %xmm1, %xmm0 # encoding: [0x62,0xf2,0x75,0x08,0x7d,0xc2]
207; CHECK-NEXT:    ret{{[l|q]}} # encoding: [0xc3]
208  %1 = call <16 x i8> @llvm.x86.avx512.vpermi2var.qi.128(<16 x i8> %x0, <16 x i8> %x1, <16 x i8> %x2)
209  ret <16 x i8> %1
210}
211
212define <16 x i8>@test_int_x86_avx512_mask_vpermi2var_qi_128(<16 x i8> %x0, <16 x i8> %x1, <16 x i8> %x2, i16 %x3) {
213; X86-LABEL: test_int_x86_avx512_mask_vpermi2var_qi_128:
214; X86:       # %bb.0:
215; X86-NEXT:    kmovw {{[0-9]+}}(%esp), %k1 # encoding: [0xc5,0xf8,0x90,0x4c,0x24,0x04]
216; X86-NEXT:    vpermi2b %xmm2, %xmm0, %xmm1 {%k1} # encoding: [0x62,0xf2,0x7d,0x09,0x75,0xca]
217; X86-NEXT:    vmovdqa %xmm1, %xmm0 # EVEX TO VEX Compression encoding: [0xc5,0xf9,0x6f,0xc1]
218; X86-NEXT:    retl # encoding: [0xc3]
219;
220; X64-LABEL: test_int_x86_avx512_mask_vpermi2var_qi_128:
221; X64:       # %bb.0:
222; X64-NEXT:    kmovd %edi, %k1 # encoding: [0xc5,0xfb,0x92,0xcf]
223; X64-NEXT:    vpermi2b %xmm2, %xmm0, %xmm1 {%k1} # encoding: [0x62,0xf2,0x7d,0x09,0x75,0xca]
224; X64-NEXT:    vmovdqa %xmm1, %xmm0 # EVEX TO VEX Compression encoding: [0xc5,0xf9,0x6f,0xc1]
225; X64-NEXT:    retq # encoding: [0xc3]
226  %1 = call <16 x i8> @llvm.x86.avx512.vpermi2var.qi.128(<16 x i8> %x0, <16 x i8> %x1, <16 x i8> %x2)
227  %2 = bitcast i16 %x3 to <16 x i1>
228  %3 = select <16 x i1> %2, <16 x i8> %1, <16 x i8> %x1
229  ret <16 x i8> %3
230}
231
232declare <32 x i8> @llvm.x86.avx512.vpermi2var.qi.256(<32 x i8>, <32 x i8>, <32 x i8>)
233
234define <32 x i8>@test_int_x86_avx512_vpermi2var_qi_256(<32 x i8> %x0, <32 x i8> %x1, <32 x i8> %x2) {
235; CHECK-LABEL: test_int_x86_avx512_vpermi2var_qi_256:
236; CHECK:       # %bb.0:
237; CHECK-NEXT:    vpermt2b %ymm2, %ymm1, %ymm0 # encoding: [0x62,0xf2,0x75,0x28,0x7d,0xc2]
238; CHECK-NEXT:    ret{{[l|q]}} # encoding: [0xc3]
239  %1 = call <32 x i8> @llvm.x86.avx512.vpermi2var.qi.256(<32 x i8> %x0, <32 x i8> %x1, <32 x i8> %x2)
240  ret <32 x i8> %1
241}
242
243define <32 x i8>@test_int_x86_avx512_mask_vpermi2var_qi_256(<32 x i8> %x0, <32 x i8> %x1, <32 x i8> %x2, i32 %x3) {
244; X86-LABEL: test_int_x86_avx512_mask_vpermi2var_qi_256:
245; X86:       # %bb.0:
246; X86-NEXT:    kmovd {{[0-9]+}}(%esp), %k1 # encoding: [0xc4,0xe1,0xf9,0x90,0x4c,0x24,0x04]
247; X86-NEXT:    vpermi2b %ymm2, %ymm0, %ymm1 {%k1} # encoding: [0x62,0xf2,0x7d,0x29,0x75,0xca]
248; X86-NEXT:    vmovdqa %ymm1, %ymm0 # EVEX TO VEX Compression encoding: [0xc5,0xfd,0x6f,0xc1]
249; X86-NEXT:    retl # encoding: [0xc3]
250;
251; X64-LABEL: test_int_x86_avx512_mask_vpermi2var_qi_256:
252; X64:       # %bb.0:
253; X64-NEXT:    kmovd %edi, %k1 # encoding: [0xc5,0xfb,0x92,0xcf]
254; X64-NEXT:    vpermi2b %ymm2, %ymm0, %ymm1 {%k1} # encoding: [0x62,0xf2,0x7d,0x29,0x75,0xca]
255; X64-NEXT:    vmovdqa %ymm1, %ymm0 # EVEX TO VEX Compression encoding: [0xc5,0xfd,0x6f,0xc1]
256; X64-NEXT:    retq # encoding: [0xc3]
257  %1 = call <32 x i8> @llvm.x86.avx512.vpermi2var.qi.256(<32 x i8> %x0, <32 x i8> %x1, <32 x i8> %x2)
258  %2 = bitcast i32 %x3 to <32 x i1>
259  %3 = select <32 x i1> %2, <32 x i8> %1, <32 x i8> %x1
260  ret <32 x i8> %3
261}
262
263define <16 x i8>@test_int_x86_avx512_vpermt2var_qi_128(<16 x i8> %x0, <16 x i8> %x1, <16 x i8> %x2) {
264; CHECK-LABEL: test_int_x86_avx512_vpermt2var_qi_128:
265; CHECK:       # %bb.0:
266; CHECK-NEXT:    vpermi2b %xmm2, %xmm1, %xmm0 # encoding: [0x62,0xf2,0x75,0x08,0x75,0xc2]
267; CHECK-NEXT:    ret{{[l|q]}} # encoding: [0xc3]
268  %1 = call <16 x i8> @llvm.x86.avx512.vpermi2var.qi.128(<16 x i8> %x1, <16 x i8> %x0, <16 x i8> %x2)
269  ret <16 x i8> %1
270}
271
272define <16 x i8>@test_int_x86_avx512_mask_vpermt2var_qi_128(<16 x i8> %x0, <16 x i8> %x1, <16 x i8> %x2, i16 %x3) {
273; X86-LABEL: test_int_x86_avx512_mask_vpermt2var_qi_128:
274; X86:       # %bb.0:
275; X86-NEXT:    kmovw {{[0-9]+}}(%esp), %k1 # encoding: [0xc5,0xf8,0x90,0x4c,0x24,0x04]
276; X86-NEXT:    vpermt2b %xmm2, %xmm0, %xmm1 {%k1} # encoding: [0x62,0xf2,0x7d,0x09,0x7d,0xca]
277; X86-NEXT:    vmovdqa %xmm1, %xmm0 # EVEX TO VEX Compression encoding: [0xc5,0xf9,0x6f,0xc1]
278; X86-NEXT:    retl # encoding: [0xc3]
279;
280; X64-LABEL: test_int_x86_avx512_mask_vpermt2var_qi_128:
281; X64:       # %bb.0:
282; X64-NEXT:    kmovd %edi, %k1 # encoding: [0xc5,0xfb,0x92,0xcf]
283; X64-NEXT:    vpermt2b %xmm2, %xmm0, %xmm1 {%k1} # encoding: [0x62,0xf2,0x7d,0x09,0x7d,0xca]
284; X64-NEXT:    vmovdqa %xmm1, %xmm0 # EVEX TO VEX Compression encoding: [0xc5,0xf9,0x6f,0xc1]
285; X64-NEXT:    retq # encoding: [0xc3]
286  %1 = call <16 x i8> @llvm.x86.avx512.vpermi2var.qi.128(<16 x i8> %x1, <16 x i8> %x0, <16 x i8> %x2)
287  %2 = bitcast i16 %x3 to <16 x i1>
288  %3 = select <16 x i1> %2, <16 x i8> %1, <16 x i8> %x1
289  ret <16 x i8> %3
290}
291
292define <32 x i8>@test_int_x86_avx512_vpermt2var_qi_256(<32 x i8> %x0, <32 x i8> %x1, <32 x i8> %x2) {
293; CHECK-LABEL: test_int_x86_avx512_vpermt2var_qi_256:
294; CHECK:       # %bb.0:
295; CHECK-NEXT:    vpermi2b %ymm2, %ymm1, %ymm0 # encoding: [0x62,0xf2,0x75,0x28,0x75,0xc2]
296; CHECK-NEXT:    ret{{[l|q]}} # encoding: [0xc3]
297  %1 = call <32 x i8> @llvm.x86.avx512.vpermi2var.qi.256(<32 x i8> %x1, <32 x i8> %x0, <32 x i8> %x2)
298  ret <32 x i8> %1
299}
300
301define <32 x i8>@test_int_x86_avx512_mask_vpermt2var_qi_256(<32 x i8> %x0, <32 x i8> %x1, <32 x i8> %x2, i32 %x3) {
302; X86-LABEL: test_int_x86_avx512_mask_vpermt2var_qi_256:
303; X86:       # %bb.0:
304; X86-NEXT:    kmovd {{[0-9]+}}(%esp), %k1 # encoding: [0xc4,0xe1,0xf9,0x90,0x4c,0x24,0x04]
305; X86-NEXT:    vpermt2b %ymm2, %ymm0, %ymm1 {%k1} # encoding: [0x62,0xf2,0x7d,0x29,0x7d,0xca]
306; X86-NEXT:    vmovdqa %ymm1, %ymm0 # EVEX TO VEX Compression encoding: [0xc5,0xfd,0x6f,0xc1]
307; X86-NEXT:    retl # encoding: [0xc3]
308;
309; X64-LABEL: test_int_x86_avx512_mask_vpermt2var_qi_256:
310; X64:       # %bb.0:
311; X64-NEXT:    kmovd %edi, %k1 # encoding: [0xc5,0xfb,0x92,0xcf]
312; X64-NEXT:    vpermt2b %ymm2, %ymm0, %ymm1 {%k1} # encoding: [0x62,0xf2,0x7d,0x29,0x7d,0xca]
313; X64-NEXT:    vmovdqa %ymm1, %ymm0 # EVEX TO VEX Compression encoding: [0xc5,0xfd,0x6f,0xc1]
314; X64-NEXT:    retq # encoding: [0xc3]
315  %1 = call <32 x i8> @llvm.x86.avx512.vpermi2var.qi.256(<32 x i8> %x1, <32 x i8> %x0, <32 x i8> %x2)
316  %2 = bitcast i32 %x3 to <32 x i1>
317  %3 = select <32 x i1> %2, <32 x i8> %1, <32 x i8> %x1
318  ret <32 x i8> %3
319}
320
321define <16 x i8>@test_int_x86_avx512_maskz_vpermt2var_qi_128(<16 x i8> %x0, <16 x i8> %x1, <16 x i8> %x2, i16 %x3) {
322; X86-LABEL: test_int_x86_avx512_maskz_vpermt2var_qi_128:
323; X86:       # %bb.0:
324; X86-NEXT:    kmovw {{[0-9]+}}(%esp), %k1 # encoding: [0xc5,0xf8,0x90,0x4c,0x24,0x04]
325; X86-NEXT:    vpermi2b %xmm2, %xmm1, %xmm0 {%k1} {z} # encoding: [0x62,0xf2,0x75,0x89,0x75,0xc2]
326; X86-NEXT:    retl # encoding: [0xc3]
327;
328; X64-LABEL: test_int_x86_avx512_maskz_vpermt2var_qi_128:
329; X64:       # %bb.0:
330; X64-NEXT:    kmovd %edi, %k1 # encoding: [0xc5,0xfb,0x92,0xcf]
331; X64-NEXT:    vpermi2b %xmm2, %xmm1, %xmm0 {%k1} {z} # encoding: [0x62,0xf2,0x75,0x89,0x75,0xc2]
332; X64-NEXT:    retq # encoding: [0xc3]
333  %1 = call <16 x i8> @llvm.x86.avx512.vpermi2var.qi.128(<16 x i8> %x1, <16 x i8> %x0, <16 x i8> %x2)
334  %2 = bitcast i16 %x3 to <16 x i1>
335  %3 = select <16 x i1> %2, <16 x i8> %1, <16 x i8> zeroinitializer
336  ret <16 x i8> %3
337}
338
339define <32 x i8>@test_int_x86_avx512_maskz_vpermt2var_qi_256(<32 x i8> %x0, <32 x i8> %x1, <32 x i8> %x2, i32 %x3) {
340; X86-LABEL: test_int_x86_avx512_maskz_vpermt2var_qi_256:
341; X86:       # %bb.0:
342; X86-NEXT:    kmovd {{[0-9]+}}(%esp), %k1 # encoding: [0xc4,0xe1,0xf9,0x90,0x4c,0x24,0x04]
343; X86-NEXT:    vpermi2b %ymm2, %ymm1, %ymm0 {%k1} {z} # encoding: [0x62,0xf2,0x75,0xa9,0x75,0xc2]
344; X86-NEXT:    retl # encoding: [0xc3]
345;
346; X64-LABEL: test_int_x86_avx512_maskz_vpermt2var_qi_256:
347; X64:       # %bb.0:
348; X64-NEXT:    kmovd %edi, %k1 # encoding: [0xc5,0xfb,0x92,0xcf]
349; X64-NEXT:    vpermi2b %ymm2, %ymm1, %ymm0 {%k1} {z} # encoding: [0x62,0xf2,0x75,0xa9,0x75,0xc2]
350; X64-NEXT:    retq # encoding: [0xc3]
351  %1 = call <32 x i8> @llvm.x86.avx512.vpermi2var.qi.256(<32 x i8> %x1, <32 x i8> %x0, <32 x i8> %x2)
352  %2 = bitcast i32 %x3 to <32 x i1>
353  %3 = select <32 x i1> %2, <32 x i8> %1, <32 x i8> zeroinitializer
354  ret <32 x i8> %3
355}
356