1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse2 | FileCheck %s --check-prefix=ALL --check-prefix=SSE --check-prefix=SSE2
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse4.1 | FileCheck %s --check-prefix=ALL --check-prefix=SSE --check-prefix=SSE41
4 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx | FileCheck %s --check-prefix=ALL --check-prefix=AVX --check-prefix=AVX1
5 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2 | FileCheck %s --check-prefix=ALL --check-prefix=AVX --check-prefix=AVX2
6 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+xop,+avx | FileCheck %s --check-prefix=ALL --check-prefix=XOP --check-prefix=XOPAVX1
7 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+xop,+avx2 | FileCheck %s --check-prefix=ALL --check-prefix=XOP --check-prefix=XOPAVX2
8 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512dq | FileCheck %s --check-prefix=ALL --check-prefix=AVX512 --check-prefix=AVX512DQ
9 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512bw | FileCheck %s --check-prefix=ALL --check-prefix=AVX512 --check-prefix=AVX512BW
10 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512dq,+avx512vl | FileCheck %s --check-prefix=ALL --check-prefix=AVX512VL --check-prefix=AVX512DQVL
11 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512bw,+avx512vl | FileCheck %s --check-prefix=ALL --check-prefix=AVX512VL --check-prefix=AVX512BWVL
13 ; Just one 32-bit run to make sure we do reasonable things for i64 shifts.
14 ; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+sse2 | FileCheck %s --check-prefix=ALL --check-prefix=X32-SSE --check-prefix=X32-SSE2
20 define <2 x i32> @var_shift_v2i32(<2 x i32> %a, <2 x i32> %b) nounwind {
21 ; SSE2-LABEL: var_shift_v2i32:
23 ; SSE2-NEXT: pand {{.*}}(%rip), %xmm1
24 ; SSE2-NEXT: movdqa %xmm0, %xmm2
25 ; SSE2-NEXT: psllq %xmm1, %xmm2
26 ; SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
27 ; SSE2-NEXT: psllq %xmm1, %xmm0
28 ; SSE2-NEXT: movsd {{.*#+}} xmm0 = xmm2[0],xmm0[1]
31 ; SSE41-LABEL: var_shift_v2i32:
33 ; SSE41-NEXT: pxor %xmm2, %xmm2
34 ; SSE41-NEXT: pblendw {{.*#+}} xmm2 = xmm1[0,1],xmm2[2,3],xmm1[4,5],xmm2[6,7]
35 ; SSE41-NEXT: movdqa %xmm0, %xmm1
36 ; SSE41-NEXT: psllq %xmm2, %xmm1
37 ; SSE41-NEXT: pshufd {{.*#+}} xmm2 = xmm2[2,3,0,1]
38 ; SSE41-NEXT: psllq %xmm2, %xmm0
39 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm1[0,1,2,3],xmm0[4,5,6,7]
42 ; AVX1-LABEL: var_shift_v2i32:
44 ; AVX1-NEXT: vpxor %xmm2, %xmm2, %xmm2
45 ; AVX1-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0,1],xmm2[2,3],xmm1[4,5],xmm2[6,7]
46 ; AVX1-NEXT: vpsllq %xmm1, %xmm0, %xmm2
47 ; AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
48 ; AVX1-NEXT: vpsllq %xmm1, %xmm0, %xmm0
49 ; AVX1-NEXT: vpblendw {{.*#+}} xmm0 = xmm2[0,1,2,3],xmm0[4,5,6,7]
52 ; AVX2-LABEL: var_shift_v2i32:
54 ; AVX2-NEXT: vpxor %xmm2, %xmm2, %xmm2
55 ; AVX2-NEXT: vpblendd {{.*#+}} xmm1 = xmm1[0],xmm2[1],xmm1[2],xmm2[3]
56 ; AVX2-NEXT: vpsllvq %xmm1, %xmm0, %xmm0
59 ; XOPAVX1-LABEL: var_shift_v2i32:
61 ; XOPAVX1-NEXT: vpxor %xmm2, %xmm2, %xmm2
62 ; XOPAVX1-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0,1],xmm2[2,3],xmm1[4,5],xmm2[6,7]
63 ; XOPAVX1-NEXT: vpshlq %xmm1, %xmm0, %xmm0
66 ; XOPAVX2-LABEL: var_shift_v2i32:
68 ; XOPAVX2-NEXT: vpxor %xmm2, %xmm2, %xmm2
69 ; XOPAVX2-NEXT: vpblendd {{.*#+}} xmm1 = xmm1[0],xmm2[1],xmm1[2],xmm2[3]
70 ; XOPAVX2-NEXT: vpsllvq %xmm1, %xmm0, %xmm0
73 ; AVX512-LABEL: var_shift_v2i32:
75 ; AVX512-NEXT: vpxor %xmm2, %xmm2, %xmm2
76 ; AVX512-NEXT: vpblendd {{.*#+}} xmm1 = xmm1[0],xmm2[1],xmm1[2],xmm2[3]
77 ; AVX512-NEXT: vpsllvq %xmm1, %xmm0, %xmm0
80 ; AVX512VL-LABEL: var_shift_v2i32:
82 ; AVX512VL-NEXT: vpxor %xmm2, %xmm2, %xmm2
83 ; AVX512VL-NEXT: vpblendd {{.*#+}} xmm1 = xmm1[0],xmm2[1],xmm1[2],xmm2[3]
84 ; AVX512VL-NEXT: vpsllvq %xmm1, %xmm0, %xmm0
87 ; X32-SSE-LABEL: var_shift_v2i32:
89 ; X32-SSE-NEXT: pand {{\.LCPI.*}}, %xmm1
90 ; X32-SSE-NEXT: movdqa %xmm0, %xmm2
91 ; X32-SSE-NEXT: psllq %xmm1, %xmm2
92 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
93 ; X32-SSE-NEXT: xorps %xmm3, %xmm3
94 ; X32-SSE-NEXT: movss {{.*#+}} xmm3 = xmm1[0],xmm3[1,2,3]
95 ; X32-SSE-NEXT: psllq %xmm3, %xmm0
96 ; X32-SSE-NEXT: movsd {{.*#+}} xmm0 = xmm2[0],xmm0[1]
98 %shift = shl <2 x i32> %a, %b
102 define <4 x i16> @var_shift_v4i16(<4 x i16> %a, <4 x i16> %b) nounwind {
103 ; SSE2-LABEL: var_shift_v4i16:
105 ; SSE2-NEXT: pslld $23, %xmm1
106 ; SSE2-NEXT: paddd {{.*}}(%rip), %xmm1
107 ; SSE2-NEXT: cvttps2dq %xmm1, %xmm1
108 ; SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm0[1,1,3,3]
109 ; SSE2-NEXT: pmuludq %xmm1, %xmm0
110 ; SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,2,2,3]
111 ; SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
112 ; SSE2-NEXT: pmuludq %xmm2, %xmm1
113 ; SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,2,2,3]
114 ; SSE2-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
117 ; SSE41-LABEL: var_shift_v4i16:
119 ; SSE41-NEXT: pslld $23, %xmm1
120 ; SSE41-NEXT: paddd {{.*}}(%rip), %xmm1
121 ; SSE41-NEXT: cvttps2dq %xmm1, %xmm1
122 ; SSE41-NEXT: pmulld %xmm1, %xmm0
125 ; AVX1-LABEL: var_shift_v4i16:
127 ; AVX1-NEXT: vpslld $23, %xmm1, %xmm1
128 ; AVX1-NEXT: vpaddd {{.*}}(%rip), %xmm1, %xmm1
129 ; AVX1-NEXT: vcvttps2dq %xmm1, %xmm1
130 ; AVX1-NEXT: vpmulld %xmm1, %xmm0, %xmm0
133 ; AVX2-LABEL: var_shift_v4i16:
135 ; AVX2-NEXT: vpxor %xmm2, %xmm2, %xmm2
136 ; AVX2-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0],xmm2[1],xmm1[2],xmm2[3],xmm1[4],xmm2[5],xmm1[6],xmm2[7]
137 ; AVX2-NEXT: vpsllvd %xmm1, %xmm0, %xmm0
140 ; XOPAVX1-LABEL: var_shift_v4i16:
142 ; XOPAVX1-NEXT: vpxor %xmm2, %xmm2, %xmm2
143 ; XOPAVX1-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0],xmm2[1],xmm1[2],xmm2[3],xmm1[4],xmm2[5],xmm1[6],xmm2[7]
144 ; XOPAVX1-NEXT: vpshld %xmm1, %xmm0, %xmm0
147 ; XOPAVX2-LABEL: var_shift_v4i16:
149 ; XOPAVX2-NEXT: vpxor %xmm2, %xmm2, %xmm2
150 ; XOPAVX2-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0],xmm2[1],xmm1[2],xmm2[3],xmm1[4],xmm2[5],xmm1[6],xmm2[7]
151 ; XOPAVX2-NEXT: vpsllvd %xmm1, %xmm0, %xmm0
154 ; AVX512-LABEL: var_shift_v4i16:
156 ; AVX512-NEXT: vpxor %xmm2, %xmm2, %xmm2
157 ; AVX512-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0],xmm2[1],xmm1[2],xmm2[3],xmm1[4],xmm2[5],xmm1[6],xmm2[7]
158 ; AVX512-NEXT: vpsllvd %xmm1, %xmm0, %xmm0
161 ; AVX512VL-LABEL: var_shift_v4i16:
163 ; AVX512VL-NEXT: vpxor %xmm2, %xmm2, %xmm2
164 ; AVX512VL-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0],xmm2[1],xmm1[2],xmm2[3],xmm1[4],xmm2[5],xmm1[6],xmm2[7]
165 ; AVX512VL-NEXT: vpsllvd %xmm1, %xmm0, %xmm0
166 ; AVX512VL-NEXT: retq
168 ; X32-SSE-LABEL: var_shift_v4i16:
170 ; X32-SSE-NEXT: pslld $23, %xmm1
171 ; X32-SSE-NEXT: paddd {{\.LCPI.*}}, %xmm1
172 ; X32-SSE-NEXT: cvttps2dq %xmm1, %xmm1
173 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm2 = xmm0[1,1,3,3]
174 ; X32-SSE-NEXT: pmuludq %xmm1, %xmm0
175 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,2,2,3]
176 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
177 ; X32-SSE-NEXT: pmuludq %xmm2, %xmm1
178 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,2,2,3]
179 ; X32-SSE-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
181 %shift = shl <4 x i16> %a, %b
185 define <2 x i16> @var_shift_v2i16(<2 x i16> %a, <2 x i16> %b) nounwind {
186 ; SSE2-LABEL: var_shift_v2i16:
188 ; SSE2-NEXT: pand {{.*}}(%rip), %xmm1
189 ; SSE2-NEXT: movdqa %xmm0, %xmm2
190 ; SSE2-NEXT: psllq %xmm1, %xmm2
191 ; SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
192 ; SSE2-NEXT: psllq %xmm1, %xmm0
193 ; SSE2-NEXT: movsd {{.*#+}} xmm0 = xmm2[0],xmm0[1]
196 ; SSE41-LABEL: var_shift_v2i16:
198 ; SSE41-NEXT: pxor %xmm2, %xmm2
199 ; SSE41-NEXT: pblendw {{.*#+}} xmm2 = xmm1[0],xmm2[1,2,3],xmm1[4],xmm2[5,6,7]
200 ; SSE41-NEXT: movdqa %xmm0, %xmm1
201 ; SSE41-NEXT: psllq %xmm2, %xmm1
202 ; SSE41-NEXT: pshufd {{.*#+}} xmm2 = xmm2[2,3,0,1]
203 ; SSE41-NEXT: psllq %xmm2, %xmm0
204 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm1[0,1,2,3],xmm0[4,5,6,7]
207 ; AVX1-LABEL: var_shift_v2i16:
209 ; AVX1-NEXT: vpxor %xmm2, %xmm2, %xmm2
210 ; AVX1-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0],xmm2[1,2,3],xmm1[4],xmm2[5,6,7]
211 ; AVX1-NEXT: vpsllq %xmm1, %xmm0, %xmm2
212 ; AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
213 ; AVX1-NEXT: vpsllq %xmm1, %xmm0, %xmm0
214 ; AVX1-NEXT: vpblendw {{.*#+}} xmm0 = xmm2[0,1,2,3],xmm0[4,5,6,7]
217 ; AVX2-LABEL: var_shift_v2i16:
219 ; AVX2-NEXT: vpxor %xmm2, %xmm2, %xmm2
220 ; AVX2-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0],xmm2[1,2,3],xmm1[4],xmm2[5,6,7]
221 ; AVX2-NEXT: vpsllvq %xmm1, %xmm0, %xmm0
224 ; XOPAVX1-LABEL: var_shift_v2i16:
226 ; XOPAVX1-NEXT: vpxor %xmm2, %xmm2, %xmm2
227 ; XOPAVX1-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0],xmm2[1,2,3],xmm1[4],xmm2[5,6,7]
228 ; XOPAVX1-NEXT: vpshlq %xmm1, %xmm0, %xmm0
231 ; XOPAVX2-LABEL: var_shift_v2i16:
233 ; XOPAVX2-NEXT: vpxor %xmm2, %xmm2, %xmm2
234 ; XOPAVX2-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0],xmm2[1,2,3],xmm1[4],xmm2[5,6,7]
235 ; XOPAVX2-NEXT: vpsllvq %xmm1, %xmm0, %xmm0
238 ; AVX512-LABEL: var_shift_v2i16:
240 ; AVX512-NEXT: vpxor %xmm2, %xmm2, %xmm2
241 ; AVX512-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0],xmm2[1,2,3],xmm1[4],xmm2[5,6,7]
242 ; AVX512-NEXT: vpsllvq %xmm1, %xmm0, %xmm0
245 ; AVX512VL-LABEL: var_shift_v2i16:
247 ; AVX512VL-NEXT: vpxor %xmm2, %xmm2, %xmm2
248 ; AVX512VL-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0],xmm2[1,2,3],xmm1[4],xmm2[5,6,7]
249 ; AVX512VL-NEXT: vpsllvq %xmm1, %xmm0, %xmm0
250 ; AVX512VL-NEXT: retq
252 ; X32-SSE-LABEL: var_shift_v2i16:
254 ; X32-SSE-NEXT: pand {{\.LCPI.*}}, %xmm1
255 ; X32-SSE-NEXT: movdqa %xmm0, %xmm2
256 ; X32-SSE-NEXT: psllq %xmm1, %xmm2
257 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
258 ; X32-SSE-NEXT: psllq %xmm1, %xmm0
259 ; X32-SSE-NEXT: movsd {{.*#+}} xmm0 = xmm2[0],xmm0[1]
261 %shift = shl <2 x i16> %a, %b
265 define <8 x i8> @var_shift_v8i8(<8 x i8> %a, <8 x i8> %b) nounwind {
266 ; SSE2-LABEL: var_shift_v8i8:
268 ; SSE2-NEXT: pand {{.*}}(%rip), %xmm1
269 ; SSE2-NEXT: pxor %xmm2, %xmm2
270 ; SSE2-NEXT: movdqa %xmm1, %xmm3
271 ; SSE2-NEXT: punpckhwd {{.*#+}} xmm3 = xmm3[4],xmm2[4],xmm3[5],xmm2[5],xmm3[6],xmm2[6],xmm3[7],xmm2[7]
272 ; SSE2-NEXT: pslld $23, %xmm3
273 ; SSE2-NEXT: movdqa {{.*#+}} xmm4 = [1065353216,1065353216,1065353216,1065353216]
274 ; SSE2-NEXT: paddd %xmm4, %xmm3
275 ; SSE2-NEXT: cvttps2dq %xmm3, %xmm3
276 ; SSE2-NEXT: pshuflw {{.*#+}} xmm3 = xmm3[0,2,2,3,4,5,6,7]
277 ; SSE2-NEXT: pshufhw {{.*#+}} xmm3 = xmm3[0,1,2,3,4,6,6,7]
278 ; SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm3[0,2,2,3]
279 ; SSE2-NEXT: punpcklwd {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3]
280 ; SSE2-NEXT: pslld $23, %xmm1
281 ; SSE2-NEXT: paddd %xmm4, %xmm1
282 ; SSE2-NEXT: cvttps2dq %xmm1, %xmm1
283 ; SSE2-NEXT: pshuflw {{.*#+}} xmm1 = xmm1[0,2,2,3,4,5,6,7]
284 ; SSE2-NEXT: pshufhw {{.*#+}} xmm1 = xmm1[0,1,2,3,4,6,6,7]
285 ; SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,2,2,3]
286 ; SSE2-NEXT: punpcklqdq {{.*#+}} xmm1 = xmm1[0],xmm3[0]
287 ; SSE2-NEXT: pmullw %xmm1, %xmm0
290 ; SSE41-LABEL: var_shift_v8i8:
292 ; SSE41-NEXT: movdqa {{.*#+}} xmm2 = [255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0]
293 ; SSE41-NEXT: pand %xmm1, %xmm2
294 ; SSE41-NEXT: pxor %xmm3, %xmm3
295 ; SSE41-NEXT: punpckhbw {{.*#+}} xmm1 = xmm1[8],xmm3[8],xmm1[9],xmm3[9],xmm1[10],xmm3[10],xmm1[11],xmm3[11],xmm1[12],xmm3[12],xmm1[13],xmm3[13],xmm1[14],xmm3[14],xmm1[15],xmm3[15]
296 ; SSE41-NEXT: pslld $23, %xmm1
297 ; SSE41-NEXT: movdqa {{.*#+}} xmm3 = [1065353216,1065353216,1065353216,1065353216]
298 ; SSE41-NEXT: paddd %xmm3, %xmm1
299 ; SSE41-NEXT: cvttps2dq %xmm1, %xmm1
300 ; SSE41-NEXT: pmovzxwd {{.*#+}} xmm2 = xmm2[0],zero,xmm2[1],zero,xmm2[2],zero,xmm2[3],zero
301 ; SSE41-NEXT: pslld $23, %xmm2
302 ; SSE41-NEXT: paddd %xmm3, %xmm2
303 ; SSE41-NEXT: cvttps2dq %xmm2, %xmm2
304 ; SSE41-NEXT: packusdw %xmm1, %xmm2
305 ; SSE41-NEXT: pmullw %xmm2, %xmm0
308 ; AVX1-LABEL: var_shift_v8i8:
310 ; AVX1-NEXT: vpand {{.*}}(%rip), %xmm1, %xmm2
311 ; AVX1-NEXT: vpxor %xmm3, %xmm3, %xmm3
312 ; AVX1-NEXT: vpunpckhbw {{.*#+}} xmm1 = xmm1[8],xmm3[8],xmm1[9],xmm3[9],xmm1[10],xmm3[10],xmm1[11],xmm3[11],xmm1[12],xmm3[12],xmm1[13],xmm3[13],xmm1[14],xmm3[14],xmm1[15],xmm3[15]
313 ; AVX1-NEXT: vpslld $23, %xmm1, %xmm1
314 ; AVX1-NEXT: vmovdqa {{.*#+}} xmm3 = [1065353216,1065353216,1065353216,1065353216]
315 ; AVX1-NEXT: vpaddd %xmm3, %xmm1, %xmm1
316 ; AVX1-NEXT: vcvttps2dq %xmm1, %xmm1
317 ; AVX1-NEXT: vpmovzxwd {{.*#+}} xmm2 = xmm2[0],zero,xmm2[1],zero,xmm2[2],zero,xmm2[3],zero
318 ; AVX1-NEXT: vpslld $23, %xmm2, %xmm2
319 ; AVX1-NEXT: vpaddd %xmm3, %xmm2, %xmm2
320 ; AVX1-NEXT: vcvttps2dq %xmm2, %xmm2
321 ; AVX1-NEXT: vpackusdw %xmm1, %xmm2, %xmm1
322 ; AVX1-NEXT: vpmullw %xmm1, %xmm0, %xmm0
325 ; AVX2-LABEL: var_shift_v8i8:
327 ; AVX2-NEXT: vpand {{.*}}(%rip), %xmm1, %xmm1
328 ; AVX2-NEXT: vpmovzxwd {{.*#+}} ymm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero
329 ; AVX2-NEXT: vpmovzxwd {{.*#+}} ymm1 = xmm1[0],zero,xmm1[1],zero,xmm1[2],zero,xmm1[3],zero,xmm1[4],zero,xmm1[5],zero,xmm1[6],zero,xmm1[7],zero
330 ; AVX2-NEXT: vpsllvd %ymm1, %ymm0, %ymm0
331 ; AVX2-NEXT: vpshufb {{.*#+}} ymm0 = ymm0[0,1,4,5,8,9,12,13,8,9,12,13,12,13,14,15,16,17,20,21,24,25,28,29,24,25,28,29,28,29,30,31]
332 ; AVX2-NEXT: vpermq {{.*#+}} ymm0 = ymm0[0,2,2,3]
333 ; AVX2-NEXT: # kill: def $xmm0 killed $xmm0 killed $ymm0
334 ; AVX2-NEXT: vzeroupper
337 ; XOP-LABEL: var_shift_v8i8:
339 ; XOP-NEXT: vpand {{.*}}(%rip), %xmm1, %xmm1
340 ; XOP-NEXT: vpshlw %xmm1, %xmm0, %xmm0
343 ; AVX512DQ-LABEL: var_shift_v8i8:
345 ; AVX512DQ-NEXT: vpand {{.*}}(%rip), %xmm1, %xmm1
346 ; AVX512DQ-NEXT: vpmovzxwd {{.*#+}} ymm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero
347 ; AVX512DQ-NEXT: vpmovzxwd {{.*#+}} ymm1 = xmm1[0],zero,xmm1[1],zero,xmm1[2],zero,xmm1[3],zero,xmm1[4],zero,xmm1[5],zero,xmm1[6],zero,xmm1[7],zero
348 ; AVX512DQ-NEXT: vpsllvd %ymm1, %ymm0, %ymm0
349 ; AVX512DQ-NEXT: vpmovdw %zmm0, %ymm0
350 ; AVX512DQ-NEXT: # kill: def $xmm0 killed $xmm0 killed $ymm0
351 ; AVX512DQ-NEXT: vzeroupper
352 ; AVX512DQ-NEXT: retq
354 ; AVX512BW-LABEL: var_shift_v8i8:
356 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
357 ; AVX512BW-NEXT: vpand {{.*}}(%rip), %xmm1, %xmm1
358 ; AVX512BW-NEXT: vpsllvw %zmm1, %zmm0, %zmm0
359 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 killed $zmm0
360 ; AVX512BW-NEXT: vzeroupper
361 ; AVX512BW-NEXT: retq
363 ; AVX512DQVL-LABEL: var_shift_v8i8:
364 ; AVX512DQVL: # %bb.0:
365 ; AVX512DQVL-NEXT: vpand {{.*}}(%rip), %xmm1, %xmm1
366 ; AVX512DQVL-NEXT: vpmovzxwd {{.*#+}} ymm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero
367 ; AVX512DQVL-NEXT: vpmovzxwd {{.*#+}} ymm1 = xmm1[0],zero,xmm1[1],zero,xmm1[2],zero,xmm1[3],zero,xmm1[4],zero,xmm1[5],zero,xmm1[6],zero,xmm1[7],zero
368 ; AVX512DQVL-NEXT: vpsllvd %ymm1, %ymm0, %ymm0
369 ; AVX512DQVL-NEXT: vpmovdw %ymm0, %xmm0
370 ; AVX512DQVL-NEXT: vzeroupper
371 ; AVX512DQVL-NEXT: retq
373 ; AVX512BWVL-LABEL: var_shift_v8i8:
374 ; AVX512BWVL: # %bb.0:
375 ; AVX512BWVL-NEXT: vpand {{.*}}(%rip), %xmm1, %xmm1
376 ; AVX512BWVL-NEXT: vpsllvw %xmm1, %xmm0, %xmm0
377 ; AVX512BWVL-NEXT: retq
379 ; X32-SSE-LABEL: var_shift_v8i8:
381 ; X32-SSE-NEXT: pand {{\.LCPI.*}}, %xmm1
382 ; X32-SSE-NEXT: pxor %xmm2, %xmm2
383 ; X32-SSE-NEXT: movdqa %xmm1, %xmm3
384 ; X32-SSE-NEXT: punpckhwd {{.*#+}} xmm3 = xmm3[4],xmm2[4],xmm3[5],xmm2[5],xmm3[6],xmm2[6],xmm3[7],xmm2[7]
385 ; X32-SSE-NEXT: pslld $23, %xmm3
386 ; X32-SSE-NEXT: movdqa {{.*#+}} xmm4 = [1065353216,1065353216,1065353216,1065353216]
387 ; X32-SSE-NEXT: paddd %xmm4, %xmm3
388 ; X32-SSE-NEXT: cvttps2dq %xmm3, %xmm3
389 ; X32-SSE-NEXT: pshuflw {{.*#+}} xmm3 = xmm3[0,2,2,3,4,5,6,7]
390 ; X32-SSE-NEXT: pshufhw {{.*#+}} xmm3 = xmm3[0,1,2,3,4,6,6,7]
391 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm3 = xmm3[0,2,2,3]
392 ; X32-SSE-NEXT: punpcklwd {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3]
393 ; X32-SSE-NEXT: pslld $23, %xmm1
394 ; X32-SSE-NEXT: paddd %xmm4, %xmm1
395 ; X32-SSE-NEXT: cvttps2dq %xmm1, %xmm1
396 ; X32-SSE-NEXT: pshuflw {{.*#+}} xmm1 = xmm1[0,2,2,3,4,5,6,7]
397 ; X32-SSE-NEXT: pshufhw {{.*#+}} xmm1 = xmm1[0,1,2,3,4,6,6,7]
398 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,2,2,3]
399 ; X32-SSE-NEXT: punpcklqdq {{.*#+}} xmm1 = xmm1[0],xmm3[0]
400 ; X32-SSE-NEXT: pmullw %xmm1, %xmm0
402 %shift = shl <8 x i8> %a, %b
406 define <4 x i8> @var_shift_v4i8(<4 x i8> %a, <4 x i8> %b) nounwind {
407 ; SSE2-LABEL: var_shift_v4i8:
409 ; SSE2-NEXT: pand {{.*}}(%rip), %xmm1
410 ; SSE2-NEXT: pslld $23, %xmm1
411 ; SSE2-NEXT: paddd {{.*}}(%rip), %xmm1
412 ; SSE2-NEXT: cvttps2dq %xmm1, %xmm1
413 ; SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm0[1,1,3,3]
414 ; SSE2-NEXT: pmuludq %xmm1, %xmm0
415 ; SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,2,2,3]
416 ; SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
417 ; SSE2-NEXT: pmuludq %xmm2, %xmm1
418 ; SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,2,2,3]
419 ; SSE2-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
422 ; SSE41-LABEL: var_shift_v4i8:
424 ; SSE41-NEXT: pand {{.*}}(%rip), %xmm1
425 ; SSE41-NEXT: pslld $23, %xmm1
426 ; SSE41-NEXT: paddd {{.*}}(%rip), %xmm1
427 ; SSE41-NEXT: cvttps2dq %xmm1, %xmm1
428 ; SSE41-NEXT: pmulld %xmm1, %xmm0
431 ; AVX1-LABEL: var_shift_v4i8:
433 ; AVX1-NEXT: vpand {{.*}}(%rip), %xmm1, %xmm1
434 ; AVX1-NEXT: vpslld $23, %xmm1, %xmm1
435 ; AVX1-NEXT: vpaddd {{.*}}(%rip), %xmm1, %xmm1
436 ; AVX1-NEXT: vcvttps2dq %xmm1, %xmm1
437 ; AVX1-NEXT: vpmulld %xmm1, %xmm0, %xmm0
440 ; AVX2-LABEL: var_shift_v4i8:
442 ; AVX2-NEXT: vpand {{.*}}(%rip), %xmm1, %xmm1
443 ; AVX2-NEXT: vpsllvd %xmm1, %xmm0, %xmm0
446 ; XOPAVX1-LABEL: var_shift_v4i8:
448 ; XOPAVX1-NEXT: vpand {{.*}}(%rip), %xmm1, %xmm1
449 ; XOPAVX1-NEXT: vpshld %xmm1, %xmm0, %xmm0
452 ; XOPAVX2-LABEL: var_shift_v4i8:
454 ; XOPAVX2-NEXT: vpand {{.*}}(%rip), %xmm1, %xmm1
455 ; XOPAVX2-NEXT: vpsllvd %xmm1, %xmm0, %xmm0
458 ; AVX512-LABEL: var_shift_v4i8:
460 ; AVX512-NEXT: vpand {{.*}}(%rip), %xmm1, %xmm1
461 ; AVX512-NEXT: vpsllvd %xmm1, %xmm0, %xmm0
464 ; AVX512VL-LABEL: var_shift_v4i8:
466 ; AVX512VL-NEXT: vpand {{.*}}(%rip), %xmm1, %xmm1
467 ; AVX512VL-NEXT: vpsllvd %xmm1, %xmm0, %xmm0
468 ; AVX512VL-NEXT: retq
470 ; X32-SSE-LABEL: var_shift_v4i8:
472 ; X32-SSE-NEXT: pand {{\.LCPI.*}}, %xmm1
473 ; X32-SSE-NEXT: pslld $23, %xmm1
474 ; X32-SSE-NEXT: paddd {{\.LCPI.*}}, %xmm1
475 ; X32-SSE-NEXT: cvttps2dq %xmm1, %xmm1
476 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm2 = xmm0[1,1,3,3]
477 ; X32-SSE-NEXT: pmuludq %xmm1, %xmm0
478 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,2,2,3]
479 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
480 ; X32-SSE-NEXT: pmuludq %xmm2, %xmm1
481 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,2,2,3]
482 ; X32-SSE-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
484 %shift = shl <4 x i8> %a, %b
488 define <2 x i8> @var_shift_v2i8(<2 x i8> %a, <2 x i8> %b) nounwind {
489 ; SSE2-LABEL: var_shift_v2i8:
491 ; SSE2-NEXT: pand {{.*}}(%rip), %xmm1
492 ; SSE2-NEXT: movdqa %xmm0, %xmm2
493 ; SSE2-NEXT: psllq %xmm1, %xmm2
494 ; SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
495 ; SSE2-NEXT: psllq %xmm1, %xmm0
496 ; SSE2-NEXT: movsd {{.*#+}} xmm0 = xmm2[0],xmm0[1]
499 ; SSE41-LABEL: var_shift_v2i8:
501 ; SSE41-NEXT: pand {{.*}}(%rip), %xmm1
502 ; SSE41-NEXT: movdqa %xmm0, %xmm2
503 ; SSE41-NEXT: psllq %xmm1, %xmm2
504 ; SSE41-NEXT: pshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
505 ; SSE41-NEXT: psllq %xmm1, %xmm0
506 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm2[0,1,2,3],xmm0[4,5,6,7]
509 ; AVX1-LABEL: var_shift_v2i8:
511 ; AVX1-NEXT: vpand {{.*}}(%rip), %xmm1, %xmm1
512 ; AVX1-NEXT: vpsllq %xmm1, %xmm0, %xmm2
513 ; AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
514 ; AVX1-NEXT: vpsllq %xmm1, %xmm0, %xmm0
515 ; AVX1-NEXT: vpblendw {{.*#+}} xmm0 = xmm2[0,1,2,3],xmm0[4,5,6,7]
518 ; AVX2-LABEL: var_shift_v2i8:
520 ; AVX2-NEXT: vpand {{.*}}(%rip), %xmm1, %xmm1
521 ; AVX2-NEXT: vpsllvq %xmm1, %xmm0, %xmm0
524 ; XOPAVX1-LABEL: var_shift_v2i8:
526 ; XOPAVX1-NEXT: vpand {{.*}}(%rip), %xmm1, %xmm1
527 ; XOPAVX1-NEXT: vpshlq %xmm1, %xmm0, %xmm0
530 ; XOPAVX2-LABEL: var_shift_v2i8:
532 ; XOPAVX2-NEXT: vpand {{.*}}(%rip), %xmm1, %xmm1
533 ; XOPAVX2-NEXT: vpsllvq %xmm1, %xmm0, %xmm0
536 ; AVX512-LABEL: var_shift_v2i8:
538 ; AVX512-NEXT: vpand {{.*}}(%rip), %xmm1, %xmm1
539 ; AVX512-NEXT: vpsllvq %xmm1, %xmm0, %xmm0
542 ; AVX512VL-LABEL: var_shift_v2i8:
544 ; AVX512VL-NEXT: vpand {{.*}}(%rip), %xmm1, %xmm1
545 ; AVX512VL-NEXT: vpsllvq %xmm1, %xmm0, %xmm0
546 ; AVX512VL-NEXT: retq
548 ; X32-SSE-LABEL: var_shift_v2i8:
550 ; X32-SSE-NEXT: pand {{\.LCPI.*}}, %xmm1
551 ; X32-SSE-NEXT: movdqa %xmm0, %xmm2
552 ; X32-SSE-NEXT: psllq %xmm1, %xmm2
553 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
554 ; X32-SSE-NEXT: psllq %xmm1, %xmm0
555 ; X32-SSE-NEXT: movsd {{.*#+}} xmm0 = xmm2[0],xmm0[1]
557 %shift = shl <2 x i8> %a, %b
562 ; Uniform Variable Shifts
565 define <2 x i32> @splatvar_shift_v2i32(<2 x i32> %a, <2 x i32> %b) nounwind {
566 ; SSE2-LABEL: splatvar_shift_v2i32:
568 ; SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,1,0,1]
569 ; SSE2-NEXT: pand {{.*}}(%rip), %xmm1
570 ; SSE2-NEXT: movdqa %xmm0, %xmm2
571 ; SSE2-NEXT: psllq %xmm1, %xmm2
572 ; SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
573 ; SSE2-NEXT: psllq %xmm1, %xmm0
574 ; SSE2-NEXT: movsd {{.*#+}} xmm0 = xmm2[0],xmm0[1]
577 ; SSE41-LABEL: splatvar_shift_v2i32:
579 ; SSE41-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,1,0,1]
580 ; SSE41-NEXT: pxor %xmm2, %xmm2
581 ; SSE41-NEXT: pblendw {{.*#+}} xmm2 = xmm1[0,1],xmm2[2,3],xmm1[4,5],xmm2[6,7]
582 ; SSE41-NEXT: movdqa %xmm0, %xmm1
583 ; SSE41-NEXT: psllq %xmm2, %xmm1
584 ; SSE41-NEXT: pshufd {{.*#+}} xmm2 = xmm2[2,3,0,1]
585 ; SSE41-NEXT: psllq %xmm2, %xmm0
586 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm1[0,1,2,3],xmm0[4,5,6,7]
589 ; AVX1-LABEL: splatvar_shift_v2i32:
591 ; AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[0,1,0,1]
592 ; AVX1-NEXT: vpxor %xmm2, %xmm2, %xmm2
593 ; AVX1-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0,1],xmm2[2,3],xmm1[4,5],xmm2[6,7]
594 ; AVX1-NEXT: vpsllq %xmm1, %xmm0, %xmm2
595 ; AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
596 ; AVX1-NEXT: vpsllq %xmm1, %xmm0, %xmm0
597 ; AVX1-NEXT: vpblendw {{.*#+}} xmm0 = xmm2[0,1,2,3],xmm0[4,5,6,7]
600 ; AVX2-LABEL: splatvar_shift_v2i32:
602 ; AVX2-NEXT: vpbroadcastq %xmm1, %xmm1
603 ; AVX2-NEXT: vpxor %xmm2, %xmm2, %xmm2
604 ; AVX2-NEXT: vpblendd {{.*#+}} xmm1 = xmm1[0],xmm2[1],xmm1[2],xmm2[3]
605 ; AVX2-NEXT: vpsllvq %xmm1, %xmm0, %xmm0
608 ; XOPAVX1-LABEL: splatvar_shift_v2i32:
610 ; XOPAVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[0,1,0,1]
611 ; XOPAVX1-NEXT: vpxor %xmm2, %xmm2, %xmm2
612 ; XOPAVX1-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0,1],xmm2[2,3],xmm1[4,5],xmm2[6,7]
613 ; XOPAVX1-NEXT: vpshlq %xmm1, %xmm0, %xmm0
616 ; XOPAVX2-LABEL: splatvar_shift_v2i32:
618 ; XOPAVX2-NEXT: vpbroadcastq %xmm1, %xmm1
619 ; XOPAVX2-NEXT: vpxor %xmm2, %xmm2, %xmm2
620 ; XOPAVX2-NEXT: vpblendd {{.*#+}} xmm1 = xmm1[0],xmm2[1],xmm1[2],xmm2[3]
621 ; XOPAVX2-NEXT: vpsllvq %xmm1, %xmm0, %xmm0
624 ; AVX512-LABEL: splatvar_shift_v2i32:
626 ; AVX512-NEXT: vpbroadcastq %xmm1, %xmm1
627 ; AVX512-NEXT: vpxor %xmm2, %xmm2, %xmm2
628 ; AVX512-NEXT: vpblendd {{.*#+}} xmm1 = xmm1[0],xmm2[1],xmm1[2],xmm2[3]
629 ; AVX512-NEXT: vpsllvq %xmm1, %xmm0, %xmm0
632 ; AVX512VL-LABEL: splatvar_shift_v2i32:
634 ; AVX512VL-NEXT: vpbroadcastq %xmm1, %xmm1
635 ; AVX512VL-NEXT: vpxor %xmm2, %xmm2, %xmm2
636 ; AVX512VL-NEXT: vpblendd {{.*#+}} xmm1 = xmm1[0],xmm2[1],xmm1[2],xmm2[3]
637 ; AVX512VL-NEXT: vpsllvq %xmm1, %xmm0, %xmm0
638 ; AVX512VL-NEXT: retq
640 ; X32-SSE-LABEL: splatvar_shift_v2i32:
642 ; X32-SSE-NEXT: movdqa {{.*#+}} xmm2 = [4294967295,0,4294967295,0]
643 ; X32-SSE-NEXT: pand %xmm1, %xmm2
644 ; X32-SSE-NEXT: movdqa %xmm0, %xmm3
645 ; X32-SSE-NEXT: psllq %xmm2, %xmm3
646 ; X32-SSE-NEXT: pxor %xmm2, %xmm2
647 ; X32-SSE-NEXT: movss {{.*#+}} xmm2 = xmm1[0],xmm2[1,2,3]
648 ; X32-SSE-NEXT: psllq %xmm2, %xmm0
649 ; X32-SSE-NEXT: movsd {{.*#+}} xmm0 = xmm3[0],xmm0[1]
651 %splat = shufflevector <2 x i32> %b, <2 x i32> undef, <2 x i32> zeroinitializer
652 %shift = shl <2 x i32> %a, %splat
656 define <4 x i16> @splatvar_shift_v4i16(<4 x i16> %a, <4 x i16> %b) nounwind {
657 ; SSE2-LABEL: splatvar_shift_v4i16:
659 ; SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,0,0,0]
660 ; SSE2-NEXT: pslld $23, %xmm1
661 ; SSE2-NEXT: paddd {{.*}}(%rip), %xmm1
662 ; SSE2-NEXT: cvttps2dq %xmm1, %xmm1
663 ; SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm0[1,1,3,3]
664 ; SSE2-NEXT: pmuludq %xmm1, %xmm0
665 ; SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,2,2,3]
666 ; SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
667 ; SSE2-NEXT: pmuludq %xmm2, %xmm1
668 ; SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,2,2,3]
669 ; SSE2-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
672 ; SSE41-LABEL: splatvar_shift_v4i16:
674 ; SSE41-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,0,0,0]
675 ; SSE41-NEXT: pslld $23, %xmm1
676 ; SSE41-NEXT: paddd {{.*}}(%rip), %xmm1
677 ; SSE41-NEXT: cvttps2dq %xmm1, %xmm1
678 ; SSE41-NEXT: pmulld %xmm1, %xmm0
681 ; AVX1-LABEL: splatvar_shift_v4i16:
683 ; AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[0,0,0,0]
684 ; AVX1-NEXT: vpslld $23, %xmm1, %xmm1
685 ; AVX1-NEXT: vpaddd {{.*}}(%rip), %xmm1, %xmm1
686 ; AVX1-NEXT: vcvttps2dq %xmm1, %xmm1
687 ; AVX1-NEXT: vpmulld %xmm1, %xmm0, %xmm0
690 ; AVX2-LABEL: splatvar_shift_v4i16:
692 ; AVX2-NEXT: vpbroadcastd %xmm1, %xmm1
693 ; AVX2-NEXT: vpxor %xmm2, %xmm2, %xmm2
694 ; AVX2-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0],xmm2[1],xmm1[2],xmm2[3],xmm1[4],xmm2[5],xmm1[6],xmm2[7]
695 ; AVX2-NEXT: vpsllvd %xmm1, %xmm0, %xmm0
698 ; XOPAVX1-LABEL: splatvar_shift_v4i16:
700 ; XOPAVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[0,0,0,0]
701 ; XOPAVX1-NEXT: vpxor %xmm2, %xmm2, %xmm2
702 ; XOPAVX1-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0],xmm2[1],xmm1[2],xmm2[3],xmm1[4],xmm2[5],xmm1[6],xmm2[7]
703 ; XOPAVX1-NEXT: vpshld %xmm1, %xmm0, %xmm0
706 ; XOPAVX2-LABEL: splatvar_shift_v4i16:
708 ; XOPAVX2-NEXT: vpbroadcastd %xmm1, %xmm1
709 ; XOPAVX2-NEXT: vpxor %xmm2, %xmm2, %xmm2
710 ; XOPAVX2-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0],xmm2[1],xmm1[2],xmm2[3],xmm1[4],xmm2[5],xmm1[6],xmm2[7]
711 ; XOPAVX2-NEXT: vpsllvd %xmm1, %xmm0, %xmm0
714 ; AVX512-LABEL: splatvar_shift_v4i16:
716 ; AVX512-NEXT: vpbroadcastd %xmm1, %xmm1
717 ; AVX512-NEXT: vpxor %xmm2, %xmm2, %xmm2
718 ; AVX512-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0],xmm2[1],xmm1[2],xmm2[3],xmm1[4],xmm2[5],xmm1[6],xmm2[7]
719 ; AVX512-NEXT: vpsllvd %xmm1, %xmm0, %xmm0
722 ; AVX512VL-LABEL: splatvar_shift_v4i16:
724 ; AVX512VL-NEXT: vpbroadcastd %xmm1, %xmm1
725 ; AVX512VL-NEXT: vpxor %xmm2, %xmm2, %xmm2
726 ; AVX512VL-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0],xmm2[1],xmm1[2],xmm2[3],xmm1[4],xmm2[5],xmm1[6],xmm2[7]
727 ; AVX512VL-NEXT: vpsllvd %xmm1, %xmm0, %xmm0
728 ; AVX512VL-NEXT: retq
730 ; X32-SSE-LABEL: splatvar_shift_v4i16:
732 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,0,0,0]
733 ; X32-SSE-NEXT: pslld $23, %xmm1
734 ; X32-SSE-NEXT: paddd {{\.LCPI.*}}, %xmm1
735 ; X32-SSE-NEXT: cvttps2dq %xmm1, %xmm1
736 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm2 = xmm0[1,1,3,3]
737 ; X32-SSE-NEXT: pmuludq %xmm1, %xmm0
738 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,2,2,3]
739 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
740 ; X32-SSE-NEXT: pmuludq %xmm2, %xmm1
741 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,2,2,3]
742 ; X32-SSE-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
744 %splat = shufflevector <4 x i16> %b, <4 x i16> undef, <4 x i32> zeroinitializer
745 %shift = shl <4 x i16> %a, %splat
749 define <2 x i16> @splatvar_shift_v2i16(<2 x i16> %a, <2 x i16> %b) nounwind {
750 ; SSE2-LABEL: splatvar_shift_v2i16:
752 ; SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,1,0,1]
753 ; SSE2-NEXT: pand {{.*}}(%rip), %xmm1
754 ; SSE2-NEXT: movdqa %xmm0, %xmm2
755 ; SSE2-NEXT: psllq %xmm1, %xmm2
756 ; SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
757 ; SSE2-NEXT: psllq %xmm1, %xmm0
758 ; SSE2-NEXT: movsd {{.*#+}} xmm0 = xmm2[0],xmm0[1]
761 ; SSE41-LABEL: splatvar_shift_v2i16:
763 ; SSE41-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,1,0,1]
764 ; SSE41-NEXT: pxor %xmm2, %xmm2
765 ; SSE41-NEXT: pblendw {{.*#+}} xmm2 = xmm1[0],xmm2[1,2,3],xmm1[4],xmm2[5,6,7]
766 ; SSE41-NEXT: movdqa %xmm0, %xmm1
767 ; SSE41-NEXT: psllq %xmm2, %xmm1
768 ; SSE41-NEXT: pshufd {{.*#+}} xmm2 = xmm2[2,3,0,1]
769 ; SSE41-NEXT: psllq %xmm2, %xmm0
770 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm1[0,1,2,3],xmm0[4,5,6,7]
773 ; AVX1-LABEL: splatvar_shift_v2i16:
775 ; AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[0,1,0,1]
776 ; AVX1-NEXT: vpxor %xmm2, %xmm2, %xmm2
777 ; AVX1-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0],xmm2[1,2,3],xmm1[4],xmm2[5,6,7]
778 ; AVX1-NEXT: vpsllq %xmm1, %xmm0, %xmm2
779 ; AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
780 ; AVX1-NEXT: vpsllq %xmm1, %xmm0, %xmm0
781 ; AVX1-NEXT: vpblendw {{.*#+}} xmm0 = xmm2[0,1,2,3],xmm0[4,5,6,7]
784 ; AVX2-LABEL: splatvar_shift_v2i16:
786 ; AVX2-NEXT: vpbroadcastq %xmm1, %xmm1
787 ; AVX2-NEXT: vpxor %xmm2, %xmm2, %xmm2
788 ; AVX2-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0],xmm2[1,2,3],xmm1[4],xmm2[5,6,7]
789 ; AVX2-NEXT: vpsllvq %xmm1, %xmm0, %xmm0
792 ; XOPAVX1-LABEL: splatvar_shift_v2i16:
794 ; XOPAVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[0,1,0,1]
795 ; XOPAVX1-NEXT: vpxor %xmm2, %xmm2, %xmm2
796 ; XOPAVX1-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0],xmm2[1,2,3],xmm1[4],xmm2[5,6,7]
797 ; XOPAVX1-NEXT: vpshlq %xmm1, %xmm0, %xmm0
800 ; XOPAVX2-LABEL: splatvar_shift_v2i16:
802 ; XOPAVX2-NEXT: vpbroadcastq %xmm1, %xmm1
803 ; XOPAVX2-NEXT: vpxor %xmm2, %xmm2, %xmm2
804 ; XOPAVX2-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0],xmm2[1,2,3],xmm1[4],xmm2[5,6,7]
805 ; XOPAVX2-NEXT: vpsllvq %xmm1, %xmm0, %xmm0
808 ; AVX512-LABEL: splatvar_shift_v2i16:
810 ; AVX512-NEXT: vpbroadcastq %xmm1, %xmm1
811 ; AVX512-NEXT: vpxor %xmm2, %xmm2, %xmm2
812 ; AVX512-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0],xmm2[1,2,3],xmm1[4],xmm2[5,6,7]
813 ; AVX512-NEXT: vpsllvq %xmm1, %xmm0, %xmm0
816 ; AVX512VL-LABEL: splatvar_shift_v2i16:
818 ; AVX512VL-NEXT: vpbroadcastq %xmm1, %xmm1
819 ; AVX512VL-NEXT: vpxor %xmm2, %xmm2, %xmm2
820 ; AVX512VL-NEXT: vpblendw {{.*#+}} xmm1 = xmm1[0],xmm2[1,2,3],xmm1[4],xmm2[5,6,7]
821 ; AVX512VL-NEXT: vpsllvq %xmm1, %xmm0, %xmm0
822 ; AVX512VL-NEXT: retq
824 ; X32-SSE-LABEL: splatvar_shift_v2i16:
826 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,1,0,1]
827 ; X32-SSE-NEXT: pand {{\.LCPI.*}}, %xmm1
828 ; X32-SSE-NEXT: movdqa %xmm0, %xmm2
829 ; X32-SSE-NEXT: psllq %xmm1, %xmm2
830 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
831 ; X32-SSE-NEXT: psllq %xmm1, %xmm0
832 ; X32-SSE-NEXT: movsd {{.*#+}} xmm0 = xmm2[0],xmm0[1]
834 %splat = shufflevector <2 x i16> %b, <2 x i16> undef, <2 x i32> zeroinitializer
835 %shift = shl <2 x i16> %a, %splat
839 define <8 x i8> @splatvar_shift_v8i8(<8 x i8> %a, <8 x i8> %b) nounwind {
840 ; SSE2-LABEL: splatvar_shift_v8i8:
842 ; SSE2-NEXT: pshuflw {{.*#+}} xmm1 = xmm1[0,0,2,3,4,5,6,7]
843 ; SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,0,0,0]
844 ; SSE2-NEXT: pand {{.*}}(%rip), %xmm1
845 ; SSE2-NEXT: pxor %xmm2, %xmm2
846 ; SSE2-NEXT: movdqa %xmm1, %xmm3
847 ; SSE2-NEXT: punpckhwd {{.*#+}} xmm3 = xmm3[4],xmm2[4],xmm3[5],xmm2[5],xmm3[6],xmm2[6],xmm3[7],xmm2[7]
848 ; SSE2-NEXT: pslld $23, %xmm3
849 ; SSE2-NEXT: movdqa {{.*#+}} xmm4 = [1065353216,1065353216,1065353216,1065353216]
850 ; SSE2-NEXT: paddd %xmm4, %xmm3
851 ; SSE2-NEXT: cvttps2dq %xmm3, %xmm3
852 ; SSE2-NEXT: pshuflw {{.*#+}} xmm3 = xmm3[0,2,2,3,4,5,6,7]
853 ; SSE2-NEXT: pshufhw {{.*#+}} xmm3 = xmm3[0,1,2,3,4,6,6,7]
854 ; SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm3[0,2,2,3]
855 ; SSE2-NEXT: punpcklwd {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3]
856 ; SSE2-NEXT: pslld $23, %xmm1
857 ; SSE2-NEXT: paddd %xmm4, %xmm1
858 ; SSE2-NEXT: cvttps2dq %xmm1, %xmm1
859 ; SSE2-NEXT: pshuflw {{.*#+}} xmm1 = xmm1[0,2,2,3,4,5,6,7]
860 ; SSE2-NEXT: pshufhw {{.*#+}} xmm1 = xmm1[0,1,2,3,4,6,6,7]
861 ; SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,2,2,3]
862 ; SSE2-NEXT: punpcklqdq {{.*#+}} xmm1 = xmm1[0],xmm3[0]
863 ; SSE2-NEXT: pmullw %xmm1, %xmm0
866 ; SSE41-LABEL: splatvar_shift_v8i8:
868 ; SSE41-NEXT: pshufb {{.*#+}} xmm1 = xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero
869 ; SSE41-NEXT: pmovzxwd {{.*#+}} xmm2 = xmm1[0],zero,xmm1[1],zero,xmm1[2],zero,xmm1[3],zero
870 ; SSE41-NEXT: punpckhwd {{.*#+}} xmm1 = xmm1[4],xmm0[4],xmm1[5],xmm0[5],xmm1[6],xmm0[6],xmm1[7],xmm0[7]
871 ; SSE41-NEXT: pslld $23, %xmm1
872 ; SSE41-NEXT: movdqa {{.*#+}} xmm3 = [1065353216,1065353216,1065353216,1065353216]
873 ; SSE41-NEXT: paddd %xmm3, %xmm1
874 ; SSE41-NEXT: cvttps2dq %xmm1, %xmm1
875 ; SSE41-NEXT: pslld $23, %xmm2
876 ; SSE41-NEXT: paddd %xmm3, %xmm2
877 ; SSE41-NEXT: cvttps2dq %xmm2, %xmm2
878 ; SSE41-NEXT: packusdw %xmm1, %xmm2
879 ; SSE41-NEXT: pmullw %xmm2, %xmm0
882 ; AVX1-LABEL: splatvar_shift_v8i8:
884 ; AVX1-NEXT: vpshufb {{.*#+}} xmm1 = xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero
885 ; AVX1-NEXT: vpunpckhwd {{.*#+}} xmm2 = xmm1[4],xmm0[4],xmm1[5],xmm0[5],xmm1[6],xmm0[6],xmm1[7],xmm0[7]
886 ; AVX1-NEXT: vpslld $23, %xmm2, %xmm2
887 ; AVX1-NEXT: vmovdqa {{.*#+}} xmm3 = [1065353216,1065353216,1065353216,1065353216]
888 ; AVX1-NEXT: vpaddd %xmm3, %xmm2, %xmm2
889 ; AVX1-NEXT: vcvttps2dq %xmm2, %xmm2
890 ; AVX1-NEXT: vpmovzxwd {{.*#+}} xmm1 = xmm1[0],zero,xmm1[1],zero,xmm1[2],zero,xmm1[3],zero
891 ; AVX1-NEXT: vpslld $23, %xmm1, %xmm1
892 ; AVX1-NEXT: vpaddd %xmm3, %xmm1, %xmm1
893 ; AVX1-NEXT: vcvttps2dq %xmm1, %xmm1
894 ; AVX1-NEXT: vpackusdw %xmm2, %xmm1, %xmm1
895 ; AVX1-NEXT: vpmullw %xmm1, %xmm0, %xmm0
898 ; AVX2-LABEL: splatvar_shift_v8i8:
900 ; AVX2-NEXT: vpshufb {{.*#+}} xmm1 = xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero
901 ; AVX2-NEXT: vpmovzxwd {{.*#+}} ymm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero
902 ; AVX2-NEXT: vpmovzxwd {{.*#+}} ymm1 = xmm1[0],zero,xmm1[1],zero,xmm1[2],zero,xmm1[3],zero,xmm1[4],zero,xmm1[5],zero,xmm1[6],zero,xmm1[7],zero
903 ; AVX2-NEXT: vpsllvd %ymm1, %ymm0, %ymm0
904 ; AVX2-NEXT: vpshufb {{.*#+}} ymm0 = ymm0[0,1,4,5,8,9,12,13,8,9,12,13,12,13,14,15,16,17,20,21,24,25,28,29,24,25,28,29,28,29,30,31]
905 ; AVX2-NEXT: vpermq {{.*#+}} ymm0 = ymm0[0,2,2,3]
906 ; AVX2-NEXT: # kill: def $xmm0 killed $xmm0 killed $ymm0
907 ; AVX2-NEXT: vzeroupper
910 ; XOP-LABEL: splatvar_shift_v8i8:
912 ; XOP-NEXT: vpshufb {{.*#+}} xmm1 = xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero
913 ; XOP-NEXT: vpshlw %xmm1, %xmm0, %xmm0
916 ; AVX512DQ-LABEL: splatvar_shift_v8i8:
918 ; AVX512DQ-NEXT: vpshufb {{.*#+}} xmm1 = xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero
919 ; AVX512DQ-NEXT: vpmovzxwd {{.*#+}} ymm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero
920 ; AVX512DQ-NEXT: vpmovzxwd {{.*#+}} ymm1 = xmm1[0],zero,xmm1[1],zero,xmm1[2],zero,xmm1[3],zero,xmm1[4],zero,xmm1[5],zero,xmm1[6],zero,xmm1[7],zero
921 ; AVX512DQ-NEXT: vpsllvd %ymm1, %ymm0, %ymm0
922 ; AVX512DQ-NEXT: vpmovdw %zmm0, %ymm0
923 ; AVX512DQ-NEXT: # kill: def $xmm0 killed $xmm0 killed $ymm0
924 ; AVX512DQ-NEXT: vzeroupper
925 ; AVX512DQ-NEXT: retq
927 ; AVX512BW-LABEL: splatvar_shift_v8i8:
929 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
930 ; AVX512BW-NEXT: vpshufb {{.*#+}} xmm1 = xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero
931 ; AVX512BW-NEXT: vpsllvw %zmm1, %zmm0, %zmm0
932 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 killed $zmm0
933 ; AVX512BW-NEXT: vzeroupper
934 ; AVX512BW-NEXT: retq
936 ; AVX512DQVL-LABEL: splatvar_shift_v8i8:
937 ; AVX512DQVL: # %bb.0:
938 ; AVX512DQVL-NEXT: vpshufb {{.*#+}} xmm1 = xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero
939 ; AVX512DQVL-NEXT: vpmovzxwd {{.*#+}} ymm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero
940 ; AVX512DQVL-NEXT: vpmovzxwd {{.*#+}} ymm1 = xmm1[0],zero,xmm1[1],zero,xmm1[2],zero,xmm1[3],zero,xmm1[4],zero,xmm1[5],zero,xmm1[6],zero,xmm1[7],zero
941 ; AVX512DQVL-NEXT: vpsllvd %ymm1, %ymm0, %ymm0
942 ; AVX512DQVL-NEXT: vpmovdw %ymm0, %xmm0
943 ; AVX512DQVL-NEXT: vzeroupper
944 ; AVX512DQVL-NEXT: retq
946 ; AVX512BWVL-LABEL: splatvar_shift_v8i8:
947 ; AVX512BWVL: # %bb.0:
948 ; AVX512BWVL-NEXT: vpshufb {{.*#+}} xmm1 = xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero,xmm1[0],zero
949 ; AVX512BWVL-NEXT: vpsllvw %xmm1, %xmm0, %xmm0
950 ; AVX512BWVL-NEXT: retq
952 ; X32-SSE-LABEL: splatvar_shift_v8i8:
954 ; X32-SSE-NEXT: pshuflw {{.*#+}} xmm1 = xmm1[0,0,2,3,4,5,6,7]
955 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,0,0,0]
956 ; X32-SSE-NEXT: pand {{\.LCPI.*}}, %xmm1
957 ; X32-SSE-NEXT: pxor %xmm2, %xmm2
958 ; X32-SSE-NEXT: movdqa %xmm1, %xmm3
959 ; X32-SSE-NEXT: punpckhwd {{.*#+}} xmm3 = xmm3[4],xmm2[4],xmm3[5],xmm2[5],xmm3[6],xmm2[6],xmm3[7],xmm2[7]
960 ; X32-SSE-NEXT: pslld $23, %xmm3
961 ; X32-SSE-NEXT: movdqa {{.*#+}} xmm4 = [1065353216,1065353216,1065353216,1065353216]
962 ; X32-SSE-NEXT: paddd %xmm4, %xmm3
963 ; X32-SSE-NEXT: cvttps2dq %xmm3, %xmm3
964 ; X32-SSE-NEXT: pshuflw {{.*#+}} xmm3 = xmm3[0,2,2,3,4,5,6,7]
965 ; X32-SSE-NEXT: pshufhw {{.*#+}} xmm3 = xmm3[0,1,2,3,4,6,6,7]
966 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm3 = xmm3[0,2,2,3]
967 ; X32-SSE-NEXT: punpcklwd {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3]
968 ; X32-SSE-NEXT: pslld $23, %xmm1
969 ; X32-SSE-NEXT: paddd %xmm4, %xmm1
970 ; X32-SSE-NEXT: cvttps2dq %xmm1, %xmm1
971 ; X32-SSE-NEXT: pshuflw {{.*#+}} xmm1 = xmm1[0,2,2,3,4,5,6,7]
972 ; X32-SSE-NEXT: pshufhw {{.*#+}} xmm1 = xmm1[0,1,2,3,4,6,6,7]
973 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,2,2,3]
974 ; X32-SSE-NEXT: punpcklqdq {{.*#+}} xmm1 = xmm1[0],xmm3[0]
975 ; X32-SSE-NEXT: pmullw %xmm1, %xmm0
977 %splat = shufflevector <8 x i8> %b, <8 x i8> undef, <8 x i32> zeroinitializer
978 %shift = shl <8 x i8> %a, %splat
982 define <4 x i8> @splatvar_shift_v4i8(<4 x i8> %a, <4 x i8> %b) nounwind {
983 ; SSE2-LABEL: splatvar_shift_v4i8:
985 ; SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,0,0,0]
986 ; SSE2-NEXT: pand {{.*}}(%rip), %xmm1
987 ; SSE2-NEXT: pslld $23, %xmm1
988 ; SSE2-NEXT: paddd {{.*}}(%rip), %xmm1
989 ; SSE2-NEXT: cvttps2dq %xmm1, %xmm1
990 ; SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm0[1,1,3,3]
991 ; SSE2-NEXT: pmuludq %xmm1, %xmm0
992 ; SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,2,2,3]
993 ; SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
994 ; SSE2-NEXT: pmuludq %xmm2, %xmm1
995 ; SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,2,2,3]
996 ; SSE2-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
999 ; SSE41-LABEL: splatvar_shift_v4i8:
1001 ; SSE41-NEXT: pshufb {{.*#+}} xmm1 = xmm1[0],zero,zero,zero,xmm1[0],zero,zero,zero,xmm1[0],zero,zero,zero,xmm1[0],zero,zero,zero
1002 ; SSE41-NEXT: pslld $23, %xmm1
1003 ; SSE41-NEXT: paddd {{.*}}(%rip), %xmm1
1004 ; SSE41-NEXT: cvttps2dq %xmm1, %xmm1
1005 ; SSE41-NEXT: pmulld %xmm1, %xmm0
1008 ; AVX1-LABEL: splatvar_shift_v4i8:
1010 ; AVX1-NEXT: vpshufb {{.*#+}} xmm1 = xmm1[0],zero,zero,zero,xmm1[0],zero,zero,zero,xmm1[0],zero,zero,zero,xmm1[0],zero,zero,zero
1011 ; AVX1-NEXT: vpslld $23, %xmm1, %xmm1
1012 ; AVX1-NEXT: vpaddd {{.*}}(%rip), %xmm1, %xmm1
1013 ; AVX1-NEXT: vcvttps2dq %xmm1, %xmm1
1014 ; AVX1-NEXT: vpmulld %xmm1, %xmm0, %xmm0
1017 ; AVX2-LABEL: splatvar_shift_v4i8:
1019 ; AVX2-NEXT: vpshufb {{.*#+}} xmm1 = xmm1[0],zero,zero,zero,xmm1[0],zero,zero,zero,xmm1[0],zero,zero,zero,xmm1[0],zero,zero,zero
1020 ; AVX2-NEXT: vpsllvd %xmm1, %xmm0, %xmm0
1023 ; XOPAVX1-LABEL: splatvar_shift_v4i8:
1025 ; XOPAVX1-NEXT: vpshufb {{.*#+}} xmm1 = xmm1[0],zero,zero,zero,xmm1[0],zero,zero,zero,xmm1[0],zero,zero,zero,xmm1[0],zero,zero,zero
1026 ; XOPAVX1-NEXT: vpshld %xmm1, %xmm0, %xmm0
1027 ; XOPAVX1-NEXT: retq
1029 ; XOPAVX2-LABEL: splatvar_shift_v4i8:
1031 ; XOPAVX2-NEXT: vpshufb {{.*#+}} xmm1 = xmm1[0],zero,zero,zero,xmm1[0],zero,zero,zero,xmm1[0],zero,zero,zero,xmm1[0],zero,zero,zero
1032 ; XOPAVX2-NEXT: vpsllvd %xmm1, %xmm0, %xmm0
1033 ; XOPAVX2-NEXT: retq
1035 ; AVX512-LABEL: splatvar_shift_v4i8:
1037 ; AVX512-NEXT: vpshufb {{.*#+}} xmm1 = xmm1[0],zero,zero,zero,xmm1[0],zero,zero,zero,xmm1[0],zero,zero,zero,xmm1[0],zero,zero,zero
1038 ; AVX512-NEXT: vpsllvd %xmm1, %xmm0, %xmm0
1041 ; AVX512VL-LABEL: splatvar_shift_v4i8:
1042 ; AVX512VL: # %bb.0:
1043 ; AVX512VL-NEXT: vpshufb {{.*#+}} xmm1 = xmm1[0],zero,zero,zero,xmm1[0],zero,zero,zero,xmm1[0],zero,zero,zero,xmm1[0],zero,zero,zero
1044 ; AVX512VL-NEXT: vpsllvd %xmm1, %xmm0, %xmm0
1045 ; AVX512VL-NEXT: retq
1047 ; X32-SSE-LABEL: splatvar_shift_v4i8:
1049 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,0,0,0]
1050 ; X32-SSE-NEXT: pand {{\.LCPI.*}}, %xmm1
1051 ; X32-SSE-NEXT: pslld $23, %xmm1
1052 ; X32-SSE-NEXT: paddd {{\.LCPI.*}}, %xmm1
1053 ; X32-SSE-NEXT: cvttps2dq %xmm1, %xmm1
1054 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm2 = xmm0[1,1,3,3]
1055 ; X32-SSE-NEXT: pmuludq %xmm1, %xmm0
1056 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,2,2,3]
1057 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
1058 ; X32-SSE-NEXT: pmuludq %xmm2, %xmm1
1059 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,2,2,3]
1060 ; X32-SSE-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
1061 ; X32-SSE-NEXT: retl
1062 %splat = shufflevector <4 x i8> %b, <4 x i8> undef, <4 x i32> zeroinitializer
1063 %shift = shl <4 x i8> %a, %splat
1067 define <2 x i8> @splatvar_shift_v2i8(<2 x i8> %a, <2 x i8> %b) nounwind {
1068 ; SSE2-LABEL: splatvar_shift_v2i8:
1070 ; SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,1,0,1]
1071 ; SSE2-NEXT: pand {{.*}}(%rip), %xmm1
1072 ; SSE2-NEXT: movdqa %xmm0, %xmm2
1073 ; SSE2-NEXT: psllq %xmm1, %xmm2
1074 ; SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
1075 ; SSE2-NEXT: psllq %xmm1, %xmm0
1076 ; SSE2-NEXT: movsd {{.*#+}} xmm0 = xmm2[0],xmm0[1]
1079 ; SSE41-LABEL: splatvar_shift_v2i8:
1081 ; SSE41-NEXT: pshufb {{.*#+}} xmm1 = xmm1[0],zero,zero,zero,zero,zero,zero,zero,xmm1[0],zero,zero,zero,zero,zero,zero,zero
1082 ; SSE41-NEXT: movdqa %xmm0, %xmm2
1083 ; SSE41-NEXT: psllq %xmm1, %xmm2
1084 ; SSE41-NEXT: pshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
1085 ; SSE41-NEXT: psllq %xmm1, %xmm0
1086 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm2[0,1,2,3],xmm0[4,5,6,7]
1089 ; AVX1-LABEL: splatvar_shift_v2i8:
1091 ; AVX1-NEXT: vpshufb {{.*#+}} xmm1 = xmm1[0],zero,zero,zero,zero,zero,zero,zero,xmm1[0],zero,zero,zero,zero,zero,zero,zero
1092 ; AVX1-NEXT: vpsllq %xmm1, %xmm0, %xmm2
1093 ; AVX1-NEXT: vpshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
1094 ; AVX1-NEXT: vpsllq %xmm1, %xmm0, %xmm0
1095 ; AVX1-NEXT: vpblendw {{.*#+}} xmm0 = xmm2[0,1,2,3],xmm0[4,5,6,7]
1098 ; AVX2-LABEL: splatvar_shift_v2i8:
1100 ; AVX2-NEXT: vpshufb {{.*#+}} xmm1 = xmm1[0],zero,zero,zero,zero,zero,zero,zero,xmm1[0],zero,zero,zero,zero,zero,zero,zero
1101 ; AVX2-NEXT: vpsllvq %xmm1, %xmm0, %xmm0
1104 ; XOPAVX1-LABEL: splatvar_shift_v2i8:
1106 ; XOPAVX1-NEXT: vpshufb {{.*#+}} xmm1 = xmm1[0],zero,zero,zero,zero,zero,zero,zero,xmm1[0],zero,zero,zero,zero,zero,zero,zero
1107 ; XOPAVX1-NEXT: vpshlq %xmm1, %xmm0, %xmm0
1108 ; XOPAVX1-NEXT: retq
1110 ; XOPAVX2-LABEL: splatvar_shift_v2i8:
1112 ; XOPAVX2-NEXT: vpshufb {{.*#+}} xmm1 = xmm1[0],zero,zero,zero,zero,zero,zero,zero,xmm1[0],zero,zero,zero,zero,zero,zero,zero
1113 ; XOPAVX2-NEXT: vpsllvq %xmm1, %xmm0, %xmm0
1114 ; XOPAVX2-NEXT: retq
1116 ; AVX512-LABEL: splatvar_shift_v2i8:
1118 ; AVX512-NEXT: vpshufb {{.*#+}} xmm1 = xmm1[0],zero,zero,zero,zero,zero,zero,zero,xmm1[0],zero,zero,zero,zero,zero,zero,zero
1119 ; AVX512-NEXT: vpsllvq %xmm1, %xmm0, %xmm0
1122 ; AVX512VL-LABEL: splatvar_shift_v2i8:
1123 ; AVX512VL: # %bb.0:
1124 ; AVX512VL-NEXT: vpshufb {{.*#+}} xmm1 = xmm1[0],zero,zero,zero,zero,zero,zero,zero,xmm1[0],zero,zero,zero,zero,zero,zero,zero
1125 ; AVX512VL-NEXT: vpsllvq %xmm1, %xmm0, %xmm0
1126 ; AVX512VL-NEXT: retq
1128 ; X32-SSE-LABEL: splatvar_shift_v2i8:
1130 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,1,0,1]
1131 ; X32-SSE-NEXT: pand {{\.LCPI.*}}, %xmm1
1132 ; X32-SSE-NEXT: movdqa %xmm0, %xmm2
1133 ; X32-SSE-NEXT: psllq %xmm1, %xmm2
1134 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
1135 ; X32-SSE-NEXT: psllq %xmm1, %xmm0
1136 ; X32-SSE-NEXT: movsd {{.*#+}} xmm0 = xmm2[0],xmm0[1]
1137 ; X32-SSE-NEXT: retl
1138 %splat = shufflevector <2 x i8> %b, <2 x i8> undef, <2 x i32> zeroinitializer
1139 %shift = shl <2 x i8> %a, %splat
1147 define <2 x i32> @constant_shift_v2i32(<2 x i32> %a) nounwind {
1148 ; SSE2-LABEL: constant_shift_v2i32:
1150 ; SSE2-NEXT: movdqa %xmm0, %xmm1
1151 ; SSE2-NEXT: psllq $4, %xmm1
1152 ; SSE2-NEXT: psllq $5, %xmm0
1153 ; SSE2-NEXT: movsd {{.*#+}} xmm0 = xmm1[0],xmm0[1]
1156 ; SSE41-LABEL: constant_shift_v2i32:
1158 ; SSE41-NEXT: movdqa %xmm0, %xmm1
1159 ; SSE41-NEXT: psllq $5, %xmm1
1160 ; SSE41-NEXT: psllq $4, %xmm0
1161 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm0[0,1,2,3],xmm1[4,5,6,7]
1164 ; AVX1-LABEL: constant_shift_v2i32:
1166 ; AVX1-NEXT: vpsllq $5, %xmm0, %xmm1
1167 ; AVX1-NEXT: vpsllq $4, %xmm0, %xmm0
1168 ; AVX1-NEXT: vpblendw {{.*#+}} xmm0 = xmm0[0,1,2,3],xmm1[4,5,6,7]
1171 ; AVX2-LABEL: constant_shift_v2i32:
1173 ; AVX2-NEXT: vpsllvq {{.*}}(%rip), %xmm0, %xmm0
1176 ; XOPAVX1-LABEL: constant_shift_v2i32:
1178 ; XOPAVX1-NEXT: vpshlq {{.*}}(%rip), %xmm0, %xmm0
1179 ; XOPAVX1-NEXT: retq
1181 ; XOPAVX2-LABEL: constant_shift_v2i32:
1183 ; XOPAVX2-NEXT: vpsllvq {{.*}}(%rip), %xmm0, %xmm0
1184 ; XOPAVX2-NEXT: retq
1186 ; AVX512-LABEL: constant_shift_v2i32:
1188 ; AVX512-NEXT: vpsllvq {{.*}}(%rip), %xmm0, %xmm0
1191 ; AVX512VL-LABEL: constant_shift_v2i32:
1192 ; AVX512VL: # %bb.0:
1193 ; AVX512VL-NEXT: vpsllvq {{.*}}(%rip), %xmm0, %xmm0
1194 ; AVX512VL-NEXT: retq
1196 ; X32-SSE-LABEL: constant_shift_v2i32:
1198 ; X32-SSE-NEXT: movdqa %xmm0, %xmm1
1199 ; X32-SSE-NEXT: psllq $4, %xmm1
1200 ; X32-SSE-NEXT: psllq $5, %xmm0
1201 ; X32-SSE-NEXT: movsd {{.*#+}} xmm0 = xmm1[0],xmm0[1]
1202 ; X32-SSE-NEXT: retl
1203 %shift = shl <2 x i32> %a, <i32 4, i32 5>
1204 ret <2 x i32> %shift
1207 define <4 x i16> @constant_shift_v4i16(<4 x i16> %a) nounwind {
1208 ; SSE2-LABEL: constant_shift_v4i16:
1210 ; SSE2-NEXT: movdqa {{.*#+}} xmm1 = [1,2,4,8]
1211 ; SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm0[1,1,3,3]
1212 ; SSE2-NEXT: pmuludq %xmm1, %xmm0
1213 ; SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,2,2,3]
1214 ; SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
1215 ; SSE2-NEXT: pmuludq %xmm2, %xmm1
1216 ; SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,2,2,3]
1217 ; SSE2-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
1220 ; SSE41-LABEL: constant_shift_v4i16:
1222 ; SSE41-NEXT: pmulld {{.*}}(%rip), %xmm0
1225 ; AVX1-LABEL: constant_shift_v4i16:
1227 ; AVX1-NEXT: vpmulld {{.*}}(%rip), %xmm0, %xmm0
1230 ; AVX2-LABEL: constant_shift_v4i16:
1232 ; AVX2-NEXT: vpsllvd {{.*}}(%rip), %xmm0, %xmm0
1235 ; XOPAVX1-LABEL: constant_shift_v4i16:
1237 ; XOPAVX1-NEXT: vpshld {{.*}}(%rip), %xmm0, %xmm0
1238 ; XOPAVX1-NEXT: retq
1240 ; XOPAVX2-LABEL: constant_shift_v4i16:
1242 ; XOPAVX2-NEXT: vpsllvd {{.*}}(%rip), %xmm0, %xmm0
1243 ; XOPAVX2-NEXT: retq
1245 ; AVX512-LABEL: constant_shift_v4i16:
1247 ; AVX512-NEXT: vpsllvd {{.*}}(%rip), %xmm0, %xmm0
1250 ; AVX512VL-LABEL: constant_shift_v4i16:
1251 ; AVX512VL: # %bb.0:
1252 ; AVX512VL-NEXT: vpsllvd {{.*}}(%rip), %xmm0, %xmm0
1253 ; AVX512VL-NEXT: retq
1255 ; X32-SSE-LABEL: constant_shift_v4i16:
1257 ; X32-SSE-NEXT: movdqa {{.*#+}} xmm1 = [1,2,4,8]
1258 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm2 = xmm0[1,1,3,3]
1259 ; X32-SSE-NEXT: pmuludq %xmm1, %xmm0
1260 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,2,2,3]
1261 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
1262 ; X32-SSE-NEXT: pmuludq %xmm2, %xmm1
1263 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,2,2,3]
1264 ; X32-SSE-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
1265 ; X32-SSE-NEXT: retl
1266 %shift = shl <4 x i16> %a, <i16 0, i16 1, i16 2, i16 3>
1267 ret <4 x i16> %shift
1270 define <2 x i16> @constant_shift_v2i16(<2 x i16> %a) nounwind {
1271 ; SSE2-LABEL: constant_shift_v2i16:
1273 ; SSE2-NEXT: movdqa %xmm0, %xmm1
1274 ; SSE2-NEXT: psllq $2, %xmm1
1275 ; SSE2-NEXT: psllq $3, %xmm0
1276 ; SSE2-NEXT: movsd {{.*#+}} xmm0 = xmm1[0],xmm0[1]
1279 ; SSE41-LABEL: constant_shift_v2i16:
1281 ; SSE41-NEXT: movdqa %xmm0, %xmm1
1282 ; SSE41-NEXT: psllq $3, %xmm1
1283 ; SSE41-NEXT: psllq $2, %xmm0
1284 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm0[0,1,2,3],xmm1[4,5,6,7]
1287 ; AVX1-LABEL: constant_shift_v2i16:
1289 ; AVX1-NEXT: vpsllq $3, %xmm0, %xmm1
1290 ; AVX1-NEXT: vpsllq $2, %xmm0, %xmm0
1291 ; AVX1-NEXT: vpblendw {{.*#+}} xmm0 = xmm0[0,1,2,3],xmm1[4,5,6,7]
1294 ; AVX2-LABEL: constant_shift_v2i16:
1296 ; AVX2-NEXT: vpsllvq {{.*}}(%rip), %xmm0, %xmm0
1299 ; XOPAVX1-LABEL: constant_shift_v2i16:
1301 ; XOPAVX1-NEXT: vpshlq {{.*}}(%rip), %xmm0, %xmm0
1302 ; XOPAVX1-NEXT: retq
1304 ; XOPAVX2-LABEL: constant_shift_v2i16:
1306 ; XOPAVX2-NEXT: vpsllvq {{.*}}(%rip), %xmm0, %xmm0
1307 ; XOPAVX2-NEXT: retq
1309 ; AVX512-LABEL: constant_shift_v2i16:
1311 ; AVX512-NEXT: vpsllvq {{.*}}(%rip), %xmm0, %xmm0
1314 ; AVX512VL-LABEL: constant_shift_v2i16:
1315 ; AVX512VL: # %bb.0:
1316 ; AVX512VL-NEXT: vpsllvq {{.*}}(%rip), %xmm0, %xmm0
1317 ; AVX512VL-NEXT: retq
1319 ; X32-SSE-LABEL: constant_shift_v2i16:
1321 ; X32-SSE-NEXT: movdqa %xmm0, %xmm1
1322 ; X32-SSE-NEXT: psllq {{\.LCPI.*}}, %xmm1
1323 ; X32-SSE-NEXT: psllq {{\.LCPI.*}}, %xmm0
1324 ; X32-SSE-NEXT: movsd {{.*#+}} xmm0 = xmm1[0],xmm0[1]
1325 ; X32-SSE-NEXT: retl
1326 %shift = shl <2 x i16> %a, <i16 2, i16 3>
1327 ret <2 x i16> %shift
1330 define <8 x i8> @constant_shift_v8i8(<8 x i8> %a) nounwind {
1331 ; SSE-LABEL: constant_shift_v8i8:
1333 ; SSE-NEXT: pmullw {{.*}}(%rip), %xmm0
1336 ; AVX-LABEL: constant_shift_v8i8:
1338 ; AVX-NEXT: vpmullw {{.*}}(%rip), %xmm0, %xmm0
1341 ; XOP-LABEL: constant_shift_v8i8:
1343 ; XOP-NEXT: vpshlw {{.*}}(%rip), %xmm0, %xmm0
1346 ; AVX512DQ-LABEL: constant_shift_v8i8:
1347 ; AVX512DQ: # %bb.0:
1348 ; AVX512DQ-NEXT: vpmullw {{.*}}(%rip), %xmm0, %xmm0
1349 ; AVX512DQ-NEXT: retq
1351 ; AVX512BW-LABEL: constant_shift_v8i8:
1352 ; AVX512BW: # %bb.0:
1353 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
1354 ; AVX512BW-NEXT: vmovdqa {{.*#+}} xmm1 = [0,1,2,3,4,5,6,7]
1355 ; AVX512BW-NEXT: vpsllvw %zmm1, %zmm0, %zmm0
1356 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 killed $zmm0
1357 ; AVX512BW-NEXT: vzeroupper
1358 ; AVX512BW-NEXT: retq
1360 ; AVX512DQVL-LABEL: constant_shift_v8i8:
1361 ; AVX512DQVL: # %bb.0:
1362 ; AVX512DQVL-NEXT: vpmullw {{.*}}(%rip), %xmm0, %xmm0
1363 ; AVX512DQVL-NEXT: retq
1365 ; AVX512BWVL-LABEL: constant_shift_v8i8:
1366 ; AVX512BWVL: # %bb.0:
1367 ; AVX512BWVL-NEXT: vpsllvw {{.*}}(%rip), %xmm0, %xmm0
1368 ; AVX512BWVL-NEXT: retq
1370 ; X32-SSE-LABEL: constant_shift_v8i8:
1372 ; X32-SSE-NEXT: pmullw {{\.LCPI.*}}, %xmm0
1373 ; X32-SSE-NEXT: retl
1374 %shift = shl <8 x i8> %a, <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7>
1378 define <4 x i8> @constant_shift_v4i8(<4 x i8> %a) nounwind {
1379 ; SSE2-LABEL: constant_shift_v4i8:
1381 ; SSE2-NEXT: movdqa {{.*#+}} xmm1 = [1,2,4,8]
1382 ; SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm0[1,1,3,3]
1383 ; SSE2-NEXT: pmuludq %xmm1, %xmm0
1384 ; SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,2,2,3]
1385 ; SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
1386 ; SSE2-NEXT: pmuludq %xmm2, %xmm1
1387 ; SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,2,2,3]
1388 ; SSE2-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
1391 ; SSE41-LABEL: constant_shift_v4i8:
1393 ; SSE41-NEXT: pmulld {{.*}}(%rip), %xmm0
1396 ; AVX1-LABEL: constant_shift_v4i8:
1398 ; AVX1-NEXT: vpmulld {{.*}}(%rip), %xmm0, %xmm0
1401 ; AVX2-LABEL: constant_shift_v4i8:
1403 ; AVX2-NEXT: vpsllvd {{.*}}(%rip), %xmm0, %xmm0
1406 ; XOPAVX1-LABEL: constant_shift_v4i8:
1408 ; XOPAVX1-NEXT: vpshld {{.*}}(%rip), %xmm0, %xmm0
1409 ; XOPAVX1-NEXT: retq
1411 ; XOPAVX2-LABEL: constant_shift_v4i8:
1413 ; XOPAVX2-NEXT: vpsllvd {{.*}}(%rip), %xmm0, %xmm0
1414 ; XOPAVX2-NEXT: retq
1416 ; AVX512-LABEL: constant_shift_v4i8:
1418 ; AVX512-NEXT: vpsllvd {{.*}}(%rip), %xmm0, %xmm0
1421 ; AVX512VL-LABEL: constant_shift_v4i8:
1422 ; AVX512VL: # %bb.0:
1423 ; AVX512VL-NEXT: vpsllvd {{.*}}(%rip), %xmm0, %xmm0
1424 ; AVX512VL-NEXT: retq
1426 ; X32-SSE-LABEL: constant_shift_v4i8:
1428 ; X32-SSE-NEXT: movdqa {{.*#+}} xmm1 = [1,2,4,8]
1429 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm2 = xmm0[1,1,3,3]
1430 ; X32-SSE-NEXT: pmuludq %xmm1, %xmm0
1431 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm0 = xmm0[0,2,2,3]
1432 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm1[1,1,3,3]
1433 ; X32-SSE-NEXT: pmuludq %xmm2, %xmm1
1434 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm1[0,2,2,3]
1435 ; X32-SSE-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
1436 ; X32-SSE-NEXT: retl
1437 %shift = shl <4 x i8> %a, <i8 0, i8 1, i8 2, i8 3>
1441 define <2 x i8> @constant_shift_v2i8(<2 x i8> %a) nounwind {
1442 ; SSE2-LABEL: constant_shift_v2i8:
1444 ; SSE2-NEXT: movdqa %xmm0, %xmm1
1445 ; SSE2-NEXT: psllq $2, %xmm1
1446 ; SSE2-NEXT: psllq $3, %xmm0
1447 ; SSE2-NEXT: movsd {{.*#+}} xmm0 = xmm1[0],xmm0[1]
1450 ; SSE41-LABEL: constant_shift_v2i8:
1452 ; SSE41-NEXT: movdqa %xmm0, %xmm1
1453 ; SSE41-NEXT: psllq $3, %xmm1
1454 ; SSE41-NEXT: psllq $2, %xmm0
1455 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm0[0,1,2,3],xmm1[4,5,6,7]
1458 ; AVX1-LABEL: constant_shift_v2i8:
1460 ; AVX1-NEXT: vpsllq $3, %xmm0, %xmm1
1461 ; AVX1-NEXT: vpsllq $2, %xmm0, %xmm0
1462 ; AVX1-NEXT: vpblendw {{.*#+}} xmm0 = xmm0[0,1,2,3],xmm1[4,5,6,7]
1465 ; AVX2-LABEL: constant_shift_v2i8:
1467 ; AVX2-NEXT: vpsllvq {{.*}}(%rip), %xmm0, %xmm0
1470 ; XOPAVX1-LABEL: constant_shift_v2i8:
1472 ; XOPAVX1-NEXT: vpshlq {{.*}}(%rip), %xmm0, %xmm0
1473 ; XOPAVX1-NEXT: retq
1475 ; XOPAVX2-LABEL: constant_shift_v2i8:
1477 ; XOPAVX2-NEXT: vpsllvq {{.*}}(%rip), %xmm0, %xmm0
1478 ; XOPAVX2-NEXT: retq
1480 ; AVX512-LABEL: constant_shift_v2i8:
1482 ; AVX512-NEXT: vpsllvq {{.*}}(%rip), %xmm0, %xmm0
1485 ; AVX512VL-LABEL: constant_shift_v2i8:
1486 ; AVX512VL: # %bb.0:
1487 ; AVX512VL-NEXT: vpsllvq {{.*}}(%rip), %xmm0, %xmm0
1488 ; AVX512VL-NEXT: retq
1490 ; X32-SSE-LABEL: constant_shift_v2i8:
1492 ; X32-SSE-NEXT: movdqa {{.*#+}} xmm1 = [2,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0]
1493 ; X32-SSE-NEXT: movdqa %xmm0, %xmm2
1494 ; X32-SSE-NEXT: psllq %xmm1, %xmm2
1495 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
1496 ; X32-SSE-NEXT: psllq %xmm1, %xmm0
1497 ; X32-SSE-NEXT: movsd {{.*#+}} xmm0 = xmm2[0],xmm0[1]
1498 ; X32-SSE-NEXT: retl
1499 %shift = shl <2 x i8> %a, <i8 2, i8 3>
1504 ; Uniform Constant Shifts
1507 define <2 x i32> @splatconstant_shift_v2i32(<2 x i32> %a) nounwind {
1508 ; SSE-LABEL: splatconstant_shift_v2i32:
1510 ; SSE-NEXT: psllq $5, %xmm0
1513 ; AVX-LABEL: splatconstant_shift_v2i32:
1515 ; AVX-NEXT: vpsllq $5, %xmm0, %xmm0
1518 ; XOP-LABEL: splatconstant_shift_v2i32:
1520 ; XOP-NEXT: vpsllq $5, %xmm0, %xmm0
1523 ; AVX512-LABEL: splatconstant_shift_v2i32:
1525 ; AVX512-NEXT: vpsllq $5, %xmm0, %xmm0
1528 ; AVX512VL-LABEL: splatconstant_shift_v2i32:
1529 ; AVX512VL: # %bb.0:
1530 ; AVX512VL-NEXT: vpsllq $5, %xmm0, %xmm0
1531 ; AVX512VL-NEXT: retq
1533 ; X32-SSE-LABEL: splatconstant_shift_v2i32:
1535 ; X32-SSE-NEXT: psllq $5, %xmm0
1536 ; X32-SSE-NEXT: retl
1537 %shift = shl <2 x i32> %a, <i32 5, i32 5>
1538 ret <2 x i32> %shift
1541 define <4 x i16> @splatconstant_shift_v4i16(<4 x i16> %a) nounwind {
1542 ; SSE-LABEL: splatconstant_shift_v4i16:
1544 ; SSE-NEXT: pslld $3, %xmm0
1547 ; AVX-LABEL: splatconstant_shift_v4i16:
1549 ; AVX-NEXT: vpslld $3, %xmm0, %xmm0
1552 ; XOP-LABEL: splatconstant_shift_v4i16:
1554 ; XOP-NEXT: vpslld $3, %xmm0, %xmm0
1557 ; AVX512-LABEL: splatconstant_shift_v4i16:
1559 ; AVX512-NEXT: vpslld $3, %xmm0, %xmm0
1562 ; AVX512VL-LABEL: splatconstant_shift_v4i16:
1563 ; AVX512VL: # %bb.0:
1564 ; AVX512VL-NEXT: vpslld $3, %xmm0, %xmm0
1565 ; AVX512VL-NEXT: retq
1567 ; X32-SSE-LABEL: splatconstant_shift_v4i16:
1569 ; X32-SSE-NEXT: pslld $3, %xmm0
1570 ; X32-SSE-NEXT: retl
1571 %shift = shl <4 x i16> %a, <i16 3, i16 3, i16 3, i16 3>
1572 ret <4 x i16> %shift
1575 define <2 x i16> @splatconstant_shift_v2i16(<2 x i16> %a) nounwind {
1576 ; SSE-LABEL: splatconstant_shift_v2i16:
1578 ; SSE-NEXT: psllq $3, %xmm0
1581 ; AVX-LABEL: splatconstant_shift_v2i16:
1583 ; AVX-NEXT: vpsllq $3, %xmm0, %xmm0
1586 ; XOP-LABEL: splatconstant_shift_v2i16:
1588 ; XOP-NEXT: vpsllq $3, %xmm0, %xmm0
1591 ; AVX512-LABEL: splatconstant_shift_v2i16:
1593 ; AVX512-NEXT: vpsllq $3, %xmm0, %xmm0
1596 ; AVX512VL-LABEL: splatconstant_shift_v2i16:
1597 ; AVX512VL: # %bb.0:
1598 ; AVX512VL-NEXT: vpsllq $3, %xmm0, %xmm0
1599 ; AVX512VL-NEXT: retq
1601 ; X32-SSE-LABEL: splatconstant_shift_v2i16:
1603 ; X32-SSE-NEXT: psllq {{\.LCPI.*}}, %xmm0
1604 ; X32-SSE-NEXT: movsd {{.*#+}} xmm0 = xmm0[0,1]
1605 ; X32-SSE-NEXT: retl
1606 %shift = shl <2 x i16> %a, <i16 3, i16 3>
1607 ret <2 x i16> %shift
1610 define <8 x i8> @splatconstant_shift_v8i8(<8 x i8> %a) nounwind {
1611 ; SSE-LABEL: splatconstant_shift_v8i8:
1613 ; SSE-NEXT: psllw $3, %xmm0
1616 ; AVX-LABEL: splatconstant_shift_v8i8:
1618 ; AVX-NEXT: vpsllw $3, %xmm0, %xmm0
1621 ; XOP-LABEL: splatconstant_shift_v8i8:
1623 ; XOP-NEXT: vpsllw $3, %xmm0, %xmm0
1626 ; AVX512-LABEL: splatconstant_shift_v8i8:
1628 ; AVX512-NEXT: vpsllw $3, %xmm0, %xmm0
1631 ; AVX512VL-LABEL: splatconstant_shift_v8i8:
1632 ; AVX512VL: # %bb.0:
1633 ; AVX512VL-NEXT: vpsllw $3, %xmm0, %xmm0
1634 ; AVX512VL-NEXT: retq
1636 ; X32-SSE-LABEL: splatconstant_shift_v8i8:
1638 ; X32-SSE-NEXT: psllw $3, %xmm0
1639 ; X32-SSE-NEXT: retl
1640 %shift = shl <8 x i8> %a, <i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3>
1644 define <4 x i8> @splatconstant_shift_v4i8(<4 x i8> %a) nounwind {
1645 ; SSE-LABEL: splatconstant_shift_v4i8:
1647 ; SSE-NEXT: pslld $3, %xmm0
1650 ; AVX-LABEL: splatconstant_shift_v4i8:
1652 ; AVX-NEXT: vpslld $3, %xmm0, %xmm0
1655 ; XOP-LABEL: splatconstant_shift_v4i8:
1657 ; XOP-NEXT: vpslld $3, %xmm0, %xmm0
1660 ; AVX512-LABEL: splatconstant_shift_v4i8:
1662 ; AVX512-NEXT: vpslld $3, %xmm0, %xmm0
1665 ; AVX512VL-LABEL: splatconstant_shift_v4i8:
1666 ; AVX512VL: # %bb.0:
1667 ; AVX512VL-NEXT: vpslld $3, %xmm0, %xmm0
1668 ; AVX512VL-NEXT: retq
1670 ; X32-SSE-LABEL: splatconstant_shift_v4i8:
1672 ; X32-SSE-NEXT: pslld $3, %xmm0
1673 ; X32-SSE-NEXT: retl
1674 %shift = shl <4 x i8> %a, <i8 3, i8 3, i8 3, i8 3>
1678 define <2 x i8> @splatconstant_shift_v2i8(<2 x i8> %a) nounwind {
1679 ; SSE-LABEL: splatconstant_shift_v2i8:
1681 ; SSE-NEXT: psllq $3, %xmm0
1684 ; AVX-LABEL: splatconstant_shift_v2i8:
1686 ; AVX-NEXT: vpsllq $3, %xmm0, %xmm0
1689 ; XOP-LABEL: splatconstant_shift_v2i8:
1691 ; XOP-NEXT: vpsllq $3, %xmm0, %xmm0
1694 ; AVX512-LABEL: splatconstant_shift_v2i8:
1696 ; AVX512-NEXT: vpsllq $3, %xmm0, %xmm0
1699 ; AVX512VL-LABEL: splatconstant_shift_v2i8:
1700 ; AVX512VL: # %bb.0:
1701 ; AVX512VL-NEXT: vpsllq $3, %xmm0, %xmm0
1702 ; AVX512VL-NEXT: retq
1704 ; X32-SSE-LABEL: splatconstant_shift_v2i8:
1706 ; X32-SSE-NEXT: movdqa {{.*#+}} xmm1 = [3,0,0,0,0,0,0,0,3,0,0,0,0,0,0,0]
1707 ; X32-SSE-NEXT: movdqa %xmm0, %xmm2
1708 ; X32-SSE-NEXT: psllq %xmm1, %xmm2
1709 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
1710 ; X32-SSE-NEXT: psllq %xmm1, %xmm0
1711 ; X32-SSE-NEXT: movsd {{.*#+}} xmm0 = xmm2[0],xmm0[1]
1712 ; X32-SSE-NEXT: retl
1713 %shift = shl <2 x i8> %a, <i8 3, i8 3>