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: pshuflw {{.*#+}} xmm2 = xmm1[2,3,3,3,4,5,6,7]
24 ; SSE2-NEXT: movdqa %xmm0, %xmm3
25 ; SSE2-NEXT: psrad %xmm2, %xmm3
26 ; SSE2-NEXT: pshuflw {{.*#+}} xmm4 = xmm1[0,1,1,1,4,5,6,7]
27 ; SSE2-NEXT: movdqa %xmm0, %xmm2
28 ; SSE2-NEXT: psrad %xmm4, %xmm2
29 ; SSE2-NEXT: punpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm3[0]
30 ; SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
31 ; SSE2-NEXT: pshuflw {{.*#+}} xmm3 = xmm1[2,3,3,3,4,5,6,7]
32 ; SSE2-NEXT: movdqa %xmm0, %xmm4
33 ; SSE2-NEXT: psrad %xmm3, %xmm4
34 ; SSE2-NEXT: pshuflw {{.*#+}} xmm1 = xmm1[0,1,1,1,4,5,6,7]
35 ; SSE2-NEXT: psrad %xmm1, %xmm0
36 ; SSE2-NEXT: punpckhqdq {{.*#+}} xmm0 = xmm0[1],xmm4[1]
37 ; SSE2-NEXT: shufps {{.*#+}} xmm2 = xmm2[0,3],xmm0[0,3]
38 ; SSE2-NEXT: movaps %xmm2, %xmm0
41 ; SSE41-LABEL: var_shift_v2i32:
43 ; SSE41-NEXT: pshuflw {{.*#+}} xmm2 = xmm1[2,3,3,3,4,5,6,7]
44 ; SSE41-NEXT: movdqa %xmm0, %xmm3
45 ; SSE41-NEXT: psrad %xmm2, %xmm3
46 ; SSE41-NEXT: pshufd {{.*#+}} xmm2 = xmm1[2,3,0,1]
47 ; SSE41-NEXT: pshuflw {{.*#+}} xmm4 = xmm2[2,3,3,3,4,5,6,7]
48 ; SSE41-NEXT: movdqa %xmm0, %xmm5
49 ; SSE41-NEXT: psrad %xmm4, %xmm5
50 ; SSE41-NEXT: pblendw {{.*#+}} xmm5 = xmm3[0,1,2,3],xmm5[4,5,6,7]
51 ; SSE41-NEXT: pshuflw {{.*#+}} xmm1 = xmm1[0,1,1,1,4,5,6,7]
52 ; SSE41-NEXT: movdqa %xmm0, %xmm3
53 ; SSE41-NEXT: psrad %xmm1, %xmm3
54 ; SSE41-NEXT: pshuflw {{.*#+}} xmm1 = xmm2[0,1,1,1,4,5,6,7]
55 ; SSE41-NEXT: psrad %xmm1, %xmm0
56 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm3[0,1,2,3],xmm0[4,5,6,7]
57 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm0[0,1],xmm5[2,3],xmm0[4,5],xmm5[6,7]
60 ; AVX1-LABEL: var_shift_v2i32:
62 ; AVX1-NEXT: vpsrldq {{.*#+}} xmm2 = xmm1[12,13,14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
63 ; AVX1-NEXT: vpsrad %xmm2, %xmm0, %xmm2
64 ; AVX1-NEXT: vpsrlq $32, %xmm1, %xmm3
65 ; AVX1-NEXT: vpsrad %xmm3, %xmm0, %xmm3
66 ; AVX1-NEXT: vpblendw {{.*#+}} xmm2 = xmm3[0,1,2,3],xmm2[4,5,6,7]
67 ; AVX1-NEXT: vpxor %xmm3, %xmm3, %xmm3
68 ; AVX1-NEXT: vpunpckhdq {{.*#+}} xmm3 = xmm1[2],xmm3[2],xmm1[3],xmm3[3]
69 ; AVX1-NEXT: vpsrad %xmm3, %xmm0, %xmm3
70 ; AVX1-NEXT: vpmovzxdq {{.*#+}} xmm1 = xmm1[0],zero,xmm1[1],zero
71 ; AVX1-NEXT: vpsrad %xmm1, %xmm0, %xmm0
72 ; AVX1-NEXT: vpblendw {{.*#+}} xmm0 = xmm0[0,1,2,3],xmm3[4,5,6,7]
73 ; AVX1-NEXT: vpblendw {{.*#+}} xmm0 = xmm0[0,1],xmm2[2,3],xmm0[4,5],xmm2[6,7]
76 ; AVX2-LABEL: var_shift_v2i32:
78 ; AVX2-NEXT: vpsravd %xmm1, %xmm0, %xmm0
81 ; XOPAVX1-LABEL: var_shift_v2i32:
83 ; XOPAVX1-NEXT: vpxor %xmm2, %xmm2, %xmm2
84 ; XOPAVX1-NEXT: vpsubd %xmm1, %xmm2, %xmm1
85 ; XOPAVX1-NEXT: vpshad %xmm1, %xmm0, %xmm0
88 ; XOPAVX2-LABEL: var_shift_v2i32:
90 ; XOPAVX2-NEXT: vpsravd %xmm1, %xmm0, %xmm0
93 ; AVX512-LABEL: var_shift_v2i32:
95 ; AVX512-NEXT: vpsravd %xmm1, %xmm0, %xmm0
98 ; AVX512VL-LABEL: var_shift_v2i32:
100 ; AVX512VL-NEXT: vpsravd %xmm1, %xmm0, %xmm0
101 ; AVX512VL-NEXT: retq
103 ; X32-SSE-LABEL: var_shift_v2i32:
105 ; X32-SSE-NEXT: pshuflw {{.*#+}} xmm2 = xmm1[2,3,3,3,4,5,6,7]
106 ; X32-SSE-NEXT: movdqa %xmm0, %xmm3
107 ; X32-SSE-NEXT: psrad %xmm2, %xmm3
108 ; X32-SSE-NEXT: pshuflw {{.*#+}} xmm4 = xmm1[0,1,1,1,4,5,6,7]
109 ; X32-SSE-NEXT: movdqa %xmm0, %xmm2
110 ; X32-SSE-NEXT: psrad %xmm4, %xmm2
111 ; X32-SSE-NEXT: punpcklqdq {{.*#+}} xmm2 = xmm2[0],xmm3[0]
112 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm1 = xmm1[2,3,0,1]
113 ; X32-SSE-NEXT: pshuflw {{.*#+}} xmm3 = xmm1[2,3,3,3,4,5,6,7]
114 ; X32-SSE-NEXT: movdqa %xmm0, %xmm4
115 ; X32-SSE-NEXT: psrad %xmm3, %xmm4
116 ; X32-SSE-NEXT: pshuflw {{.*#+}} xmm1 = xmm1[0,1,1,1,4,5,6,7]
117 ; X32-SSE-NEXT: psrad %xmm1, %xmm0
118 ; X32-SSE-NEXT: punpckhqdq {{.*#+}} xmm0 = xmm0[1],xmm4[1]
119 ; X32-SSE-NEXT: shufps {{.*#+}} xmm2 = xmm2[0,3],xmm0[0,3]
120 ; X32-SSE-NEXT: movaps %xmm2, %xmm0
122 %shift = ashr <2 x i32> %a, %b
126 define <4 x i16> @var_shift_v4i16(<4 x i16> %a, <4 x i16> %b) nounwind {
127 ; SSE2-LABEL: var_shift_v4i16:
129 ; SSE2-NEXT: psllw $12, %xmm1
130 ; SSE2-NEXT: movdqa %xmm1, %xmm2
131 ; SSE2-NEXT: psraw $15, %xmm2
132 ; SSE2-NEXT: movdqa %xmm2, %xmm3
133 ; SSE2-NEXT: pandn %xmm0, %xmm3
134 ; SSE2-NEXT: psraw $8, %xmm0
135 ; SSE2-NEXT: pand %xmm2, %xmm0
136 ; SSE2-NEXT: por %xmm3, %xmm0
137 ; SSE2-NEXT: paddw %xmm1, %xmm1
138 ; SSE2-NEXT: movdqa %xmm1, %xmm2
139 ; SSE2-NEXT: psraw $15, %xmm2
140 ; SSE2-NEXT: movdqa %xmm2, %xmm3
141 ; SSE2-NEXT: pandn %xmm0, %xmm3
142 ; SSE2-NEXT: psraw $4, %xmm0
143 ; SSE2-NEXT: pand %xmm2, %xmm0
144 ; SSE2-NEXT: por %xmm3, %xmm0
145 ; SSE2-NEXT: paddw %xmm1, %xmm1
146 ; SSE2-NEXT: movdqa %xmm1, %xmm2
147 ; SSE2-NEXT: psraw $15, %xmm2
148 ; SSE2-NEXT: movdqa %xmm2, %xmm3
149 ; SSE2-NEXT: pandn %xmm0, %xmm3
150 ; SSE2-NEXT: psraw $2, %xmm0
151 ; SSE2-NEXT: pand %xmm2, %xmm0
152 ; SSE2-NEXT: por %xmm3, %xmm0
153 ; SSE2-NEXT: paddw %xmm1, %xmm1
154 ; SSE2-NEXT: psraw $15, %xmm1
155 ; SSE2-NEXT: movdqa %xmm1, %xmm2
156 ; SSE2-NEXT: pandn %xmm0, %xmm2
157 ; SSE2-NEXT: psraw $1, %xmm0
158 ; SSE2-NEXT: pand %xmm1, %xmm0
159 ; SSE2-NEXT: por %xmm2, %xmm0
162 ; SSE41-LABEL: var_shift_v4i16:
164 ; SSE41-NEXT: movdqa %xmm1, %xmm2
165 ; SSE41-NEXT: movdqa %xmm0, %xmm1
166 ; SSE41-NEXT: movdqa %xmm2, %xmm0
167 ; SSE41-NEXT: psllw $12, %xmm0
168 ; SSE41-NEXT: psllw $4, %xmm2
169 ; SSE41-NEXT: por %xmm0, %xmm2
170 ; SSE41-NEXT: movdqa %xmm2, %xmm3
171 ; SSE41-NEXT: paddw %xmm2, %xmm3
172 ; SSE41-NEXT: movdqa %xmm1, %xmm4
173 ; SSE41-NEXT: psraw $8, %xmm4
174 ; SSE41-NEXT: movdqa %xmm2, %xmm0
175 ; SSE41-NEXT: pblendvb %xmm0, %xmm4, %xmm1
176 ; SSE41-NEXT: movdqa %xmm1, %xmm2
177 ; SSE41-NEXT: psraw $4, %xmm2
178 ; SSE41-NEXT: movdqa %xmm3, %xmm0
179 ; SSE41-NEXT: pblendvb %xmm0, %xmm2, %xmm1
180 ; SSE41-NEXT: movdqa %xmm1, %xmm2
181 ; SSE41-NEXT: psraw $2, %xmm2
182 ; SSE41-NEXT: paddw %xmm3, %xmm3
183 ; SSE41-NEXT: movdqa %xmm3, %xmm0
184 ; SSE41-NEXT: pblendvb %xmm0, %xmm2, %xmm1
185 ; SSE41-NEXT: movdqa %xmm1, %xmm2
186 ; SSE41-NEXT: psraw $1, %xmm2
187 ; SSE41-NEXT: paddw %xmm3, %xmm3
188 ; SSE41-NEXT: movdqa %xmm3, %xmm0
189 ; SSE41-NEXT: pblendvb %xmm0, %xmm2, %xmm1
190 ; SSE41-NEXT: movdqa %xmm1, %xmm0
193 ; AVX1-LABEL: var_shift_v4i16:
195 ; AVX1-NEXT: vpsllw $12, %xmm1, %xmm2
196 ; AVX1-NEXT: vpsllw $4, %xmm1, %xmm1
197 ; AVX1-NEXT: vpor %xmm2, %xmm1, %xmm1
198 ; AVX1-NEXT: vpaddw %xmm1, %xmm1, %xmm2
199 ; AVX1-NEXT: vpsraw $8, %xmm0, %xmm3
200 ; AVX1-NEXT: vpblendvb %xmm1, %xmm3, %xmm0, %xmm0
201 ; AVX1-NEXT: vpsraw $4, %xmm0, %xmm1
202 ; AVX1-NEXT: vpblendvb %xmm2, %xmm1, %xmm0, %xmm0
203 ; AVX1-NEXT: vpsraw $2, %xmm0, %xmm1
204 ; AVX1-NEXT: vpaddw %xmm2, %xmm2, %xmm2
205 ; AVX1-NEXT: vpblendvb %xmm2, %xmm1, %xmm0, %xmm0
206 ; AVX1-NEXT: vpsraw $1, %xmm0, %xmm1
207 ; AVX1-NEXT: vpaddw %xmm2, %xmm2, %xmm2
208 ; AVX1-NEXT: vpblendvb %xmm2, %xmm1, %xmm0, %xmm0
211 ; AVX2-LABEL: var_shift_v4i16:
213 ; 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
214 ; AVX2-NEXT: vpmovsxwd %xmm0, %ymm0
215 ; AVX2-NEXT: vpsravd %ymm1, %ymm0, %ymm0
216 ; AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
217 ; AVX2-NEXT: vpackssdw %xmm1, %xmm0, %xmm0
218 ; AVX2-NEXT: vzeroupper
221 ; XOP-LABEL: var_shift_v4i16:
223 ; XOP-NEXT: vpxor %xmm2, %xmm2, %xmm2
224 ; XOP-NEXT: vpsubw %xmm1, %xmm2, %xmm1
225 ; XOP-NEXT: vpshaw %xmm1, %xmm0, %xmm0
228 ; AVX512DQ-LABEL: var_shift_v4i16:
230 ; 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
231 ; AVX512DQ-NEXT: vpmovsxwd %xmm0, %ymm0
232 ; AVX512DQ-NEXT: vpsravd %ymm1, %ymm0, %ymm0
233 ; AVX512DQ-NEXT: vpmovdw %zmm0, %ymm0
234 ; AVX512DQ-NEXT: # kill: def $xmm0 killed $xmm0 killed $ymm0
235 ; AVX512DQ-NEXT: vzeroupper
236 ; AVX512DQ-NEXT: retq
238 ; AVX512BW-LABEL: var_shift_v4i16:
240 ; AVX512BW-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
241 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
242 ; AVX512BW-NEXT: vpsravw %zmm1, %zmm0, %zmm0
243 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 killed $zmm0
244 ; AVX512BW-NEXT: vzeroupper
245 ; AVX512BW-NEXT: retq
247 ; AVX512DQVL-LABEL: var_shift_v4i16:
248 ; AVX512DQVL: # %bb.0:
249 ; 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
250 ; AVX512DQVL-NEXT: vpmovsxwd %xmm0, %ymm0
251 ; AVX512DQVL-NEXT: vpsravd %ymm1, %ymm0, %ymm0
252 ; AVX512DQVL-NEXT: vpmovdw %ymm0, %xmm0
253 ; AVX512DQVL-NEXT: vzeroupper
254 ; AVX512DQVL-NEXT: retq
256 ; AVX512BWVL-LABEL: var_shift_v4i16:
257 ; AVX512BWVL: # %bb.0:
258 ; AVX512BWVL-NEXT: vpsravw %xmm1, %xmm0, %xmm0
259 ; AVX512BWVL-NEXT: retq
261 ; X32-SSE-LABEL: var_shift_v4i16:
263 ; X32-SSE-NEXT: psllw $12, %xmm1
264 ; X32-SSE-NEXT: movdqa %xmm1, %xmm2
265 ; X32-SSE-NEXT: psraw $15, %xmm2
266 ; X32-SSE-NEXT: movdqa %xmm2, %xmm3
267 ; X32-SSE-NEXT: pandn %xmm0, %xmm3
268 ; X32-SSE-NEXT: psraw $8, %xmm0
269 ; X32-SSE-NEXT: pand %xmm2, %xmm0
270 ; X32-SSE-NEXT: por %xmm3, %xmm0
271 ; X32-SSE-NEXT: paddw %xmm1, %xmm1
272 ; X32-SSE-NEXT: movdqa %xmm1, %xmm2
273 ; X32-SSE-NEXT: psraw $15, %xmm2
274 ; X32-SSE-NEXT: movdqa %xmm2, %xmm3
275 ; X32-SSE-NEXT: pandn %xmm0, %xmm3
276 ; X32-SSE-NEXT: psraw $4, %xmm0
277 ; X32-SSE-NEXT: pand %xmm2, %xmm0
278 ; X32-SSE-NEXT: por %xmm3, %xmm0
279 ; X32-SSE-NEXT: paddw %xmm1, %xmm1
280 ; X32-SSE-NEXT: movdqa %xmm1, %xmm2
281 ; X32-SSE-NEXT: psraw $15, %xmm2
282 ; X32-SSE-NEXT: movdqa %xmm2, %xmm3
283 ; X32-SSE-NEXT: pandn %xmm0, %xmm3
284 ; X32-SSE-NEXT: psraw $2, %xmm0
285 ; X32-SSE-NEXT: pand %xmm2, %xmm0
286 ; X32-SSE-NEXT: por %xmm3, %xmm0
287 ; X32-SSE-NEXT: paddw %xmm1, %xmm1
288 ; X32-SSE-NEXT: psraw $15, %xmm1
289 ; X32-SSE-NEXT: movdqa %xmm1, %xmm2
290 ; X32-SSE-NEXT: pandn %xmm0, %xmm2
291 ; X32-SSE-NEXT: psraw $1, %xmm0
292 ; X32-SSE-NEXT: pand %xmm1, %xmm0
293 ; X32-SSE-NEXT: por %xmm2, %xmm0
295 %shift = ashr <4 x i16> %a, %b
299 define <2 x i16> @var_shift_v2i16(<2 x i16> %a, <2 x i16> %b) nounwind {
300 ; SSE2-LABEL: var_shift_v2i16:
302 ; SSE2-NEXT: psllw $12, %xmm1
303 ; SSE2-NEXT: movdqa %xmm1, %xmm2
304 ; SSE2-NEXT: psraw $15, %xmm2
305 ; SSE2-NEXT: movdqa %xmm2, %xmm3
306 ; SSE2-NEXT: pandn %xmm0, %xmm3
307 ; SSE2-NEXT: psraw $8, %xmm0
308 ; SSE2-NEXT: pand %xmm2, %xmm0
309 ; SSE2-NEXT: por %xmm3, %xmm0
310 ; SSE2-NEXT: paddw %xmm1, %xmm1
311 ; SSE2-NEXT: movdqa %xmm1, %xmm2
312 ; SSE2-NEXT: psraw $15, %xmm2
313 ; SSE2-NEXT: movdqa %xmm2, %xmm3
314 ; SSE2-NEXT: pandn %xmm0, %xmm3
315 ; SSE2-NEXT: psraw $4, %xmm0
316 ; SSE2-NEXT: pand %xmm2, %xmm0
317 ; SSE2-NEXT: por %xmm3, %xmm0
318 ; SSE2-NEXT: paddw %xmm1, %xmm1
319 ; SSE2-NEXT: movdqa %xmm1, %xmm2
320 ; SSE2-NEXT: psraw $15, %xmm2
321 ; SSE2-NEXT: movdqa %xmm2, %xmm3
322 ; SSE2-NEXT: pandn %xmm0, %xmm3
323 ; SSE2-NEXT: psraw $2, %xmm0
324 ; SSE2-NEXT: pand %xmm2, %xmm0
325 ; SSE2-NEXT: por %xmm3, %xmm0
326 ; SSE2-NEXT: paddw %xmm1, %xmm1
327 ; SSE2-NEXT: psraw $15, %xmm1
328 ; SSE2-NEXT: movdqa %xmm1, %xmm2
329 ; SSE2-NEXT: pandn %xmm0, %xmm2
330 ; SSE2-NEXT: psraw $1, %xmm0
331 ; SSE2-NEXT: pand %xmm1, %xmm0
332 ; SSE2-NEXT: por %xmm2, %xmm0
335 ; SSE41-LABEL: var_shift_v2i16:
337 ; SSE41-NEXT: movdqa %xmm1, %xmm2
338 ; SSE41-NEXT: movdqa %xmm0, %xmm1
339 ; SSE41-NEXT: movdqa %xmm2, %xmm0
340 ; SSE41-NEXT: psllw $12, %xmm0
341 ; SSE41-NEXT: psllw $4, %xmm2
342 ; SSE41-NEXT: por %xmm0, %xmm2
343 ; SSE41-NEXT: movdqa %xmm2, %xmm3
344 ; SSE41-NEXT: paddw %xmm2, %xmm3
345 ; SSE41-NEXT: movdqa %xmm1, %xmm4
346 ; SSE41-NEXT: psraw $8, %xmm4
347 ; SSE41-NEXT: movdqa %xmm2, %xmm0
348 ; SSE41-NEXT: pblendvb %xmm0, %xmm4, %xmm1
349 ; SSE41-NEXT: movdqa %xmm1, %xmm2
350 ; SSE41-NEXT: psraw $4, %xmm2
351 ; SSE41-NEXT: movdqa %xmm3, %xmm0
352 ; SSE41-NEXT: pblendvb %xmm0, %xmm2, %xmm1
353 ; SSE41-NEXT: movdqa %xmm1, %xmm2
354 ; SSE41-NEXT: psraw $2, %xmm2
355 ; SSE41-NEXT: paddw %xmm3, %xmm3
356 ; SSE41-NEXT: movdqa %xmm3, %xmm0
357 ; SSE41-NEXT: pblendvb %xmm0, %xmm2, %xmm1
358 ; SSE41-NEXT: movdqa %xmm1, %xmm2
359 ; SSE41-NEXT: psraw $1, %xmm2
360 ; SSE41-NEXT: paddw %xmm3, %xmm3
361 ; SSE41-NEXT: movdqa %xmm3, %xmm0
362 ; SSE41-NEXT: pblendvb %xmm0, %xmm2, %xmm1
363 ; SSE41-NEXT: movdqa %xmm1, %xmm0
366 ; AVX1-LABEL: var_shift_v2i16:
368 ; AVX1-NEXT: vpsllw $12, %xmm1, %xmm2
369 ; AVX1-NEXT: vpsllw $4, %xmm1, %xmm1
370 ; AVX1-NEXT: vpor %xmm2, %xmm1, %xmm1
371 ; AVX1-NEXT: vpaddw %xmm1, %xmm1, %xmm2
372 ; AVX1-NEXT: vpsraw $8, %xmm0, %xmm3
373 ; AVX1-NEXT: vpblendvb %xmm1, %xmm3, %xmm0, %xmm0
374 ; AVX1-NEXT: vpsraw $4, %xmm0, %xmm1
375 ; AVX1-NEXT: vpblendvb %xmm2, %xmm1, %xmm0, %xmm0
376 ; AVX1-NEXT: vpsraw $2, %xmm0, %xmm1
377 ; AVX1-NEXT: vpaddw %xmm2, %xmm2, %xmm2
378 ; AVX1-NEXT: vpblendvb %xmm2, %xmm1, %xmm0, %xmm0
379 ; AVX1-NEXT: vpsraw $1, %xmm0, %xmm1
380 ; AVX1-NEXT: vpaddw %xmm2, %xmm2, %xmm2
381 ; AVX1-NEXT: vpblendvb %xmm2, %xmm1, %xmm0, %xmm0
384 ; AVX2-LABEL: var_shift_v2i16:
386 ; 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
387 ; AVX2-NEXT: vpmovsxwd %xmm0, %ymm0
388 ; AVX2-NEXT: vpsravd %ymm1, %ymm0, %ymm0
389 ; AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
390 ; AVX2-NEXT: vpackssdw %xmm1, %xmm0, %xmm0
391 ; AVX2-NEXT: vzeroupper
394 ; XOP-LABEL: var_shift_v2i16:
396 ; XOP-NEXT: vpxor %xmm2, %xmm2, %xmm2
397 ; XOP-NEXT: vpsubw %xmm1, %xmm2, %xmm1
398 ; XOP-NEXT: vpshaw %xmm1, %xmm0, %xmm0
401 ; AVX512DQ-LABEL: var_shift_v2i16:
403 ; 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
404 ; AVX512DQ-NEXT: vpmovsxwd %xmm0, %ymm0
405 ; AVX512DQ-NEXT: vpsravd %ymm1, %ymm0, %ymm0
406 ; AVX512DQ-NEXT: vpmovdw %zmm0, %ymm0
407 ; AVX512DQ-NEXT: # kill: def $xmm0 killed $xmm0 killed $ymm0
408 ; AVX512DQ-NEXT: vzeroupper
409 ; AVX512DQ-NEXT: retq
411 ; AVX512BW-LABEL: var_shift_v2i16:
413 ; AVX512BW-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
414 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
415 ; AVX512BW-NEXT: vpsravw %zmm1, %zmm0, %zmm0
416 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 killed $zmm0
417 ; AVX512BW-NEXT: vzeroupper
418 ; AVX512BW-NEXT: retq
420 ; AVX512DQVL-LABEL: var_shift_v2i16:
421 ; AVX512DQVL: # %bb.0:
422 ; 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
423 ; AVX512DQVL-NEXT: vpmovsxwd %xmm0, %ymm0
424 ; AVX512DQVL-NEXT: vpsravd %ymm1, %ymm0, %ymm0
425 ; AVX512DQVL-NEXT: vpmovdw %ymm0, %xmm0
426 ; AVX512DQVL-NEXT: vzeroupper
427 ; AVX512DQVL-NEXT: retq
429 ; AVX512BWVL-LABEL: var_shift_v2i16:
430 ; AVX512BWVL: # %bb.0:
431 ; AVX512BWVL-NEXT: vpsravw %xmm1, %xmm0, %xmm0
432 ; AVX512BWVL-NEXT: retq
434 ; X32-SSE-LABEL: var_shift_v2i16:
436 ; X32-SSE-NEXT: psllw $12, %xmm1
437 ; X32-SSE-NEXT: movdqa %xmm1, %xmm2
438 ; X32-SSE-NEXT: psraw $15, %xmm2
439 ; X32-SSE-NEXT: movdqa %xmm2, %xmm3
440 ; X32-SSE-NEXT: pandn %xmm0, %xmm3
441 ; X32-SSE-NEXT: psraw $8, %xmm0
442 ; X32-SSE-NEXT: pand %xmm2, %xmm0
443 ; X32-SSE-NEXT: por %xmm3, %xmm0
444 ; X32-SSE-NEXT: paddw %xmm1, %xmm1
445 ; X32-SSE-NEXT: movdqa %xmm1, %xmm2
446 ; X32-SSE-NEXT: psraw $15, %xmm2
447 ; X32-SSE-NEXT: movdqa %xmm2, %xmm3
448 ; X32-SSE-NEXT: pandn %xmm0, %xmm3
449 ; X32-SSE-NEXT: psraw $4, %xmm0
450 ; X32-SSE-NEXT: pand %xmm2, %xmm0
451 ; X32-SSE-NEXT: por %xmm3, %xmm0
452 ; X32-SSE-NEXT: paddw %xmm1, %xmm1
453 ; X32-SSE-NEXT: movdqa %xmm1, %xmm2
454 ; X32-SSE-NEXT: psraw $15, %xmm2
455 ; X32-SSE-NEXT: movdqa %xmm2, %xmm3
456 ; X32-SSE-NEXT: pandn %xmm0, %xmm3
457 ; X32-SSE-NEXT: psraw $2, %xmm0
458 ; X32-SSE-NEXT: pand %xmm2, %xmm0
459 ; X32-SSE-NEXT: por %xmm3, %xmm0
460 ; X32-SSE-NEXT: paddw %xmm1, %xmm1
461 ; X32-SSE-NEXT: psraw $15, %xmm1
462 ; X32-SSE-NEXT: movdqa %xmm1, %xmm2
463 ; X32-SSE-NEXT: pandn %xmm0, %xmm2
464 ; X32-SSE-NEXT: psraw $1, %xmm0
465 ; X32-SSE-NEXT: pand %xmm1, %xmm0
466 ; X32-SSE-NEXT: por %xmm2, %xmm0
468 %shift = ashr <2 x i16> %a, %b
472 define <8 x i8> @var_shift_v8i8(<8 x i8> %a, <8 x i8> %b) nounwind {
473 ; SSE2-LABEL: var_shift_v8i8:
475 ; SSE2-NEXT: punpckhbw {{.*#+}} xmm2 = xmm2[8],xmm0[8],xmm2[9],xmm0[9],xmm2[10],xmm0[10],xmm2[11],xmm0[11],xmm2[12],xmm0[12],xmm2[13],xmm0[13],xmm2[14],xmm0[14],xmm2[15],xmm0[15]
476 ; SSE2-NEXT: psllw $5, %xmm1
477 ; SSE2-NEXT: punpckhbw {{.*#+}} xmm4 = xmm4[8],xmm1[8],xmm4[9],xmm1[9],xmm4[10],xmm1[10],xmm4[11],xmm1[11],xmm4[12],xmm1[12],xmm4[13],xmm1[13],xmm4[14],xmm1[14],xmm4[15],xmm1[15]
478 ; SSE2-NEXT: pxor %xmm3, %xmm3
479 ; SSE2-NEXT: pxor %xmm5, %xmm5
480 ; SSE2-NEXT: pcmpgtw %xmm4, %xmm5
481 ; SSE2-NEXT: movdqa %xmm5, %xmm6
482 ; SSE2-NEXT: pandn %xmm2, %xmm6
483 ; SSE2-NEXT: psraw $4, %xmm2
484 ; SSE2-NEXT: pand %xmm5, %xmm2
485 ; SSE2-NEXT: por %xmm6, %xmm2
486 ; SSE2-NEXT: paddw %xmm4, %xmm4
487 ; SSE2-NEXT: pxor %xmm5, %xmm5
488 ; SSE2-NEXT: pcmpgtw %xmm4, %xmm5
489 ; SSE2-NEXT: movdqa %xmm5, %xmm6
490 ; SSE2-NEXT: pandn %xmm2, %xmm6
491 ; SSE2-NEXT: psraw $2, %xmm2
492 ; SSE2-NEXT: pand %xmm5, %xmm2
493 ; SSE2-NEXT: por %xmm6, %xmm2
494 ; SSE2-NEXT: paddw %xmm4, %xmm4
495 ; SSE2-NEXT: pxor %xmm5, %xmm5
496 ; SSE2-NEXT: pcmpgtw %xmm4, %xmm5
497 ; SSE2-NEXT: movdqa %xmm5, %xmm4
498 ; SSE2-NEXT: pandn %xmm2, %xmm4
499 ; SSE2-NEXT: psraw $1, %xmm2
500 ; SSE2-NEXT: pand %xmm5, %xmm2
501 ; SSE2-NEXT: por %xmm4, %xmm2
502 ; SSE2-NEXT: psrlw $8, %xmm2
503 ; SSE2-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
504 ; SSE2-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
505 ; SSE2-NEXT: pxor %xmm4, %xmm4
506 ; SSE2-NEXT: pcmpgtw %xmm1, %xmm4
507 ; SSE2-NEXT: movdqa %xmm4, %xmm5
508 ; SSE2-NEXT: pandn %xmm0, %xmm5
509 ; SSE2-NEXT: psraw $4, %xmm0
510 ; SSE2-NEXT: pand %xmm4, %xmm0
511 ; SSE2-NEXT: por %xmm5, %xmm0
512 ; SSE2-NEXT: paddw %xmm1, %xmm1
513 ; SSE2-NEXT: pxor %xmm4, %xmm4
514 ; SSE2-NEXT: pcmpgtw %xmm1, %xmm4
515 ; SSE2-NEXT: movdqa %xmm4, %xmm5
516 ; SSE2-NEXT: pandn %xmm0, %xmm5
517 ; SSE2-NEXT: psraw $2, %xmm0
518 ; SSE2-NEXT: pand %xmm4, %xmm0
519 ; SSE2-NEXT: por %xmm5, %xmm0
520 ; SSE2-NEXT: paddw %xmm1, %xmm1
521 ; SSE2-NEXT: pcmpgtw %xmm1, %xmm3
522 ; SSE2-NEXT: movdqa %xmm3, %xmm1
523 ; SSE2-NEXT: pandn %xmm0, %xmm1
524 ; SSE2-NEXT: psraw $1, %xmm0
525 ; SSE2-NEXT: pand %xmm3, %xmm0
526 ; SSE2-NEXT: por %xmm1, %xmm0
527 ; SSE2-NEXT: psrlw $8, %xmm0
528 ; SSE2-NEXT: packuswb %xmm2, %xmm0
531 ; SSE41-LABEL: var_shift_v8i8:
533 ; SSE41-NEXT: movdqa %xmm0, %xmm2
534 ; SSE41-NEXT: psllw $5, %xmm1
535 ; SSE41-NEXT: punpckhbw {{.*#+}} xmm0 = xmm0[8],xmm1[8],xmm0[9],xmm1[9],xmm0[10],xmm1[10],xmm0[11],xmm1[11],xmm0[12],xmm1[12],xmm0[13],xmm1[13],xmm0[14],xmm1[14],xmm0[15],xmm1[15]
536 ; SSE41-NEXT: punpckhbw {{.*#+}} xmm3 = xmm3[8],xmm2[8],xmm3[9],xmm2[9],xmm3[10],xmm2[10],xmm3[11],xmm2[11],xmm3[12],xmm2[12],xmm3[13],xmm2[13],xmm3[14],xmm2[14],xmm3[15],xmm2[15]
537 ; SSE41-NEXT: movdqa %xmm3, %xmm4
538 ; SSE41-NEXT: psraw $4, %xmm4
539 ; SSE41-NEXT: pblendvb %xmm0, %xmm4, %xmm3
540 ; SSE41-NEXT: movdqa %xmm3, %xmm4
541 ; SSE41-NEXT: psraw $2, %xmm4
542 ; SSE41-NEXT: paddw %xmm0, %xmm0
543 ; SSE41-NEXT: pblendvb %xmm0, %xmm4, %xmm3
544 ; SSE41-NEXT: movdqa %xmm3, %xmm4
545 ; SSE41-NEXT: psraw $1, %xmm4
546 ; SSE41-NEXT: paddw %xmm0, %xmm0
547 ; SSE41-NEXT: pblendvb %xmm0, %xmm4, %xmm3
548 ; SSE41-NEXT: psrlw $8, %xmm3
549 ; SSE41-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3],xmm0[4],xmm1[4],xmm0[5],xmm1[5],xmm0[6],xmm1[6],xmm0[7],xmm1[7]
550 ; SSE41-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3],xmm1[4],xmm2[4],xmm1[5],xmm2[5],xmm1[6],xmm2[6],xmm1[7],xmm2[7]
551 ; SSE41-NEXT: movdqa %xmm1, %xmm2
552 ; SSE41-NEXT: psraw $4, %xmm2
553 ; SSE41-NEXT: pblendvb %xmm0, %xmm2, %xmm1
554 ; SSE41-NEXT: movdqa %xmm1, %xmm2
555 ; SSE41-NEXT: psraw $2, %xmm2
556 ; SSE41-NEXT: paddw %xmm0, %xmm0
557 ; SSE41-NEXT: pblendvb %xmm0, %xmm2, %xmm1
558 ; SSE41-NEXT: movdqa %xmm1, %xmm2
559 ; SSE41-NEXT: psraw $1, %xmm2
560 ; SSE41-NEXT: paddw %xmm0, %xmm0
561 ; SSE41-NEXT: pblendvb %xmm0, %xmm2, %xmm1
562 ; SSE41-NEXT: psrlw $8, %xmm1
563 ; SSE41-NEXT: packuswb %xmm3, %xmm1
564 ; SSE41-NEXT: movdqa %xmm1, %xmm0
567 ; AVX-LABEL: var_shift_v8i8:
569 ; AVX-NEXT: vpsllw $5, %xmm1, %xmm1
570 ; AVX-NEXT: vpunpckhbw {{.*#+}} xmm2 = xmm0[8],xmm1[8],xmm0[9],xmm1[9],xmm0[10],xmm1[10],xmm0[11],xmm1[11],xmm0[12],xmm1[12],xmm0[13],xmm1[13],xmm0[14],xmm1[14],xmm0[15],xmm1[15]
571 ; AVX-NEXT: vpunpckhbw {{.*#+}} xmm3 = xmm0[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15]
572 ; AVX-NEXT: vpsraw $4, %xmm3, %xmm4
573 ; AVX-NEXT: vpblendvb %xmm2, %xmm4, %xmm3, %xmm3
574 ; AVX-NEXT: vpsraw $2, %xmm3, %xmm4
575 ; AVX-NEXT: vpaddw %xmm2, %xmm2, %xmm2
576 ; AVX-NEXT: vpblendvb %xmm2, %xmm4, %xmm3, %xmm3
577 ; AVX-NEXT: vpsraw $1, %xmm3, %xmm4
578 ; AVX-NEXT: vpaddw %xmm2, %xmm2, %xmm2
579 ; AVX-NEXT: vpblendvb %xmm2, %xmm4, %xmm3, %xmm2
580 ; AVX-NEXT: vpsrlw $8, %xmm2, %xmm2
581 ; AVX-NEXT: vpunpcklbw {{.*#+}} xmm1 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3],xmm0[4],xmm1[4],xmm0[5],xmm1[5],xmm0[6],xmm1[6],xmm0[7],xmm1[7]
582 ; AVX-NEXT: vpunpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
583 ; AVX-NEXT: vpsraw $4, %xmm0, %xmm3
584 ; AVX-NEXT: vpblendvb %xmm1, %xmm3, %xmm0, %xmm0
585 ; AVX-NEXT: vpsraw $2, %xmm0, %xmm3
586 ; AVX-NEXT: vpaddw %xmm1, %xmm1, %xmm1
587 ; AVX-NEXT: vpblendvb %xmm1, %xmm3, %xmm0, %xmm0
588 ; AVX-NEXT: vpsraw $1, %xmm0, %xmm3
589 ; AVX-NEXT: vpaddw %xmm1, %xmm1, %xmm1
590 ; AVX-NEXT: vpblendvb %xmm1, %xmm3, %xmm0, %xmm0
591 ; AVX-NEXT: vpsrlw $8, %xmm0, %xmm0
592 ; AVX-NEXT: vpackuswb %xmm2, %xmm0, %xmm0
595 ; XOP-LABEL: var_shift_v8i8:
597 ; XOP-NEXT: vpxor %xmm2, %xmm2, %xmm2
598 ; XOP-NEXT: vpsubb %xmm1, %xmm2, %xmm1
599 ; XOP-NEXT: vpshab %xmm1, %xmm0, %xmm0
602 ; AVX512DQ-LABEL: var_shift_v8i8:
604 ; AVX512DQ-NEXT: vpmovzxbd {{.*#+}} zmm1 = xmm1[0],zero,zero,zero,xmm1[1],zero,zero,zero,xmm1[2],zero,zero,zero,xmm1[3],zero,zero,zero,xmm1[4],zero,zero,zero,xmm1[5],zero,zero,zero,xmm1[6],zero,zero,zero,xmm1[7],zero,zero,zero,xmm1[8],zero,zero,zero,xmm1[9],zero,zero,zero,xmm1[10],zero,zero,zero,xmm1[11],zero,zero,zero,xmm1[12],zero,zero,zero,xmm1[13],zero,zero,zero,xmm1[14],zero,zero,zero,xmm1[15],zero,zero,zero
605 ; AVX512DQ-NEXT: vpmovsxbd %xmm0, %zmm0
606 ; AVX512DQ-NEXT: vpsravd %zmm1, %zmm0, %zmm0
607 ; AVX512DQ-NEXT: vpmovdb %zmm0, %xmm0
608 ; AVX512DQ-NEXT: vzeroupper
609 ; AVX512DQ-NEXT: retq
611 ; AVX512BW-LABEL: var_shift_v8i8:
613 ; AVX512BW-NEXT: vpmovzxbw {{.*#+}} 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,xmm1[8],zero,xmm1[9],zero,xmm1[10],zero,xmm1[11],zero,xmm1[12],zero,xmm1[13],zero,xmm1[14],zero,xmm1[15],zero
614 ; AVX512BW-NEXT: vpmovsxbw %xmm0, %ymm0
615 ; AVX512BW-NEXT: vpsravw %zmm1, %zmm0, %zmm0
616 ; AVX512BW-NEXT: vpmovwb %zmm0, %ymm0
617 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 killed $ymm0
618 ; AVX512BW-NEXT: vzeroupper
619 ; AVX512BW-NEXT: retq
621 ; AVX512DQVL-LABEL: var_shift_v8i8:
622 ; AVX512DQVL: # %bb.0:
623 ; AVX512DQVL-NEXT: vpmovzxbd {{.*#+}} zmm1 = xmm1[0],zero,zero,zero,xmm1[1],zero,zero,zero,xmm1[2],zero,zero,zero,xmm1[3],zero,zero,zero,xmm1[4],zero,zero,zero,xmm1[5],zero,zero,zero,xmm1[6],zero,zero,zero,xmm1[7],zero,zero,zero,xmm1[8],zero,zero,zero,xmm1[9],zero,zero,zero,xmm1[10],zero,zero,zero,xmm1[11],zero,zero,zero,xmm1[12],zero,zero,zero,xmm1[13],zero,zero,zero,xmm1[14],zero,zero,zero,xmm1[15],zero,zero,zero
624 ; AVX512DQVL-NEXT: vpmovsxbd %xmm0, %zmm0
625 ; AVX512DQVL-NEXT: vpsravd %zmm1, %zmm0, %zmm0
626 ; AVX512DQVL-NEXT: vpmovdb %zmm0, %xmm0
627 ; AVX512DQVL-NEXT: vzeroupper
628 ; AVX512DQVL-NEXT: retq
630 ; AVX512BWVL-LABEL: var_shift_v8i8:
631 ; AVX512BWVL: # %bb.0:
632 ; AVX512BWVL-NEXT: vpmovzxbw {{.*#+}} 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,xmm1[8],zero,xmm1[9],zero,xmm1[10],zero,xmm1[11],zero,xmm1[12],zero,xmm1[13],zero,xmm1[14],zero,xmm1[15],zero
633 ; AVX512BWVL-NEXT: vpmovsxbw %xmm0, %ymm0
634 ; AVX512BWVL-NEXT: vpsravw %ymm1, %ymm0, %ymm0
635 ; AVX512BWVL-NEXT: vpmovwb %ymm0, %xmm0
636 ; AVX512BWVL-NEXT: vzeroupper
637 ; AVX512BWVL-NEXT: retq
639 ; X32-SSE-LABEL: var_shift_v8i8:
641 ; X32-SSE-NEXT: punpckhbw {{.*#+}} xmm2 = xmm2[8],xmm0[8],xmm2[9],xmm0[9],xmm2[10],xmm0[10],xmm2[11],xmm0[11],xmm2[12],xmm0[12],xmm2[13],xmm0[13],xmm2[14],xmm0[14],xmm2[15],xmm0[15]
642 ; X32-SSE-NEXT: psllw $5, %xmm1
643 ; X32-SSE-NEXT: punpckhbw {{.*#+}} xmm4 = xmm4[8],xmm1[8],xmm4[9],xmm1[9],xmm4[10],xmm1[10],xmm4[11],xmm1[11],xmm4[12],xmm1[12],xmm4[13],xmm1[13],xmm4[14],xmm1[14],xmm4[15],xmm1[15]
644 ; X32-SSE-NEXT: pxor %xmm3, %xmm3
645 ; X32-SSE-NEXT: pxor %xmm5, %xmm5
646 ; X32-SSE-NEXT: pcmpgtw %xmm4, %xmm5
647 ; X32-SSE-NEXT: movdqa %xmm5, %xmm6
648 ; X32-SSE-NEXT: pandn %xmm2, %xmm6
649 ; X32-SSE-NEXT: psraw $4, %xmm2
650 ; X32-SSE-NEXT: pand %xmm5, %xmm2
651 ; X32-SSE-NEXT: por %xmm6, %xmm2
652 ; X32-SSE-NEXT: paddw %xmm4, %xmm4
653 ; X32-SSE-NEXT: pxor %xmm5, %xmm5
654 ; X32-SSE-NEXT: pcmpgtw %xmm4, %xmm5
655 ; X32-SSE-NEXT: movdqa %xmm5, %xmm6
656 ; X32-SSE-NEXT: pandn %xmm2, %xmm6
657 ; X32-SSE-NEXT: psraw $2, %xmm2
658 ; X32-SSE-NEXT: pand %xmm5, %xmm2
659 ; X32-SSE-NEXT: por %xmm6, %xmm2
660 ; X32-SSE-NEXT: paddw %xmm4, %xmm4
661 ; X32-SSE-NEXT: pxor %xmm5, %xmm5
662 ; X32-SSE-NEXT: pcmpgtw %xmm4, %xmm5
663 ; X32-SSE-NEXT: movdqa %xmm5, %xmm4
664 ; X32-SSE-NEXT: pandn %xmm2, %xmm4
665 ; X32-SSE-NEXT: psraw $1, %xmm2
666 ; X32-SSE-NEXT: pand %xmm5, %xmm2
667 ; X32-SSE-NEXT: por %xmm4, %xmm2
668 ; X32-SSE-NEXT: psrlw $8, %xmm2
669 ; X32-SSE-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
670 ; X32-SSE-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
671 ; X32-SSE-NEXT: pxor %xmm4, %xmm4
672 ; X32-SSE-NEXT: pcmpgtw %xmm1, %xmm4
673 ; X32-SSE-NEXT: movdqa %xmm4, %xmm5
674 ; X32-SSE-NEXT: pandn %xmm0, %xmm5
675 ; X32-SSE-NEXT: psraw $4, %xmm0
676 ; X32-SSE-NEXT: pand %xmm4, %xmm0
677 ; X32-SSE-NEXT: por %xmm5, %xmm0
678 ; X32-SSE-NEXT: paddw %xmm1, %xmm1
679 ; X32-SSE-NEXT: pxor %xmm4, %xmm4
680 ; X32-SSE-NEXT: pcmpgtw %xmm1, %xmm4
681 ; X32-SSE-NEXT: movdqa %xmm4, %xmm5
682 ; X32-SSE-NEXT: pandn %xmm0, %xmm5
683 ; X32-SSE-NEXT: psraw $2, %xmm0
684 ; X32-SSE-NEXT: pand %xmm4, %xmm0
685 ; X32-SSE-NEXT: por %xmm5, %xmm0
686 ; X32-SSE-NEXT: paddw %xmm1, %xmm1
687 ; X32-SSE-NEXT: pcmpgtw %xmm1, %xmm3
688 ; X32-SSE-NEXT: movdqa %xmm3, %xmm1
689 ; X32-SSE-NEXT: pandn %xmm0, %xmm1
690 ; X32-SSE-NEXT: psraw $1, %xmm0
691 ; X32-SSE-NEXT: pand %xmm3, %xmm0
692 ; X32-SSE-NEXT: por %xmm1, %xmm0
693 ; X32-SSE-NEXT: psrlw $8, %xmm0
694 ; X32-SSE-NEXT: packuswb %xmm2, %xmm0
696 %shift = ashr <8 x i8> %a, %b
700 define <4 x i8> @var_shift_v4i8(<4 x i8> %a, <4 x i8> %b) nounwind {
701 ; SSE2-LABEL: var_shift_v4i8:
703 ; SSE2-NEXT: punpckhbw {{.*#+}} xmm2 = xmm2[8],xmm0[8],xmm2[9],xmm0[9],xmm2[10],xmm0[10],xmm2[11],xmm0[11],xmm2[12],xmm0[12],xmm2[13],xmm0[13],xmm2[14],xmm0[14],xmm2[15],xmm0[15]
704 ; SSE2-NEXT: psllw $5, %xmm1
705 ; SSE2-NEXT: punpckhbw {{.*#+}} xmm4 = xmm4[8],xmm1[8],xmm4[9],xmm1[9],xmm4[10],xmm1[10],xmm4[11],xmm1[11],xmm4[12],xmm1[12],xmm4[13],xmm1[13],xmm4[14],xmm1[14],xmm4[15],xmm1[15]
706 ; SSE2-NEXT: pxor %xmm3, %xmm3
707 ; SSE2-NEXT: pxor %xmm5, %xmm5
708 ; SSE2-NEXT: pcmpgtw %xmm4, %xmm5
709 ; SSE2-NEXT: movdqa %xmm5, %xmm6
710 ; SSE2-NEXT: pandn %xmm2, %xmm6
711 ; SSE2-NEXT: psraw $4, %xmm2
712 ; SSE2-NEXT: pand %xmm5, %xmm2
713 ; SSE2-NEXT: por %xmm6, %xmm2
714 ; SSE2-NEXT: paddw %xmm4, %xmm4
715 ; SSE2-NEXT: pxor %xmm5, %xmm5
716 ; SSE2-NEXT: pcmpgtw %xmm4, %xmm5
717 ; SSE2-NEXT: movdqa %xmm5, %xmm6
718 ; SSE2-NEXT: pandn %xmm2, %xmm6
719 ; SSE2-NEXT: psraw $2, %xmm2
720 ; SSE2-NEXT: pand %xmm5, %xmm2
721 ; SSE2-NEXT: por %xmm6, %xmm2
722 ; SSE2-NEXT: paddw %xmm4, %xmm4
723 ; SSE2-NEXT: pxor %xmm5, %xmm5
724 ; SSE2-NEXT: pcmpgtw %xmm4, %xmm5
725 ; SSE2-NEXT: movdqa %xmm5, %xmm4
726 ; SSE2-NEXT: pandn %xmm2, %xmm4
727 ; SSE2-NEXT: psraw $1, %xmm2
728 ; SSE2-NEXT: pand %xmm5, %xmm2
729 ; SSE2-NEXT: por %xmm4, %xmm2
730 ; SSE2-NEXT: psrlw $8, %xmm2
731 ; SSE2-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
732 ; SSE2-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
733 ; SSE2-NEXT: pxor %xmm4, %xmm4
734 ; SSE2-NEXT: pcmpgtw %xmm1, %xmm4
735 ; SSE2-NEXT: movdqa %xmm4, %xmm5
736 ; SSE2-NEXT: pandn %xmm0, %xmm5
737 ; SSE2-NEXT: psraw $4, %xmm0
738 ; SSE2-NEXT: pand %xmm4, %xmm0
739 ; SSE2-NEXT: por %xmm5, %xmm0
740 ; SSE2-NEXT: paddw %xmm1, %xmm1
741 ; SSE2-NEXT: pxor %xmm4, %xmm4
742 ; SSE2-NEXT: pcmpgtw %xmm1, %xmm4
743 ; SSE2-NEXT: movdqa %xmm4, %xmm5
744 ; SSE2-NEXT: pandn %xmm0, %xmm5
745 ; SSE2-NEXT: psraw $2, %xmm0
746 ; SSE2-NEXT: pand %xmm4, %xmm0
747 ; SSE2-NEXT: por %xmm5, %xmm0
748 ; SSE2-NEXT: paddw %xmm1, %xmm1
749 ; SSE2-NEXT: pcmpgtw %xmm1, %xmm3
750 ; SSE2-NEXT: movdqa %xmm3, %xmm1
751 ; SSE2-NEXT: pandn %xmm0, %xmm1
752 ; SSE2-NEXT: psraw $1, %xmm0
753 ; SSE2-NEXT: pand %xmm3, %xmm0
754 ; SSE2-NEXT: por %xmm1, %xmm0
755 ; SSE2-NEXT: psrlw $8, %xmm0
756 ; SSE2-NEXT: packuswb %xmm2, %xmm0
759 ; SSE41-LABEL: var_shift_v4i8:
761 ; SSE41-NEXT: movdqa %xmm0, %xmm2
762 ; SSE41-NEXT: psllw $5, %xmm1
763 ; SSE41-NEXT: punpckhbw {{.*#+}} xmm0 = xmm0[8],xmm1[8],xmm0[9],xmm1[9],xmm0[10],xmm1[10],xmm0[11],xmm1[11],xmm0[12],xmm1[12],xmm0[13],xmm1[13],xmm0[14],xmm1[14],xmm0[15],xmm1[15]
764 ; SSE41-NEXT: punpckhbw {{.*#+}} xmm3 = xmm3[8],xmm2[8],xmm3[9],xmm2[9],xmm3[10],xmm2[10],xmm3[11],xmm2[11],xmm3[12],xmm2[12],xmm3[13],xmm2[13],xmm3[14],xmm2[14],xmm3[15],xmm2[15]
765 ; SSE41-NEXT: movdqa %xmm3, %xmm4
766 ; SSE41-NEXT: psraw $4, %xmm4
767 ; SSE41-NEXT: pblendvb %xmm0, %xmm4, %xmm3
768 ; SSE41-NEXT: movdqa %xmm3, %xmm4
769 ; SSE41-NEXT: psraw $2, %xmm4
770 ; SSE41-NEXT: paddw %xmm0, %xmm0
771 ; SSE41-NEXT: pblendvb %xmm0, %xmm4, %xmm3
772 ; SSE41-NEXT: movdqa %xmm3, %xmm4
773 ; SSE41-NEXT: psraw $1, %xmm4
774 ; SSE41-NEXT: paddw %xmm0, %xmm0
775 ; SSE41-NEXT: pblendvb %xmm0, %xmm4, %xmm3
776 ; SSE41-NEXT: psrlw $8, %xmm3
777 ; SSE41-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3],xmm0[4],xmm1[4],xmm0[5],xmm1[5],xmm0[6],xmm1[6],xmm0[7],xmm1[7]
778 ; SSE41-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3],xmm1[4],xmm2[4],xmm1[5],xmm2[5],xmm1[6],xmm2[6],xmm1[7],xmm2[7]
779 ; SSE41-NEXT: movdqa %xmm1, %xmm2
780 ; SSE41-NEXT: psraw $4, %xmm2
781 ; SSE41-NEXT: pblendvb %xmm0, %xmm2, %xmm1
782 ; SSE41-NEXT: movdqa %xmm1, %xmm2
783 ; SSE41-NEXT: psraw $2, %xmm2
784 ; SSE41-NEXT: paddw %xmm0, %xmm0
785 ; SSE41-NEXT: pblendvb %xmm0, %xmm2, %xmm1
786 ; SSE41-NEXT: movdqa %xmm1, %xmm2
787 ; SSE41-NEXT: psraw $1, %xmm2
788 ; SSE41-NEXT: paddw %xmm0, %xmm0
789 ; SSE41-NEXT: pblendvb %xmm0, %xmm2, %xmm1
790 ; SSE41-NEXT: psrlw $8, %xmm1
791 ; SSE41-NEXT: packuswb %xmm3, %xmm1
792 ; SSE41-NEXT: movdqa %xmm1, %xmm0
795 ; AVX-LABEL: var_shift_v4i8:
797 ; AVX-NEXT: vpsllw $5, %xmm1, %xmm1
798 ; AVX-NEXT: vpunpckhbw {{.*#+}} xmm2 = xmm0[8],xmm1[8],xmm0[9],xmm1[9],xmm0[10],xmm1[10],xmm0[11],xmm1[11],xmm0[12],xmm1[12],xmm0[13],xmm1[13],xmm0[14],xmm1[14],xmm0[15],xmm1[15]
799 ; AVX-NEXT: vpunpckhbw {{.*#+}} xmm3 = xmm0[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15]
800 ; AVX-NEXT: vpsraw $4, %xmm3, %xmm4
801 ; AVX-NEXT: vpblendvb %xmm2, %xmm4, %xmm3, %xmm3
802 ; AVX-NEXT: vpsraw $2, %xmm3, %xmm4
803 ; AVX-NEXT: vpaddw %xmm2, %xmm2, %xmm2
804 ; AVX-NEXT: vpblendvb %xmm2, %xmm4, %xmm3, %xmm3
805 ; AVX-NEXT: vpsraw $1, %xmm3, %xmm4
806 ; AVX-NEXT: vpaddw %xmm2, %xmm2, %xmm2
807 ; AVX-NEXT: vpblendvb %xmm2, %xmm4, %xmm3, %xmm2
808 ; AVX-NEXT: vpsrlw $8, %xmm2, %xmm2
809 ; AVX-NEXT: vpunpcklbw {{.*#+}} xmm1 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3],xmm0[4],xmm1[4],xmm0[5],xmm1[5],xmm0[6],xmm1[6],xmm0[7],xmm1[7]
810 ; AVX-NEXT: vpunpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
811 ; AVX-NEXT: vpsraw $4, %xmm0, %xmm3
812 ; AVX-NEXT: vpblendvb %xmm1, %xmm3, %xmm0, %xmm0
813 ; AVX-NEXT: vpsraw $2, %xmm0, %xmm3
814 ; AVX-NEXT: vpaddw %xmm1, %xmm1, %xmm1
815 ; AVX-NEXT: vpblendvb %xmm1, %xmm3, %xmm0, %xmm0
816 ; AVX-NEXT: vpsraw $1, %xmm0, %xmm3
817 ; AVX-NEXT: vpaddw %xmm1, %xmm1, %xmm1
818 ; AVX-NEXT: vpblendvb %xmm1, %xmm3, %xmm0, %xmm0
819 ; AVX-NEXT: vpsrlw $8, %xmm0, %xmm0
820 ; AVX-NEXT: vpackuswb %xmm2, %xmm0, %xmm0
823 ; XOP-LABEL: var_shift_v4i8:
825 ; XOP-NEXT: vpxor %xmm2, %xmm2, %xmm2
826 ; XOP-NEXT: vpsubb %xmm1, %xmm2, %xmm1
827 ; XOP-NEXT: vpshab %xmm1, %xmm0, %xmm0
830 ; AVX512DQ-LABEL: var_shift_v4i8:
832 ; AVX512DQ-NEXT: vpmovzxbd {{.*#+}} zmm1 = xmm1[0],zero,zero,zero,xmm1[1],zero,zero,zero,xmm1[2],zero,zero,zero,xmm1[3],zero,zero,zero,xmm1[4],zero,zero,zero,xmm1[5],zero,zero,zero,xmm1[6],zero,zero,zero,xmm1[7],zero,zero,zero,xmm1[8],zero,zero,zero,xmm1[9],zero,zero,zero,xmm1[10],zero,zero,zero,xmm1[11],zero,zero,zero,xmm1[12],zero,zero,zero,xmm1[13],zero,zero,zero,xmm1[14],zero,zero,zero,xmm1[15],zero,zero,zero
833 ; AVX512DQ-NEXT: vpmovsxbd %xmm0, %zmm0
834 ; AVX512DQ-NEXT: vpsravd %zmm1, %zmm0, %zmm0
835 ; AVX512DQ-NEXT: vpmovdb %zmm0, %xmm0
836 ; AVX512DQ-NEXT: vzeroupper
837 ; AVX512DQ-NEXT: retq
839 ; AVX512BW-LABEL: var_shift_v4i8:
841 ; AVX512BW-NEXT: vpmovzxbw {{.*#+}} 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,xmm1[8],zero,xmm1[9],zero,xmm1[10],zero,xmm1[11],zero,xmm1[12],zero,xmm1[13],zero,xmm1[14],zero,xmm1[15],zero
842 ; AVX512BW-NEXT: vpmovsxbw %xmm0, %ymm0
843 ; AVX512BW-NEXT: vpsravw %zmm1, %zmm0, %zmm0
844 ; AVX512BW-NEXT: vpmovwb %zmm0, %ymm0
845 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 killed $ymm0
846 ; AVX512BW-NEXT: vzeroupper
847 ; AVX512BW-NEXT: retq
849 ; AVX512DQVL-LABEL: var_shift_v4i8:
850 ; AVX512DQVL: # %bb.0:
851 ; AVX512DQVL-NEXT: vpmovzxbd {{.*#+}} zmm1 = xmm1[0],zero,zero,zero,xmm1[1],zero,zero,zero,xmm1[2],zero,zero,zero,xmm1[3],zero,zero,zero,xmm1[4],zero,zero,zero,xmm1[5],zero,zero,zero,xmm1[6],zero,zero,zero,xmm1[7],zero,zero,zero,xmm1[8],zero,zero,zero,xmm1[9],zero,zero,zero,xmm1[10],zero,zero,zero,xmm1[11],zero,zero,zero,xmm1[12],zero,zero,zero,xmm1[13],zero,zero,zero,xmm1[14],zero,zero,zero,xmm1[15],zero,zero,zero
852 ; AVX512DQVL-NEXT: vpmovsxbd %xmm0, %zmm0
853 ; AVX512DQVL-NEXT: vpsravd %zmm1, %zmm0, %zmm0
854 ; AVX512DQVL-NEXT: vpmovdb %zmm0, %xmm0
855 ; AVX512DQVL-NEXT: vzeroupper
856 ; AVX512DQVL-NEXT: retq
858 ; AVX512BWVL-LABEL: var_shift_v4i8:
859 ; AVX512BWVL: # %bb.0:
860 ; AVX512BWVL-NEXT: vpmovzxbw {{.*#+}} 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,xmm1[8],zero,xmm1[9],zero,xmm1[10],zero,xmm1[11],zero,xmm1[12],zero,xmm1[13],zero,xmm1[14],zero,xmm1[15],zero
861 ; AVX512BWVL-NEXT: vpmovsxbw %xmm0, %ymm0
862 ; AVX512BWVL-NEXT: vpsravw %ymm1, %ymm0, %ymm0
863 ; AVX512BWVL-NEXT: vpmovwb %ymm0, %xmm0
864 ; AVX512BWVL-NEXT: vzeroupper
865 ; AVX512BWVL-NEXT: retq
867 ; X32-SSE-LABEL: var_shift_v4i8:
869 ; X32-SSE-NEXT: punpckhbw {{.*#+}} xmm2 = xmm2[8],xmm0[8],xmm2[9],xmm0[9],xmm2[10],xmm0[10],xmm2[11],xmm0[11],xmm2[12],xmm0[12],xmm2[13],xmm0[13],xmm2[14],xmm0[14],xmm2[15],xmm0[15]
870 ; X32-SSE-NEXT: psllw $5, %xmm1
871 ; X32-SSE-NEXT: punpckhbw {{.*#+}} xmm4 = xmm4[8],xmm1[8],xmm4[9],xmm1[9],xmm4[10],xmm1[10],xmm4[11],xmm1[11],xmm4[12],xmm1[12],xmm4[13],xmm1[13],xmm4[14],xmm1[14],xmm4[15],xmm1[15]
872 ; X32-SSE-NEXT: pxor %xmm3, %xmm3
873 ; X32-SSE-NEXT: pxor %xmm5, %xmm5
874 ; X32-SSE-NEXT: pcmpgtw %xmm4, %xmm5
875 ; X32-SSE-NEXT: movdqa %xmm5, %xmm6
876 ; X32-SSE-NEXT: pandn %xmm2, %xmm6
877 ; X32-SSE-NEXT: psraw $4, %xmm2
878 ; X32-SSE-NEXT: pand %xmm5, %xmm2
879 ; X32-SSE-NEXT: por %xmm6, %xmm2
880 ; X32-SSE-NEXT: paddw %xmm4, %xmm4
881 ; X32-SSE-NEXT: pxor %xmm5, %xmm5
882 ; X32-SSE-NEXT: pcmpgtw %xmm4, %xmm5
883 ; X32-SSE-NEXT: movdqa %xmm5, %xmm6
884 ; X32-SSE-NEXT: pandn %xmm2, %xmm6
885 ; X32-SSE-NEXT: psraw $2, %xmm2
886 ; X32-SSE-NEXT: pand %xmm5, %xmm2
887 ; X32-SSE-NEXT: por %xmm6, %xmm2
888 ; X32-SSE-NEXT: paddw %xmm4, %xmm4
889 ; X32-SSE-NEXT: pxor %xmm5, %xmm5
890 ; X32-SSE-NEXT: pcmpgtw %xmm4, %xmm5
891 ; X32-SSE-NEXT: movdqa %xmm5, %xmm4
892 ; X32-SSE-NEXT: pandn %xmm2, %xmm4
893 ; X32-SSE-NEXT: psraw $1, %xmm2
894 ; X32-SSE-NEXT: pand %xmm5, %xmm2
895 ; X32-SSE-NEXT: por %xmm4, %xmm2
896 ; X32-SSE-NEXT: psrlw $8, %xmm2
897 ; X32-SSE-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
898 ; X32-SSE-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
899 ; X32-SSE-NEXT: pxor %xmm4, %xmm4
900 ; X32-SSE-NEXT: pcmpgtw %xmm1, %xmm4
901 ; X32-SSE-NEXT: movdqa %xmm4, %xmm5
902 ; X32-SSE-NEXT: pandn %xmm0, %xmm5
903 ; X32-SSE-NEXT: psraw $4, %xmm0
904 ; X32-SSE-NEXT: pand %xmm4, %xmm0
905 ; X32-SSE-NEXT: por %xmm5, %xmm0
906 ; X32-SSE-NEXT: paddw %xmm1, %xmm1
907 ; X32-SSE-NEXT: pxor %xmm4, %xmm4
908 ; X32-SSE-NEXT: pcmpgtw %xmm1, %xmm4
909 ; X32-SSE-NEXT: movdqa %xmm4, %xmm5
910 ; X32-SSE-NEXT: pandn %xmm0, %xmm5
911 ; X32-SSE-NEXT: psraw $2, %xmm0
912 ; X32-SSE-NEXT: pand %xmm4, %xmm0
913 ; X32-SSE-NEXT: por %xmm5, %xmm0
914 ; X32-SSE-NEXT: paddw %xmm1, %xmm1
915 ; X32-SSE-NEXT: pcmpgtw %xmm1, %xmm3
916 ; X32-SSE-NEXT: movdqa %xmm3, %xmm1
917 ; X32-SSE-NEXT: pandn %xmm0, %xmm1
918 ; X32-SSE-NEXT: psraw $1, %xmm0
919 ; X32-SSE-NEXT: pand %xmm3, %xmm0
920 ; X32-SSE-NEXT: por %xmm1, %xmm0
921 ; X32-SSE-NEXT: psrlw $8, %xmm0
922 ; X32-SSE-NEXT: packuswb %xmm2, %xmm0
924 %shift = ashr <4 x i8> %a, %b
928 define <2 x i8> @var_shift_v2i8(<2 x i8> %a, <2 x i8> %b) nounwind {
929 ; SSE2-LABEL: var_shift_v2i8:
931 ; SSE2-NEXT: punpckhbw {{.*#+}} xmm2 = xmm2[8],xmm0[8],xmm2[9],xmm0[9],xmm2[10],xmm0[10],xmm2[11],xmm0[11],xmm2[12],xmm0[12],xmm2[13],xmm0[13],xmm2[14],xmm0[14],xmm2[15],xmm0[15]
932 ; SSE2-NEXT: psllw $5, %xmm1
933 ; SSE2-NEXT: punpckhbw {{.*#+}} xmm4 = xmm4[8],xmm1[8],xmm4[9],xmm1[9],xmm4[10],xmm1[10],xmm4[11],xmm1[11],xmm4[12],xmm1[12],xmm4[13],xmm1[13],xmm4[14],xmm1[14],xmm4[15],xmm1[15]
934 ; SSE2-NEXT: pxor %xmm3, %xmm3
935 ; SSE2-NEXT: pxor %xmm5, %xmm5
936 ; SSE2-NEXT: pcmpgtw %xmm4, %xmm5
937 ; SSE2-NEXT: movdqa %xmm5, %xmm6
938 ; SSE2-NEXT: pandn %xmm2, %xmm6
939 ; SSE2-NEXT: psraw $4, %xmm2
940 ; SSE2-NEXT: pand %xmm5, %xmm2
941 ; SSE2-NEXT: por %xmm6, %xmm2
942 ; SSE2-NEXT: paddw %xmm4, %xmm4
943 ; SSE2-NEXT: pxor %xmm5, %xmm5
944 ; SSE2-NEXT: pcmpgtw %xmm4, %xmm5
945 ; SSE2-NEXT: movdqa %xmm5, %xmm6
946 ; SSE2-NEXT: pandn %xmm2, %xmm6
947 ; SSE2-NEXT: psraw $2, %xmm2
948 ; SSE2-NEXT: pand %xmm5, %xmm2
949 ; SSE2-NEXT: por %xmm6, %xmm2
950 ; SSE2-NEXT: paddw %xmm4, %xmm4
951 ; SSE2-NEXT: pxor %xmm5, %xmm5
952 ; SSE2-NEXT: pcmpgtw %xmm4, %xmm5
953 ; SSE2-NEXT: movdqa %xmm5, %xmm4
954 ; SSE2-NEXT: pandn %xmm2, %xmm4
955 ; SSE2-NEXT: psraw $1, %xmm2
956 ; SSE2-NEXT: pand %xmm5, %xmm2
957 ; SSE2-NEXT: por %xmm4, %xmm2
958 ; SSE2-NEXT: psrlw $8, %xmm2
959 ; SSE2-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
960 ; SSE2-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
961 ; SSE2-NEXT: pxor %xmm4, %xmm4
962 ; SSE2-NEXT: pcmpgtw %xmm1, %xmm4
963 ; SSE2-NEXT: movdqa %xmm4, %xmm5
964 ; SSE2-NEXT: pandn %xmm0, %xmm5
965 ; SSE2-NEXT: psraw $4, %xmm0
966 ; SSE2-NEXT: pand %xmm4, %xmm0
967 ; SSE2-NEXT: por %xmm5, %xmm0
968 ; SSE2-NEXT: paddw %xmm1, %xmm1
969 ; SSE2-NEXT: pxor %xmm4, %xmm4
970 ; SSE2-NEXT: pcmpgtw %xmm1, %xmm4
971 ; SSE2-NEXT: movdqa %xmm4, %xmm5
972 ; SSE2-NEXT: pandn %xmm0, %xmm5
973 ; SSE2-NEXT: psraw $2, %xmm0
974 ; SSE2-NEXT: pand %xmm4, %xmm0
975 ; SSE2-NEXT: por %xmm5, %xmm0
976 ; SSE2-NEXT: paddw %xmm1, %xmm1
977 ; SSE2-NEXT: pcmpgtw %xmm1, %xmm3
978 ; SSE2-NEXT: movdqa %xmm3, %xmm1
979 ; SSE2-NEXT: pandn %xmm0, %xmm1
980 ; SSE2-NEXT: psraw $1, %xmm0
981 ; SSE2-NEXT: pand %xmm3, %xmm0
982 ; SSE2-NEXT: por %xmm1, %xmm0
983 ; SSE2-NEXT: psrlw $8, %xmm0
984 ; SSE2-NEXT: packuswb %xmm2, %xmm0
987 ; SSE41-LABEL: var_shift_v2i8:
989 ; SSE41-NEXT: movdqa %xmm0, %xmm2
990 ; SSE41-NEXT: psllw $5, %xmm1
991 ; SSE41-NEXT: punpckhbw {{.*#+}} xmm0 = xmm0[8],xmm1[8],xmm0[9],xmm1[9],xmm0[10],xmm1[10],xmm0[11],xmm1[11],xmm0[12],xmm1[12],xmm0[13],xmm1[13],xmm0[14],xmm1[14],xmm0[15],xmm1[15]
992 ; SSE41-NEXT: punpckhbw {{.*#+}} xmm3 = xmm3[8],xmm2[8],xmm3[9],xmm2[9],xmm3[10],xmm2[10],xmm3[11],xmm2[11],xmm3[12],xmm2[12],xmm3[13],xmm2[13],xmm3[14],xmm2[14],xmm3[15],xmm2[15]
993 ; SSE41-NEXT: movdqa %xmm3, %xmm4
994 ; SSE41-NEXT: psraw $4, %xmm4
995 ; SSE41-NEXT: pblendvb %xmm0, %xmm4, %xmm3
996 ; SSE41-NEXT: movdqa %xmm3, %xmm4
997 ; SSE41-NEXT: psraw $2, %xmm4
998 ; SSE41-NEXT: paddw %xmm0, %xmm0
999 ; SSE41-NEXT: pblendvb %xmm0, %xmm4, %xmm3
1000 ; SSE41-NEXT: movdqa %xmm3, %xmm4
1001 ; SSE41-NEXT: psraw $1, %xmm4
1002 ; SSE41-NEXT: paddw %xmm0, %xmm0
1003 ; SSE41-NEXT: pblendvb %xmm0, %xmm4, %xmm3
1004 ; SSE41-NEXT: psrlw $8, %xmm3
1005 ; SSE41-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3],xmm0[4],xmm1[4],xmm0[5],xmm1[5],xmm0[6],xmm1[6],xmm0[7],xmm1[7]
1006 ; SSE41-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0],xmm2[0],xmm1[1],xmm2[1],xmm1[2],xmm2[2],xmm1[3],xmm2[3],xmm1[4],xmm2[4],xmm1[5],xmm2[5],xmm1[6],xmm2[6],xmm1[7],xmm2[7]
1007 ; SSE41-NEXT: movdqa %xmm1, %xmm2
1008 ; SSE41-NEXT: psraw $4, %xmm2
1009 ; SSE41-NEXT: pblendvb %xmm0, %xmm2, %xmm1
1010 ; SSE41-NEXT: movdqa %xmm1, %xmm2
1011 ; SSE41-NEXT: psraw $2, %xmm2
1012 ; SSE41-NEXT: paddw %xmm0, %xmm0
1013 ; SSE41-NEXT: pblendvb %xmm0, %xmm2, %xmm1
1014 ; SSE41-NEXT: movdqa %xmm1, %xmm2
1015 ; SSE41-NEXT: psraw $1, %xmm2
1016 ; SSE41-NEXT: paddw %xmm0, %xmm0
1017 ; SSE41-NEXT: pblendvb %xmm0, %xmm2, %xmm1
1018 ; SSE41-NEXT: psrlw $8, %xmm1
1019 ; SSE41-NEXT: packuswb %xmm3, %xmm1
1020 ; SSE41-NEXT: movdqa %xmm1, %xmm0
1023 ; AVX-LABEL: var_shift_v2i8:
1025 ; AVX-NEXT: vpsllw $5, %xmm1, %xmm1
1026 ; AVX-NEXT: vpunpckhbw {{.*#+}} xmm2 = xmm0[8],xmm1[8],xmm0[9],xmm1[9],xmm0[10],xmm1[10],xmm0[11],xmm1[11],xmm0[12],xmm1[12],xmm0[13],xmm1[13],xmm0[14],xmm1[14],xmm0[15],xmm1[15]
1027 ; AVX-NEXT: vpunpckhbw {{.*#+}} xmm3 = xmm0[8,8,9,9,10,10,11,11,12,12,13,13,14,14,15,15]
1028 ; AVX-NEXT: vpsraw $4, %xmm3, %xmm4
1029 ; AVX-NEXT: vpblendvb %xmm2, %xmm4, %xmm3, %xmm3
1030 ; AVX-NEXT: vpsraw $2, %xmm3, %xmm4
1031 ; AVX-NEXT: vpaddw %xmm2, %xmm2, %xmm2
1032 ; AVX-NEXT: vpblendvb %xmm2, %xmm4, %xmm3, %xmm3
1033 ; AVX-NEXT: vpsraw $1, %xmm3, %xmm4
1034 ; AVX-NEXT: vpaddw %xmm2, %xmm2, %xmm2
1035 ; AVX-NEXT: vpblendvb %xmm2, %xmm4, %xmm3, %xmm2
1036 ; AVX-NEXT: vpsrlw $8, %xmm2, %xmm2
1037 ; AVX-NEXT: vpunpcklbw {{.*#+}} xmm1 = xmm0[0],xmm1[0],xmm0[1],xmm1[1],xmm0[2],xmm1[2],xmm0[3],xmm1[3],xmm0[4],xmm1[4],xmm0[5],xmm1[5],xmm0[6],xmm1[6],xmm0[7],xmm1[7]
1038 ; AVX-NEXT: vpunpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
1039 ; AVX-NEXT: vpsraw $4, %xmm0, %xmm3
1040 ; AVX-NEXT: vpblendvb %xmm1, %xmm3, %xmm0, %xmm0
1041 ; AVX-NEXT: vpsraw $2, %xmm0, %xmm3
1042 ; AVX-NEXT: vpaddw %xmm1, %xmm1, %xmm1
1043 ; AVX-NEXT: vpblendvb %xmm1, %xmm3, %xmm0, %xmm0
1044 ; AVX-NEXT: vpsraw $1, %xmm0, %xmm3
1045 ; AVX-NEXT: vpaddw %xmm1, %xmm1, %xmm1
1046 ; AVX-NEXT: vpblendvb %xmm1, %xmm3, %xmm0, %xmm0
1047 ; AVX-NEXT: vpsrlw $8, %xmm0, %xmm0
1048 ; AVX-NEXT: vpackuswb %xmm2, %xmm0, %xmm0
1051 ; XOP-LABEL: var_shift_v2i8:
1053 ; XOP-NEXT: vpxor %xmm2, %xmm2, %xmm2
1054 ; XOP-NEXT: vpsubb %xmm1, %xmm2, %xmm1
1055 ; XOP-NEXT: vpshab %xmm1, %xmm0, %xmm0
1058 ; AVX512DQ-LABEL: var_shift_v2i8:
1059 ; AVX512DQ: # %bb.0:
1060 ; AVX512DQ-NEXT: vpmovzxbd {{.*#+}} zmm1 = xmm1[0],zero,zero,zero,xmm1[1],zero,zero,zero,xmm1[2],zero,zero,zero,xmm1[3],zero,zero,zero,xmm1[4],zero,zero,zero,xmm1[5],zero,zero,zero,xmm1[6],zero,zero,zero,xmm1[7],zero,zero,zero,xmm1[8],zero,zero,zero,xmm1[9],zero,zero,zero,xmm1[10],zero,zero,zero,xmm1[11],zero,zero,zero,xmm1[12],zero,zero,zero,xmm1[13],zero,zero,zero,xmm1[14],zero,zero,zero,xmm1[15],zero,zero,zero
1061 ; AVX512DQ-NEXT: vpmovsxbd %xmm0, %zmm0
1062 ; AVX512DQ-NEXT: vpsravd %zmm1, %zmm0, %zmm0
1063 ; AVX512DQ-NEXT: vpmovdb %zmm0, %xmm0
1064 ; AVX512DQ-NEXT: vzeroupper
1065 ; AVX512DQ-NEXT: retq
1067 ; AVX512BW-LABEL: var_shift_v2i8:
1068 ; AVX512BW: # %bb.0:
1069 ; AVX512BW-NEXT: vpmovzxbw {{.*#+}} 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,xmm1[8],zero,xmm1[9],zero,xmm1[10],zero,xmm1[11],zero,xmm1[12],zero,xmm1[13],zero,xmm1[14],zero,xmm1[15],zero
1070 ; AVX512BW-NEXT: vpmovsxbw %xmm0, %ymm0
1071 ; AVX512BW-NEXT: vpsravw %zmm1, %zmm0, %zmm0
1072 ; AVX512BW-NEXT: vpmovwb %zmm0, %ymm0
1073 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 killed $ymm0
1074 ; AVX512BW-NEXT: vzeroupper
1075 ; AVX512BW-NEXT: retq
1077 ; AVX512DQVL-LABEL: var_shift_v2i8:
1078 ; AVX512DQVL: # %bb.0:
1079 ; AVX512DQVL-NEXT: vpmovzxbd {{.*#+}} zmm1 = xmm1[0],zero,zero,zero,xmm1[1],zero,zero,zero,xmm1[2],zero,zero,zero,xmm1[3],zero,zero,zero,xmm1[4],zero,zero,zero,xmm1[5],zero,zero,zero,xmm1[6],zero,zero,zero,xmm1[7],zero,zero,zero,xmm1[8],zero,zero,zero,xmm1[9],zero,zero,zero,xmm1[10],zero,zero,zero,xmm1[11],zero,zero,zero,xmm1[12],zero,zero,zero,xmm1[13],zero,zero,zero,xmm1[14],zero,zero,zero,xmm1[15],zero,zero,zero
1080 ; AVX512DQVL-NEXT: vpmovsxbd %xmm0, %zmm0
1081 ; AVX512DQVL-NEXT: vpsravd %zmm1, %zmm0, %zmm0
1082 ; AVX512DQVL-NEXT: vpmovdb %zmm0, %xmm0
1083 ; AVX512DQVL-NEXT: vzeroupper
1084 ; AVX512DQVL-NEXT: retq
1086 ; AVX512BWVL-LABEL: var_shift_v2i8:
1087 ; AVX512BWVL: # %bb.0:
1088 ; AVX512BWVL-NEXT: vpmovzxbw {{.*#+}} 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,xmm1[8],zero,xmm1[9],zero,xmm1[10],zero,xmm1[11],zero,xmm1[12],zero,xmm1[13],zero,xmm1[14],zero,xmm1[15],zero
1089 ; AVX512BWVL-NEXT: vpmovsxbw %xmm0, %ymm0
1090 ; AVX512BWVL-NEXT: vpsravw %ymm1, %ymm0, %ymm0
1091 ; AVX512BWVL-NEXT: vpmovwb %ymm0, %xmm0
1092 ; AVX512BWVL-NEXT: vzeroupper
1093 ; AVX512BWVL-NEXT: retq
1095 ; X32-SSE-LABEL: var_shift_v2i8:
1097 ; X32-SSE-NEXT: punpckhbw {{.*#+}} xmm2 = xmm2[8],xmm0[8],xmm2[9],xmm0[9],xmm2[10],xmm0[10],xmm2[11],xmm0[11],xmm2[12],xmm0[12],xmm2[13],xmm0[13],xmm2[14],xmm0[14],xmm2[15],xmm0[15]
1098 ; X32-SSE-NEXT: psllw $5, %xmm1
1099 ; X32-SSE-NEXT: punpckhbw {{.*#+}} xmm4 = xmm4[8],xmm1[8],xmm4[9],xmm1[9],xmm4[10],xmm1[10],xmm4[11],xmm1[11],xmm4[12],xmm1[12],xmm4[13],xmm1[13],xmm4[14],xmm1[14],xmm4[15],xmm1[15]
1100 ; X32-SSE-NEXT: pxor %xmm3, %xmm3
1101 ; X32-SSE-NEXT: pxor %xmm5, %xmm5
1102 ; X32-SSE-NEXT: pcmpgtw %xmm4, %xmm5
1103 ; X32-SSE-NEXT: movdqa %xmm5, %xmm6
1104 ; X32-SSE-NEXT: pandn %xmm2, %xmm6
1105 ; X32-SSE-NEXT: psraw $4, %xmm2
1106 ; X32-SSE-NEXT: pand %xmm5, %xmm2
1107 ; X32-SSE-NEXT: por %xmm6, %xmm2
1108 ; X32-SSE-NEXT: paddw %xmm4, %xmm4
1109 ; X32-SSE-NEXT: pxor %xmm5, %xmm5
1110 ; X32-SSE-NEXT: pcmpgtw %xmm4, %xmm5
1111 ; X32-SSE-NEXT: movdqa %xmm5, %xmm6
1112 ; X32-SSE-NEXT: pandn %xmm2, %xmm6
1113 ; X32-SSE-NEXT: psraw $2, %xmm2
1114 ; X32-SSE-NEXT: pand %xmm5, %xmm2
1115 ; X32-SSE-NEXT: por %xmm6, %xmm2
1116 ; X32-SSE-NEXT: paddw %xmm4, %xmm4
1117 ; X32-SSE-NEXT: pxor %xmm5, %xmm5
1118 ; X32-SSE-NEXT: pcmpgtw %xmm4, %xmm5
1119 ; X32-SSE-NEXT: movdqa %xmm5, %xmm4
1120 ; X32-SSE-NEXT: pandn %xmm2, %xmm4
1121 ; X32-SSE-NEXT: psraw $1, %xmm2
1122 ; X32-SSE-NEXT: pand %xmm5, %xmm2
1123 ; X32-SSE-NEXT: por %xmm4, %xmm2
1124 ; X32-SSE-NEXT: psrlw $8, %xmm2
1125 ; X32-SSE-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
1126 ; X32-SSE-NEXT: punpcklbw {{.*#+}} xmm1 = xmm1[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
1127 ; X32-SSE-NEXT: pxor %xmm4, %xmm4
1128 ; X32-SSE-NEXT: pcmpgtw %xmm1, %xmm4
1129 ; X32-SSE-NEXT: movdqa %xmm4, %xmm5
1130 ; X32-SSE-NEXT: pandn %xmm0, %xmm5
1131 ; X32-SSE-NEXT: psraw $4, %xmm0
1132 ; X32-SSE-NEXT: pand %xmm4, %xmm0
1133 ; X32-SSE-NEXT: por %xmm5, %xmm0
1134 ; X32-SSE-NEXT: paddw %xmm1, %xmm1
1135 ; X32-SSE-NEXT: pxor %xmm4, %xmm4
1136 ; X32-SSE-NEXT: pcmpgtw %xmm1, %xmm4
1137 ; X32-SSE-NEXT: movdqa %xmm4, %xmm5
1138 ; X32-SSE-NEXT: pandn %xmm0, %xmm5
1139 ; X32-SSE-NEXT: psraw $2, %xmm0
1140 ; X32-SSE-NEXT: pand %xmm4, %xmm0
1141 ; X32-SSE-NEXT: por %xmm5, %xmm0
1142 ; X32-SSE-NEXT: paddw %xmm1, %xmm1
1143 ; X32-SSE-NEXT: pcmpgtw %xmm1, %xmm3
1144 ; X32-SSE-NEXT: movdqa %xmm3, %xmm1
1145 ; X32-SSE-NEXT: pandn %xmm0, %xmm1
1146 ; X32-SSE-NEXT: psraw $1, %xmm0
1147 ; X32-SSE-NEXT: pand %xmm3, %xmm0
1148 ; X32-SSE-NEXT: por %xmm1, %xmm0
1149 ; X32-SSE-NEXT: psrlw $8, %xmm0
1150 ; X32-SSE-NEXT: packuswb %xmm2, %xmm0
1151 ; X32-SSE-NEXT: retl
1152 %shift = ashr <2 x i8> %a, %b
1157 ; Uniform Variable Shifts
1160 define <2 x i32> @splatvar_shift_v2i32(<2 x i32> %a, <2 x i32> %b) nounwind {
1161 ; SSE2-LABEL: splatvar_shift_v2i32:
1163 ; SSE2-NEXT: xorps %xmm2, %xmm2
1164 ; SSE2-NEXT: movss {{.*#+}} xmm2 = xmm1[0],xmm2[1,2,3]
1165 ; SSE2-NEXT: psrad %xmm2, %xmm0
1168 ; SSE41-LABEL: splatvar_shift_v2i32:
1170 ; SSE41-NEXT: pmovzxdq {{.*#+}} xmm1 = xmm1[0],zero,xmm1[1],zero
1171 ; SSE41-NEXT: psrad %xmm1, %xmm0
1174 ; AVX-LABEL: splatvar_shift_v2i32:
1176 ; AVX-NEXT: vpmovzxdq {{.*#+}} xmm1 = xmm1[0],zero,xmm1[1],zero
1177 ; AVX-NEXT: vpsrad %xmm1, %xmm0, %xmm0
1180 ; XOP-LABEL: splatvar_shift_v2i32:
1182 ; XOP-NEXT: vpmovzxdq {{.*#+}} xmm1 = xmm1[0],zero,xmm1[1],zero
1183 ; XOP-NEXT: vpsrad %xmm1, %xmm0, %xmm0
1186 ; AVX512-LABEL: splatvar_shift_v2i32:
1188 ; AVX512-NEXT: vpmovzxdq {{.*#+}} xmm1 = xmm1[0],zero,xmm1[1],zero
1189 ; AVX512-NEXT: vpsrad %xmm1, %xmm0, %xmm0
1192 ; AVX512VL-LABEL: splatvar_shift_v2i32:
1193 ; AVX512VL: # %bb.0:
1194 ; AVX512VL-NEXT: vpmovzxdq {{.*#+}} xmm1 = xmm1[0],zero,xmm1[1],zero
1195 ; AVX512VL-NEXT: vpsrad %xmm1, %xmm0, %xmm0
1196 ; AVX512VL-NEXT: retq
1198 ; X32-SSE-LABEL: splatvar_shift_v2i32:
1200 ; X32-SSE-NEXT: xorps %xmm2, %xmm2
1201 ; X32-SSE-NEXT: movss {{.*#+}} xmm2 = xmm1[0],xmm2[1,2,3]
1202 ; X32-SSE-NEXT: psrad %xmm2, %xmm0
1203 ; X32-SSE-NEXT: retl
1204 %splat = shufflevector <2 x i32> %b, <2 x i32> undef, <2 x i32> zeroinitializer
1205 %shift = ashr <2 x i32> %a, %splat
1206 ret <2 x i32> %shift
1209 define <4 x i16> @splatvar_shift_v4i16(<4 x i16> %a, <4 x i16> %b) nounwind {
1210 ; SSE2-LABEL: splatvar_shift_v4i16:
1212 ; SSE2-NEXT: pslldq {{.*#+}} xmm1 = zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,xmm1[0,1]
1213 ; SSE2-NEXT: psrldq {{.*#+}} xmm1 = xmm1[14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
1214 ; SSE2-NEXT: psraw %xmm1, %xmm0
1217 ; SSE41-LABEL: splatvar_shift_v4i16:
1219 ; SSE41-NEXT: pmovzxwq {{.*#+}} xmm1 = xmm1[0],zero,zero,zero,xmm1[1],zero,zero,zero
1220 ; SSE41-NEXT: psraw %xmm1, %xmm0
1223 ; AVX-LABEL: splatvar_shift_v4i16:
1225 ; AVX-NEXT: vpmovzxwq {{.*#+}} xmm1 = xmm1[0],zero,zero,zero,xmm1[1],zero,zero,zero
1226 ; AVX-NEXT: vpsraw %xmm1, %xmm0, %xmm0
1229 ; XOP-LABEL: splatvar_shift_v4i16:
1231 ; XOP-NEXT: vpmovzxwq {{.*#+}} xmm1 = xmm1[0],zero,zero,zero,xmm1[1],zero,zero,zero
1232 ; XOP-NEXT: vpsraw %xmm1, %xmm0, %xmm0
1235 ; AVX512-LABEL: splatvar_shift_v4i16:
1237 ; AVX512-NEXT: vpmovzxwq {{.*#+}} xmm1 = xmm1[0],zero,zero,zero,xmm1[1],zero,zero,zero
1238 ; AVX512-NEXT: vpsraw %xmm1, %xmm0, %xmm0
1241 ; AVX512VL-LABEL: splatvar_shift_v4i16:
1242 ; AVX512VL: # %bb.0:
1243 ; AVX512VL-NEXT: vpmovzxwq {{.*#+}} xmm1 = xmm1[0],zero,zero,zero,xmm1[1],zero,zero,zero
1244 ; AVX512VL-NEXT: vpsraw %xmm1, %xmm0, %xmm0
1245 ; AVX512VL-NEXT: retq
1247 ; X32-SSE-LABEL: splatvar_shift_v4i16:
1249 ; X32-SSE-NEXT: pslldq {{.*#+}} xmm1 = zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,xmm1[0,1]
1250 ; X32-SSE-NEXT: psrldq {{.*#+}} xmm1 = xmm1[14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
1251 ; X32-SSE-NEXT: psraw %xmm1, %xmm0
1252 ; X32-SSE-NEXT: retl
1253 %splat = shufflevector <4 x i16> %b, <4 x i16> undef, <4 x i32> zeroinitializer
1254 %shift = ashr <4 x i16> %a, %splat
1255 ret <4 x i16> %shift
1258 define <2 x i16> @splatvar_shift_v2i16(<2 x i16> %a, <2 x i16> %b) nounwind {
1259 ; SSE2-LABEL: splatvar_shift_v2i16:
1261 ; SSE2-NEXT: pslldq {{.*#+}} xmm1 = zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,xmm1[0,1]
1262 ; SSE2-NEXT: psrldq {{.*#+}} xmm1 = xmm1[14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
1263 ; SSE2-NEXT: psraw %xmm1, %xmm0
1266 ; SSE41-LABEL: splatvar_shift_v2i16:
1268 ; SSE41-NEXT: pmovzxwq {{.*#+}} xmm1 = xmm1[0],zero,zero,zero,xmm1[1],zero,zero,zero
1269 ; SSE41-NEXT: psraw %xmm1, %xmm0
1272 ; AVX-LABEL: splatvar_shift_v2i16:
1274 ; AVX-NEXT: vpmovzxwq {{.*#+}} xmm1 = xmm1[0],zero,zero,zero,xmm1[1],zero,zero,zero
1275 ; AVX-NEXT: vpsraw %xmm1, %xmm0, %xmm0
1278 ; XOP-LABEL: splatvar_shift_v2i16:
1280 ; XOP-NEXT: vpmovzxwq {{.*#+}} xmm1 = xmm1[0],zero,zero,zero,xmm1[1],zero,zero,zero
1281 ; XOP-NEXT: vpsraw %xmm1, %xmm0, %xmm0
1284 ; AVX512-LABEL: splatvar_shift_v2i16:
1286 ; AVX512-NEXT: vpmovzxwq {{.*#+}} xmm1 = xmm1[0],zero,zero,zero,xmm1[1],zero,zero,zero
1287 ; AVX512-NEXT: vpsraw %xmm1, %xmm0, %xmm0
1290 ; AVX512VL-LABEL: splatvar_shift_v2i16:
1291 ; AVX512VL: # %bb.0:
1292 ; AVX512VL-NEXT: vpmovzxwq {{.*#+}} xmm1 = xmm1[0],zero,zero,zero,xmm1[1],zero,zero,zero
1293 ; AVX512VL-NEXT: vpsraw %xmm1, %xmm0, %xmm0
1294 ; AVX512VL-NEXT: retq
1296 ; X32-SSE-LABEL: splatvar_shift_v2i16:
1298 ; X32-SSE-NEXT: pslldq {{.*#+}} xmm1 = zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,xmm1[0,1]
1299 ; X32-SSE-NEXT: psrldq {{.*#+}} xmm1 = xmm1[14,15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
1300 ; X32-SSE-NEXT: psraw %xmm1, %xmm0
1301 ; X32-SSE-NEXT: retl
1302 %splat = shufflevector <2 x i16> %b, <2 x i16> undef, <2 x i32> zeroinitializer
1303 %shift = ashr <2 x i16> %a, %splat
1304 ret <2 x i16> %shift
1307 define <8 x i8> @splatvar_shift_v8i8(<8 x i8> %a, <8 x i8> %b) nounwind {
1308 ; SSE2-LABEL: splatvar_shift_v8i8:
1310 ; SSE2-NEXT: pslldq {{.*#+}} xmm1 = zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,xmm1[0]
1311 ; SSE2-NEXT: psrldq {{.*#+}} xmm1 = xmm1[15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
1312 ; SSE2-NEXT: psrlw %xmm1, %xmm0
1313 ; SSE2-NEXT: pcmpeqd %xmm2, %xmm2
1314 ; SSE2-NEXT: psrlw %xmm1, %xmm2
1315 ; SSE2-NEXT: psrlw $8, %xmm2
1316 ; SSE2-NEXT: punpcklbw {{.*#+}} xmm2 = xmm2[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
1317 ; SSE2-NEXT: pshuflw {{.*#+}} xmm2 = xmm2[0,0,2,3,4,5,6,7]
1318 ; SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm2[0,0,0,0]
1319 ; SSE2-NEXT: pand %xmm2, %xmm0
1320 ; SSE2-NEXT: movdqa {{.*#+}} xmm2 = [32896,32896,32896,32896,32896,32896,32896,32896]
1321 ; SSE2-NEXT: psrlw %xmm1, %xmm2
1322 ; SSE2-NEXT: pxor %xmm2, %xmm0
1323 ; SSE2-NEXT: psubb %xmm2, %xmm0
1326 ; SSE41-LABEL: splatvar_shift_v8i8:
1328 ; SSE41-NEXT: pmovzxbq {{.*#+}} xmm1 = xmm1[0],zero,zero,zero,zero,zero,zero,zero,xmm1[1],zero,zero,zero,zero,zero,zero,zero
1329 ; SSE41-NEXT: psrlw %xmm1, %xmm0
1330 ; SSE41-NEXT: pcmpeqd %xmm2, %xmm2
1331 ; SSE41-NEXT: psrlw %xmm1, %xmm2
1332 ; SSE41-NEXT: pshufb {{.*#+}} xmm2 = xmm2[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
1333 ; SSE41-NEXT: pand %xmm2, %xmm0
1334 ; SSE41-NEXT: movdqa {{.*#+}} xmm2 = [32896,32896,32896,32896,32896,32896,32896,32896]
1335 ; SSE41-NEXT: psrlw %xmm1, %xmm2
1336 ; SSE41-NEXT: pxor %xmm2, %xmm0
1337 ; SSE41-NEXT: psubb %xmm2, %xmm0
1340 ; AVX1-LABEL: splatvar_shift_v8i8:
1342 ; AVX1-NEXT: vpmovzxbq {{.*#+}} xmm1 = xmm1[0],zero,zero,zero,zero,zero,zero,zero,xmm1[1],zero,zero,zero,zero,zero,zero,zero
1343 ; AVX1-NEXT: vpsrlw %xmm1, %xmm0, %xmm0
1344 ; AVX1-NEXT: vpcmpeqd %xmm2, %xmm2, %xmm2
1345 ; AVX1-NEXT: vpsrlw %xmm1, %xmm2, %xmm2
1346 ; AVX1-NEXT: vpshufb {{.*#+}} xmm2 = xmm2[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
1347 ; AVX1-NEXT: vpand %xmm2, %xmm0, %xmm0
1348 ; AVX1-NEXT: vmovdqa {{.*#+}} xmm2 = [32896,32896,32896,32896,32896,32896,32896,32896]
1349 ; AVX1-NEXT: vpsrlw %xmm1, %xmm2, %xmm1
1350 ; AVX1-NEXT: vpxor %xmm1, %xmm0, %xmm0
1351 ; AVX1-NEXT: vpsubb %xmm1, %xmm0, %xmm0
1354 ; AVX2-LABEL: splatvar_shift_v8i8:
1356 ; AVX2-NEXT: vpmovzxbq {{.*#+}} xmm1 = xmm1[0],zero,zero,zero,zero,zero,zero,zero,xmm1[1],zero,zero,zero,zero,zero,zero,zero
1357 ; AVX2-NEXT: vpsrlw %xmm1, %xmm0, %xmm0
1358 ; AVX2-NEXT: vpcmpeqd %xmm2, %xmm2, %xmm2
1359 ; AVX2-NEXT: vpsrlw %xmm1, %xmm2, %xmm2
1360 ; AVX2-NEXT: vpsrlw $8, %xmm2, %xmm2
1361 ; AVX2-NEXT: vpbroadcastb %xmm2, %xmm2
1362 ; AVX2-NEXT: vpand %xmm2, %xmm0, %xmm0
1363 ; AVX2-NEXT: vmovdqa {{.*#+}} xmm2 = [32896,32896,32896,32896,32896,32896,32896,32896]
1364 ; AVX2-NEXT: vpsrlw %xmm1, %xmm2, %xmm1
1365 ; AVX2-NEXT: vpxor %xmm1, %xmm0, %xmm0
1366 ; AVX2-NEXT: vpsubb %xmm1, %xmm0, %xmm0
1369 ; XOPAVX1-LABEL: splatvar_shift_v8i8:
1371 ; XOPAVX1-NEXT: vpunpcklbw {{.*#+}} xmm1 = xmm1[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
1372 ; XOPAVX1-NEXT: vpshuflw {{.*#+}} xmm1 = xmm1[0,0,0,0,4,5,6,7]
1373 ; XOPAVX1-NEXT: vpxor %xmm2, %xmm2, %xmm2
1374 ; XOPAVX1-NEXT: vpsubb %xmm1, %xmm2, %xmm1
1375 ; XOPAVX1-NEXT: vpshab %xmm1, %xmm0, %xmm0
1376 ; XOPAVX1-NEXT: retq
1378 ; XOPAVX2-LABEL: splatvar_shift_v8i8:
1380 ; XOPAVX2-NEXT: vpbroadcastb %xmm1, %xmm1
1381 ; XOPAVX2-NEXT: vpxor %xmm2, %xmm2, %xmm2
1382 ; XOPAVX2-NEXT: vpsubb %xmm1, %xmm2, %xmm1
1383 ; XOPAVX2-NEXT: vpshab %xmm1, %xmm0, %xmm0
1384 ; XOPAVX2-NEXT: retq
1386 ; AVX512DQ-LABEL: splatvar_shift_v8i8:
1387 ; AVX512DQ: # %bb.0:
1388 ; AVX512DQ-NEXT: vpbroadcastb %xmm1, %xmm1
1389 ; AVX512DQ-NEXT: vpmovsxbd %xmm0, %zmm0
1390 ; AVX512DQ-NEXT: vpmovzxbd {{.*#+}} zmm1 = xmm1[0],zero,zero,zero,xmm1[1],zero,zero,zero,xmm1[2],zero,zero,zero,xmm1[3],zero,zero,zero,xmm1[4],zero,zero,zero,xmm1[5],zero,zero,zero,xmm1[6],zero,zero,zero,xmm1[7],zero,zero,zero,xmm1[8],zero,zero,zero,xmm1[9],zero,zero,zero,xmm1[10],zero,zero,zero,xmm1[11],zero,zero,zero,xmm1[12],zero,zero,zero,xmm1[13],zero,zero,zero,xmm1[14],zero,zero,zero,xmm1[15],zero,zero,zero
1391 ; AVX512DQ-NEXT: vpsravd %zmm1, %zmm0, %zmm0
1392 ; AVX512DQ-NEXT: vpmovdb %zmm0, %xmm0
1393 ; AVX512DQ-NEXT: vzeroupper
1394 ; AVX512DQ-NEXT: retq
1396 ; AVX512BW-LABEL: splatvar_shift_v8i8:
1397 ; AVX512BW: # %bb.0:
1398 ; AVX512BW-NEXT: vpbroadcastb %xmm1, %xmm1
1399 ; AVX512BW-NEXT: vpmovsxbw %xmm0, %ymm0
1400 ; AVX512BW-NEXT: vpmovzxbw {{.*#+}} 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,xmm1[8],zero,xmm1[9],zero,xmm1[10],zero,xmm1[11],zero,xmm1[12],zero,xmm1[13],zero,xmm1[14],zero,xmm1[15],zero
1401 ; AVX512BW-NEXT: vpsravw %zmm1, %zmm0, %zmm0
1402 ; AVX512BW-NEXT: vpmovwb %zmm0, %ymm0
1403 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 killed $ymm0
1404 ; AVX512BW-NEXT: vzeroupper
1405 ; AVX512BW-NEXT: retq
1407 ; AVX512DQVL-LABEL: splatvar_shift_v8i8:
1408 ; AVX512DQVL: # %bb.0:
1409 ; AVX512DQVL-NEXT: vpbroadcastb %xmm1, %xmm1
1410 ; AVX512DQVL-NEXT: vpmovsxbd %xmm0, %zmm0
1411 ; AVX512DQVL-NEXT: vpmovzxbd {{.*#+}} zmm1 = xmm1[0],zero,zero,zero,xmm1[1],zero,zero,zero,xmm1[2],zero,zero,zero,xmm1[3],zero,zero,zero,xmm1[4],zero,zero,zero,xmm1[5],zero,zero,zero,xmm1[6],zero,zero,zero,xmm1[7],zero,zero,zero,xmm1[8],zero,zero,zero,xmm1[9],zero,zero,zero,xmm1[10],zero,zero,zero,xmm1[11],zero,zero,zero,xmm1[12],zero,zero,zero,xmm1[13],zero,zero,zero,xmm1[14],zero,zero,zero,xmm1[15],zero,zero,zero
1412 ; AVX512DQVL-NEXT: vpsravd %zmm1, %zmm0, %zmm0
1413 ; AVX512DQVL-NEXT: vpmovdb %zmm0, %xmm0
1414 ; AVX512DQVL-NEXT: vzeroupper
1415 ; AVX512DQVL-NEXT: retq
1417 ; AVX512BWVL-LABEL: splatvar_shift_v8i8:
1418 ; AVX512BWVL: # %bb.0:
1419 ; AVX512BWVL-NEXT: vpbroadcastb %xmm1, %xmm1
1420 ; AVX512BWVL-NEXT: vpmovsxbw %xmm0, %ymm0
1421 ; AVX512BWVL-NEXT: vpmovzxbw {{.*#+}} 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,xmm1[8],zero,xmm1[9],zero,xmm1[10],zero,xmm1[11],zero,xmm1[12],zero,xmm1[13],zero,xmm1[14],zero,xmm1[15],zero
1422 ; AVX512BWVL-NEXT: vpsravw %ymm1, %ymm0, %ymm0
1423 ; AVX512BWVL-NEXT: vpmovwb %ymm0, %xmm0
1424 ; AVX512BWVL-NEXT: vzeroupper
1425 ; AVX512BWVL-NEXT: retq
1427 ; X32-SSE-LABEL: splatvar_shift_v8i8:
1429 ; X32-SSE-NEXT: pslldq {{.*#+}} xmm1 = zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,xmm1[0]
1430 ; X32-SSE-NEXT: psrldq {{.*#+}} xmm1 = xmm1[15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
1431 ; X32-SSE-NEXT: psrlw %xmm1, %xmm0
1432 ; X32-SSE-NEXT: pcmpeqd %xmm2, %xmm2
1433 ; X32-SSE-NEXT: psrlw %xmm1, %xmm2
1434 ; X32-SSE-NEXT: psrlw $8, %xmm2
1435 ; X32-SSE-NEXT: punpcklbw {{.*#+}} xmm2 = xmm2[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
1436 ; X32-SSE-NEXT: pshuflw {{.*#+}} xmm2 = xmm2[0,0,2,3,4,5,6,7]
1437 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm2 = xmm2[0,0,0,0]
1438 ; X32-SSE-NEXT: pand %xmm2, %xmm0
1439 ; X32-SSE-NEXT: movdqa {{.*#+}} xmm2 = [32896,32896,32896,32896,32896,32896,32896,32896]
1440 ; X32-SSE-NEXT: psrlw %xmm1, %xmm2
1441 ; X32-SSE-NEXT: pxor %xmm2, %xmm0
1442 ; X32-SSE-NEXT: psubb %xmm2, %xmm0
1443 ; X32-SSE-NEXT: retl
1444 %splat = shufflevector <8 x i8> %b, <8 x i8> undef, <8 x i32> zeroinitializer
1445 %shift = ashr <8 x i8> %a, %splat
1449 define <4 x i8> @splatvar_shift_v4i8(<4 x i8> %a, <4 x i8> %b) nounwind {
1450 ; SSE2-LABEL: splatvar_shift_v4i8:
1452 ; SSE2-NEXT: pslldq {{.*#+}} xmm1 = zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,xmm1[0]
1453 ; SSE2-NEXT: psrldq {{.*#+}} xmm1 = xmm1[15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
1454 ; SSE2-NEXT: psrlw %xmm1, %xmm0
1455 ; SSE2-NEXT: pcmpeqd %xmm2, %xmm2
1456 ; SSE2-NEXT: psrlw %xmm1, %xmm2
1457 ; SSE2-NEXT: psrlw $8, %xmm2
1458 ; SSE2-NEXT: punpcklbw {{.*#+}} xmm2 = xmm2[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
1459 ; SSE2-NEXT: pshuflw {{.*#+}} xmm2 = xmm2[0,0,2,3,4,5,6,7]
1460 ; SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm2[0,0,0,0]
1461 ; SSE2-NEXT: pand %xmm2, %xmm0
1462 ; SSE2-NEXT: movdqa {{.*#+}} xmm2 = [32896,32896,32896,32896,32896,32896,32896,32896]
1463 ; SSE2-NEXT: psrlw %xmm1, %xmm2
1464 ; SSE2-NEXT: pxor %xmm2, %xmm0
1465 ; SSE2-NEXT: psubb %xmm2, %xmm0
1468 ; SSE41-LABEL: splatvar_shift_v4i8:
1470 ; SSE41-NEXT: pmovzxbq {{.*#+}} xmm1 = xmm1[0],zero,zero,zero,zero,zero,zero,zero,xmm1[1],zero,zero,zero,zero,zero,zero,zero
1471 ; SSE41-NEXT: psrlw %xmm1, %xmm0
1472 ; SSE41-NEXT: pcmpeqd %xmm2, %xmm2
1473 ; SSE41-NEXT: psrlw %xmm1, %xmm2
1474 ; SSE41-NEXT: pshufb {{.*#+}} xmm2 = xmm2[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
1475 ; SSE41-NEXT: pand %xmm2, %xmm0
1476 ; SSE41-NEXT: movdqa {{.*#+}} xmm2 = [32896,32896,32896,32896,32896,32896,32896,32896]
1477 ; SSE41-NEXT: psrlw %xmm1, %xmm2
1478 ; SSE41-NEXT: pxor %xmm2, %xmm0
1479 ; SSE41-NEXT: psubb %xmm2, %xmm0
1482 ; AVX1-LABEL: splatvar_shift_v4i8:
1484 ; AVX1-NEXT: vpmovzxbq {{.*#+}} xmm1 = xmm1[0],zero,zero,zero,zero,zero,zero,zero,xmm1[1],zero,zero,zero,zero,zero,zero,zero
1485 ; AVX1-NEXT: vpsrlw %xmm1, %xmm0, %xmm0
1486 ; AVX1-NEXT: vpcmpeqd %xmm2, %xmm2, %xmm2
1487 ; AVX1-NEXT: vpsrlw %xmm1, %xmm2, %xmm2
1488 ; AVX1-NEXT: vpshufb {{.*#+}} xmm2 = xmm2[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
1489 ; AVX1-NEXT: vpand %xmm2, %xmm0, %xmm0
1490 ; AVX1-NEXT: vmovdqa {{.*#+}} xmm2 = [32896,32896,32896,32896,32896,32896,32896,32896]
1491 ; AVX1-NEXT: vpsrlw %xmm1, %xmm2, %xmm1
1492 ; AVX1-NEXT: vpxor %xmm1, %xmm0, %xmm0
1493 ; AVX1-NEXT: vpsubb %xmm1, %xmm0, %xmm0
1496 ; AVX2-LABEL: splatvar_shift_v4i8:
1498 ; AVX2-NEXT: vpmovzxbq {{.*#+}} xmm1 = xmm1[0],zero,zero,zero,zero,zero,zero,zero,xmm1[1],zero,zero,zero,zero,zero,zero,zero
1499 ; AVX2-NEXT: vpsrlw %xmm1, %xmm0, %xmm0
1500 ; AVX2-NEXT: vpcmpeqd %xmm2, %xmm2, %xmm2
1501 ; AVX2-NEXT: vpsrlw %xmm1, %xmm2, %xmm2
1502 ; AVX2-NEXT: vpsrlw $8, %xmm2, %xmm2
1503 ; AVX2-NEXT: vpbroadcastb %xmm2, %xmm2
1504 ; AVX2-NEXT: vpand %xmm2, %xmm0, %xmm0
1505 ; AVX2-NEXT: vmovdqa {{.*#+}} xmm2 = [32896,32896,32896,32896,32896,32896,32896,32896]
1506 ; AVX2-NEXT: vpsrlw %xmm1, %xmm2, %xmm1
1507 ; AVX2-NEXT: vpxor %xmm1, %xmm0, %xmm0
1508 ; AVX2-NEXT: vpsubb %xmm1, %xmm0, %xmm0
1511 ; XOPAVX1-LABEL: splatvar_shift_v4i8:
1513 ; XOPAVX1-NEXT: vpunpcklbw {{.*#+}} xmm1 = xmm1[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
1514 ; XOPAVX1-NEXT: vpshuflw {{.*#+}} xmm1 = xmm1[0,0,2,3,4,5,6,7]
1515 ; XOPAVX1-NEXT: vpxor %xmm2, %xmm2, %xmm2
1516 ; XOPAVX1-NEXT: vpsubb %xmm1, %xmm2, %xmm1
1517 ; XOPAVX1-NEXT: vpshab %xmm1, %xmm0, %xmm0
1518 ; XOPAVX1-NEXT: retq
1520 ; XOPAVX2-LABEL: splatvar_shift_v4i8:
1522 ; XOPAVX2-NEXT: vpbroadcastb %xmm1, %xmm1
1523 ; XOPAVX2-NEXT: vpxor %xmm2, %xmm2, %xmm2
1524 ; XOPAVX2-NEXT: vpsubb %xmm1, %xmm2, %xmm1
1525 ; XOPAVX2-NEXT: vpshab %xmm1, %xmm0, %xmm0
1526 ; XOPAVX2-NEXT: retq
1528 ; AVX512DQ-LABEL: splatvar_shift_v4i8:
1529 ; AVX512DQ: # %bb.0:
1530 ; AVX512DQ-NEXT: vpbroadcastb %xmm1, %xmm1
1531 ; AVX512DQ-NEXT: vpmovsxbd %xmm0, %zmm0
1532 ; AVX512DQ-NEXT: vpmovzxbd {{.*#+}} zmm1 = xmm1[0],zero,zero,zero,xmm1[1],zero,zero,zero,xmm1[2],zero,zero,zero,xmm1[3],zero,zero,zero,xmm1[4],zero,zero,zero,xmm1[5],zero,zero,zero,xmm1[6],zero,zero,zero,xmm1[7],zero,zero,zero,xmm1[8],zero,zero,zero,xmm1[9],zero,zero,zero,xmm1[10],zero,zero,zero,xmm1[11],zero,zero,zero,xmm1[12],zero,zero,zero,xmm1[13],zero,zero,zero,xmm1[14],zero,zero,zero,xmm1[15],zero,zero,zero
1533 ; AVX512DQ-NEXT: vpsravd %zmm1, %zmm0, %zmm0
1534 ; AVX512DQ-NEXT: vpmovdb %zmm0, %xmm0
1535 ; AVX512DQ-NEXT: vzeroupper
1536 ; AVX512DQ-NEXT: retq
1538 ; AVX512BW-LABEL: splatvar_shift_v4i8:
1539 ; AVX512BW: # %bb.0:
1540 ; AVX512BW-NEXT: vpbroadcastb %xmm1, %xmm1
1541 ; AVX512BW-NEXT: vpmovsxbw %xmm0, %ymm0
1542 ; AVX512BW-NEXT: vpmovzxbw {{.*#+}} 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,xmm1[8],zero,xmm1[9],zero,xmm1[10],zero,xmm1[11],zero,xmm1[12],zero,xmm1[13],zero,xmm1[14],zero,xmm1[15],zero
1543 ; AVX512BW-NEXT: vpsravw %zmm1, %zmm0, %zmm0
1544 ; AVX512BW-NEXT: vpmovwb %zmm0, %ymm0
1545 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 killed $ymm0
1546 ; AVX512BW-NEXT: vzeroupper
1547 ; AVX512BW-NEXT: retq
1549 ; AVX512DQVL-LABEL: splatvar_shift_v4i8:
1550 ; AVX512DQVL: # %bb.0:
1551 ; AVX512DQVL-NEXT: vpbroadcastb %xmm1, %xmm1
1552 ; AVX512DQVL-NEXT: vpmovsxbd %xmm0, %zmm0
1553 ; AVX512DQVL-NEXT: vpmovzxbd {{.*#+}} zmm1 = xmm1[0],zero,zero,zero,xmm1[1],zero,zero,zero,xmm1[2],zero,zero,zero,xmm1[3],zero,zero,zero,xmm1[4],zero,zero,zero,xmm1[5],zero,zero,zero,xmm1[6],zero,zero,zero,xmm1[7],zero,zero,zero,xmm1[8],zero,zero,zero,xmm1[9],zero,zero,zero,xmm1[10],zero,zero,zero,xmm1[11],zero,zero,zero,xmm1[12],zero,zero,zero,xmm1[13],zero,zero,zero,xmm1[14],zero,zero,zero,xmm1[15],zero,zero,zero
1554 ; AVX512DQVL-NEXT: vpsravd %zmm1, %zmm0, %zmm0
1555 ; AVX512DQVL-NEXT: vpmovdb %zmm0, %xmm0
1556 ; AVX512DQVL-NEXT: vzeroupper
1557 ; AVX512DQVL-NEXT: retq
1559 ; AVX512BWVL-LABEL: splatvar_shift_v4i8:
1560 ; AVX512BWVL: # %bb.0:
1561 ; AVX512BWVL-NEXT: vpbroadcastb %xmm1, %xmm1
1562 ; AVX512BWVL-NEXT: vpmovsxbw %xmm0, %ymm0
1563 ; AVX512BWVL-NEXT: vpmovzxbw {{.*#+}} 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,xmm1[8],zero,xmm1[9],zero,xmm1[10],zero,xmm1[11],zero,xmm1[12],zero,xmm1[13],zero,xmm1[14],zero,xmm1[15],zero
1564 ; AVX512BWVL-NEXT: vpsravw %ymm1, %ymm0, %ymm0
1565 ; AVX512BWVL-NEXT: vpmovwb %ymm0, %xmm0
1566 ; AVX512BWVL-NEXT: vzeroupper
1567 ; AVX512BWVL-NEXT: retq
1569 ; X32-SSE-LABEL: splatvar_shift_v4i8:
1571 ; X32-SSE-NEXT: pslldq {{.*#+}} xmm1 = zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,xmm1[0]
1572 ; X32-SSE-NEXT: psrldq {{.*#+}} xmm1 = xmm1[15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
1573 ; X32-SSE-NEXT: psrlw %xmm1, %xmm0
1574 ; X32-SSE-NEXT: pcmpeqd %xmm2, %xmm2
1575 ; X32-SSE-NEXT: psrlw %xmm1, %xmm2
1576 ; X32-SSE-NEXT: psrlw $8, %xmm2
1577 ; X32-SSE-NEXT: punpcklbw {{.*#+}} xmm2 = xmm2[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
1578 ; X32-SSE-NEXT: pshuflw {{.*#+}} xmm2 = xmm2[0,0,2,3,4,5,6,7]
1579 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm2 = xmm2[0,0,0,0]
1580 ; X32-SSE-NEXT: pand %xmm2, %xmm0
1581 ; X32-SSE-NEXT: movdqa {{.*#+}} xmm2 = [32896,32896,32896,32896,32896,32896,32896,32896]
1582 ; X32-SSE-NEXT: psrlw %xmm1, %xmm2
1583 ; X32-SSE-NEXT: pxor %xmm2, %xmm0
1584 ; X32-SSE-NEXT: psubb %xmm2, %xmm0
1585 ; X32-SSE-NEXT: retl
1586 %splat = shufflevector <4 x i8> %b, <4 x i8> undef, <4 x i32> zeroinitializer
1587 %shift = ashr <4 x i8> %a, %splat
1591 define <2 x i8> @splatvar_shift_v2i8(<2 x i8> %a, <2 x i8> %b) nounwind {
1592 ; SSE2-LABEL: splatvar_shift_v2i8:
1594 ; SSE2-NEXT: pslldq {{.*#+}} xmm1 = zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,xmm1[0]
1595 ; SSE2-NEXT: psrldq {{.*#+}} xmm1 = xmm1[15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
1596 ; SSE2-NEXT: psrlw %xmm1, %xmm0
1597 ; SSE2-NEXT: pcmpeqd %xmm2, %xmm2
1598 ; SSE2-NEXT: psrlw %xmm1, %xmm2
1599 ; SSE2-NEXT: psrlw $8, %xmm2
1600 ; SSE2-NEXT: punpcklbw {{.*#+}} xmm2 = xmm2[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
1601 ; SSE2-NEXT: pshuflw {{.*#+}} xmm2 = xmm2[0,0,2,3,4,5,6,7]
1602 ; SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm2[0,0,0,0]
1603 ; SSE2-NEXT: pand %xmm2, %xmm0
1604 ; SSE2-NEXT: movdqa {{.*#+}} xmm2 = [32896,32896,32896,32896,32896,32896,32896,32896]
1605 ; SSE2-NEXT: psrlw %xmm1, %xmm2
1606 ; SSE2-NEXT: pxor %xmm2, %xmm0
1607 ; SSE2-NEXT: psubb %xmm2, %xmm0
1610 ; SSE41-LABEL: splatvar_shift_v2i8:
1612 ; SSE41-NEXT: pmovzxbq {{.*#+}} xmm1 = xmm1[0],zero,zero,zero,zero,zero,zero,zero,xmm1[1],zero,zero,zero,zero,zero,zero,zero
1613 ; SSE41-NEXT: psrlw %xmm1, %xmm0
1614 ; SSE41-NEXT: pcmpeqd %xmm2, %xmm2
1615 ; SSE41-NEXT: psrlw %xmm1, %xmm2
1616 ; SSE41-NEXT: pshufb {{.*#+}} xmm2 = xmm2[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
1617 ; SSE41-NEXT: pand %xmm2, %xmm0
1618 ; SSE41-NEXT: movdqa {{.*#+}} xmm2 = [32896,32896,32896,32896,32896,32896,32896,32896]
1619 ; SSE41-NEXT: psrlw %xmm1, %xmm2
1620 ; SSE41-NEXT: pxor %xmm2, %xmm0
1621 ; SSE41-NEXT: psubb %xmm2, %xmm0
1624 ; AVX1-LABEL: splatvar_shift_v2i8:
1626 ; AVX1-NEXT: vpmovzxbq {{.*#+}} xmm1 = xmm1[0],zero,zero,zero,zero,zero,zero,zero,xmm1[1],zero,zero,zero,zero,zero,zero,zero
1627 ; AVX1-NEXT: vpsrlw %xmm1, %xmm0, %xmm0
1628 ; AVX1-NEXT: vpcmpeqd %xmm2, %xmm2, %xmm2
1629 ; AVX1-NEXT: vpsrlw %xmm1, %xmm2, %xmm2
1630 ; AVX1-NEXT: vpshufb {{.*#+}} xmm2 = xmm2[1,1,1,1,1,1,1,1,1,1,1,1,1,1,1,1]
1631 ; AVX1-NEXT: vpand %xmm2, %xmm0, %xmm0
1632 ; AVX1-NEXT: vmovdqa {{.*#+}} xmm2 = [32896,32896,32896,32896,32896,32896,32896,32896]
1633 ; AVX1-NEXT: vpsrlw %xmm1, %xmm2, %xmm1
1634 ; AVX1-NEXT: vpxor %xmm1, %xmm0, %xmm0
1635 ; AVX1-NEXT: vpsubb %xmm1, %xmm0, %xmm0
1638 ; AVX2-LABEL: splatvar_shift_v2i8:
1640 ; AVX2-NEXT: vpmovzxbq {{.*#+}} xmm1 = xmm1[0],zero,zero,zero,zero,zero,zero,zero,xmm1[1],zero,zero,zero,zero,zero,zero,zero
1641 ; AVX2-NEXT: vpsrlw %xmm1, %xmm0, %xmm0
1642 ; AVX2-NEXT: vpcmpeqd %xmm2, %xmm2, %xmm2
1643 ; AVX2-NEXT: vpsrlw %xmm1, %xmm2, %xmm2
1644 ; AVX2-NEXT: vpsrlw $8, %xmm2, %xmm2
1645 ; AVX2-NEXT: vpbroadcastb %xmm2, %xmm2
1646 ; AVX2-NEXT: vpand %xmm2, %xmm0, %xmm0
1647 ; AVX2-NEXT: vmovdqa {{.*#+}} xmm2 = [32896,32896,32896,32896,32896,32896,32896,32896]
1648 ; AVX2-NEXT: vpsrlw %xmm1, %xmm2, %xmm1
1649 ; AVX2-NEXT: vpxor %xmm1, %xmm0, %xmm0
1650 ; AVX2-NEXT: vpsubb %xmm1, %xmm0, %xmm0
1653 ; XOP-LABEL: splatvar_shift_v2i8:
1655 ; XOP-NEXT: insertq {{.*#+}} xmm1 = xmm1[0,0,2,3,4,5,6,7,u,u,u,u,u,u,u,u]
1656 ; XOP-NEXT: vpxor %xmm2, %xmm2, %xmm2
1657 ; XOP-NEXT: vpsubb %xmm1, %xmm2, %xmm1
1658 ; XOP-NEXT: vpshab %xmm1, %xmm0, %xmm0
1661 ; AVX512DQ-LABEL: splatvar_shift_v2i8:
1662 ; AVX512DQ: # %bb.0:
1663 ; AVX512DQ-NEXT: vpbroadcastb %xmm1, %xmm1
1664 ; AVX512DQ-NEXT: vpmovsxbd %xmm0, %zmm0
1665 ; AVX512DQ-NEXT: vpmovzxbd {{.*#+}} zmm1 = xmm1[0],zero,zero,zero,xmm1[1],zero,zero,zero,xmm1[2],zero,zero,zero,xmm1[3],zero,zero,zero,xmm1[4],zero,zero,zero,xmm1[5],zero,zero,zero,xmm1[6],zero,zero,zero,xmm1[7],zero,zero,zero,xmm1[8],zero,zero,zero,xmm1[9],zero,zero,zero,xmm1[10],zero,zero,zero,xmm1[11],zero,zero,zero,xmm1[12],zero,zero,zero,xmm1[13],zero,zero,zero,xmm1[14],zero,zero,zero,xmm1[15],zero,zero,zero
1666 ; AVX512DQ-NEXT: vpsravd %zmm1, %zmm0, %zmm0
1667 ; AVX512DQ-NEXT: vpmovdb %zmm0, %xmm0
1668 ; AVX512DQ-NEXT: vzeroupper
1669 ; AVX512DQ-NEXT: retq
1671 ; AVX512BW-LABEL: splatvar_shift_v2i8:
1672 ; AVX512BW: # %bb.0:
1673 ; AVX512BW-NEXT: vpbroadcastb %xmm1, %xmm1
1674 ; AVX512BW-NEXT: vpmovsxbw %xmm0, %ymm0
1675 ; AVX512BW-NEXT: vpmovzxbw {{.*#+}} 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,xmm1[8],zero,xmm1[9],zero,xmm1[10],zero,xmm1[11],zero,xmm1[12],zero,xmm1[13],zero,xmm1[14],zero,xmm1[15],zero
1676 ; AVX512BW-NEXT: vpsravw %zmm1, %zmm0, %zmm0
1677 ; AVX512BW-NEXT: vpmovwb %zmm0, %ymm0
1678 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 killed $ymm0
1679 ; AVX512BW-NEXT: vzeroupper
1680 ; AVX512BW-NEXT: retq
1682 ; AVX512DQVL-LABEL: splatvar_shift_v2i8:
1683 ; AVX512DQVL: # %bb.0:
1684 ; AVX512DQVL-NEXT: vpbroadcastb %xmm1, %xmm1
1685 ; AVX512DQVL-NEXT: vpmovsxbd %xmm0, %zmm0
1686 ; AVX512DQVL-NEXT: vpmovzxbd {{.*#+}} zmm1 = xmm1[0],zero,zero,zero,xmm1[1],zero,zero,zero,xmm1[2],zero,zero,zero,xmm1[3],zero,zero,zero,xmm1[4],zero,zero,zero,xmm1[5],zero,zero,zero,xmm1[6],zero,zero,zero,xmm1[7],zero,zero,zero,xmm1[8],zero,zero,zero,xmm1[9],zero,zero,zero,xmm1[10],zero,zero,zero,xmm1[11],zero,zero,zero,xmm1[12],zero,zero,zero,xmm1[13],zero,zero,zero,xmm1[14],zero,zero,zero,xmm1[15],zero,zero,zero
1687 ; AVX512DQVL-NEXT: vpsravd %zmm1, %zmm0, %zmm0
1688 ; AVX512DQVL-NEXT: vpmovdb %zmm0, %xmm0
1689 ; AVX512DQVL-NEXT: vzeroupper
1690 ; AVX512DQVL-NEXT: retq
1692 ; AVX512BWVL-LABEL: splatvar_shift_v2i8:
1693 ; AVX512BWVL: # %bb.0:
1694 ; AVX512BWVL-NEXT: vpbroadcastb %xmm1, %xmm1
1695 ; AVX512BWVL-NEXT: vpmovsxbw %xmm0, %ymm0
1696 ; AVX512BWVL-NEXT: vpmovzxbw {{.*#+}} 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,xmm1[8],zero,xmm1[9],zero,xmm1[10],zero,xmm1[11],zero,xmm1[12],zero,xmm1[13],zero,xmm1[14],zero,xmm1[15],zero
1697 ; AVX512BWVL-NEXT: vpsravw %ymm1, %ymm0, %ymm0
1698 ; AVX512BWVL-NEXT: vpmovwb %ymm0, %xmm0
1699 ; AVX512BWVL-NEXT: vzeroupper
1700 ; AVX512BWVL-NEXT: retq
1702 ; X32-SSE-LABEL: splatvar_shift_v2i8:
1704 ; X32-SSE-NEXT: pslldq {{.*#+}} xmm1 = zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,xmm1[0]
1705 ; X32-SSE-NEXT: psrldq {{.*#+}} xmm1 = xmm1[15],zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero,zero
1706 ; X32-SSE-NEXT: psrlw %xmm1, %xmm0
1707 ; X32-SSE-NEXT: pcmpeqd %xmm2, %xmm2
1708 ; X32-SSE-NEXT: psrlw %xmm1, %xmm2
1709 ; X32-SSE-NEXT: psrlw $8, %xmm2
1710 ; X32-SSE-NEXT: punpcklbw {{.*#+}} xmm2 = xmm2[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
1711 ; X32-SSE-NEXT: pshuflw {{.*#+}} xmm2 = xmm2[0,0,2,3,4,5,6,7]
1712 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm2 = xmm2[0,0,0,0]
1713 ; X32-SSE-NEXT: pand %xmm2, %xmm0
1714 ; X32-SSE-NEXT: movdqa {{.*#+}} xmm2 = [32896,32896,32896,32896,32896,32896,32896,32896]
1715 ; X32-SSE-NEXT: psrlw %xmm1, %xmm2
1716 ; X32-SSE-NEXT: pxor %xmm2, %xmm0
1717 ; X32-SSE-NEXT: psubb %xmm2, %xmm0
1718 ; X32-SSE-NEXT: retl
1719 %splat = shufflevector <2 x i8> %b, <2 x i8> undef, <2 x i32> zeroinitializer
1720 %shift = ashr <2 x i8> %a, %splat
1728 define <2 x i32> @constant_shift_v2i32(<2 x i32> %a) nounwind {
1729 ; SSE2-LABEL: constant_shift_v2i32:
1731 ; SSE2-NEXT: movdqa %xmm0, %xmm1
1732 ; SSE2-NEXT: psrad $4, %xmm1
1733 ; SSE2-NEXT: psrad $5, %xmm0
1734 ; SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
1735 ; SSE2-NEXT: punpckldq {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
1736 ; SSE2-NEXT: movdqa %xmm1, %xmm0
1739 ; SSE41-LABEL: constant_shift_v2i32:
1741 ; SSE41-NEXT: movdqa %xmm0, %xmm1
1742 ; SSE41-NEXT: psrad $5, %xmm1
1743 ; SSE41-NEXT: psrad $4, %xmm0
1744 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm0[0,1],xmm1[2,3],xmm0[4,5,6,7]
1747 ; AVX1-LABEL: constant_shift_v2i32:
1749 ; AVX1-NEXT: vpsrad $5, %xmm0, %xmm1
1750 ; AVX1-NEXT: vpsrad $4, %xmm0, %xmm0
1751 ; AVX1-NEXT: vpblendw {{.*#+}} xmm0 = xmm0[0,1],xmm1[2,3],xmm0[4,5,6,7]
1754 ; AVX2-LABEL: constant_shift_v2i32:
1756 ; AVX2-NEXT: vpsravd {{.*}}(%rip), %xmm0, %xmm0
1759 ; XOPAVX1-LABEL: constant_shift_v2i32:
1761 ; XOPAVX1-NEXT: vpshad {{.*}}(%rip), %xmm0, %xmm0
1762 ; XOPAVX1-NEXT: retq
1764 ; XOPAVX2-LABEL: constant_shift_v2i32:
1766 ; XOPAVX2-NEXT: vpsravd {{.*}}(%rip), %xmm0, %xmm0
1767 ; XOPAVX2-NEXT: retq
1769 ; AVX512-LABEL: constant_shift_v2i32:
1771 ; AVX512-NEXT: vpsravd {{.*}}(%rip), %xmm0, %xmm0
1774 ; AVX512VL-LABEL: constant_shift_v2i32:
1775 ; AVX512VL: # %bb.0:
1776 ; AVX512VL-NEXT: vpsravd {{.*}}(%rip), %xmm0, %xmm0
1777 ; AVX512VL-NEXT: retq
1779 ; X32-SSE-LABEL: constant_shift_v2i32:
1781 ; X32-SSE-NEXT: movdqa %xmm0, %xmm1
1782 ; X32-SSE-NEXT: psrad $4, %xmm1
1783 ; X32-SSE-NEXT: psrad $5, %xmm0
1784 ; X32-SSE-NEXT: pshufd {{.*#+}} xmm0 = xmm0[1,1,2,3]
1785 ; X32-SSE-NEXT: punpckldq {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
1786 ; X32-SSE-NEXT: movdqa %xmm1, %xmm0
1787 ; X32-SSE-NEXT: retl
1788 %shift = ashr <2 x i32> %a, <i32 4, i32 5>
1789 ret <2 x i32> %shift
1792 define <4 x i16> @constant_shift_v4i16(<4 x i16> %a) nounwind {
1793 ; SSE2-LABEL: constant_shift_v4i16:
1795 ; SSE2-NEXT: movdqa %xmm0, %xmm1
1796 ; SSE2-NEXT: psraw $2, %xmm1
1797 ; SSE2-NEXT: shufps {{.*#+}} xmm1 = xmm1[1,0],xmm0[0,0]
1798 ; SSE2-NEXT: shufps {{.*#+}} xmm1 = xmm1[2,0],xmm0[2,3]
1799 ; SSE2-NEXT: movaps {{.*#+}} xmm2 = [65535,0,65535,0,65535,65535,65535,65535]
1800 ; SSE2-NEXT: movaps %xmm1, %xmm0
1801 ; SSE2-NEXT: andps %xmm2, %xmm0
1802 ; SSE2-NEXT: psraw $1, %xmm1
1803 ; SSE2-NEXT: andnps %xmm1, %xmm2
1804 ; SSE2-NEXT: orps %xmm2, %xmm0
1807 ; SSE41-LABEL: constant_shift_v4i16:
1809 ; SSE41-NEXT: movdqa {{.*#+}} xmm1 = <u,32768,16384,8192,u,u,u,u>
1810 ; SSE41-NEXT: pmulhw %xmm0, %xmm1
1811 ; SSE41-NEXT: pblendw {{.*#+}} xmm1 = xmm0[0],xmm1[1,2,3,4,5,6,7]
1812 ; SSE41-NEXT: psraw $1, %xmm0
1813 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm1[0],xmm0[1],xmm1[2,3,4,5,6,7]
1816 ; AVX-LABEL: constant_shift_v4i16:
1818 ; AVX-NEXT: vpmulhw {{.*}}(%rip), %xmm0, %xmm1
1819 ; AVX-NEXT: vpblendw {{.*#+}} xmm1 = xmm0[0],xmm1[1,2,3,4,5,6,7]
1820 ; AVX-NEXT: vpsraw $1, %xmm0, %xmm0
1821 ; AVX-NEXT: vpblendw {{.*#+}} xmm0 = xmm1[0],xmm0[1],xmm1[2,3,4,5,6,7]
1824 ; XOP-LABEL: constant_shift_v4i16:
1826 ; XOP-NEXT: vpshaw {{.*}}(%rip), %xmm0, %xmm0
1829 ; AVX512DQ-LABEL: constant_shift_v4i16:
1830 ; AVX512DQ: # %bb.0:
1831 ; AVX512DQ-NEXT: vpmovsxwd %xmm0, %ymm0
1832 ; AVX512DQ-NEXT: vpsravd {{.*}}(%rip), %ymm0, %ymm0
1833 ; AVX512DQ-NEXT: vpmovdw %zmm0, %ymm0
1834 ; AVX512DQ-NEXT: # kill: def $xmm0 killed $xmm0 killed $ymm0
1835 ; AVX512DQ-NEXT: vzeroupper
1836 ; AVX512DQ-NEXT: retq
1838 ; AVX512BW-LABEL: constant_shift_v4i16:
1839 ; AVX512BW: # %bb.0:
1840 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
1841 ; AVX512BW-NEXT: vmovdqa {{.*#+}} xmm1 = <0,1,2,3,u,u,u,u>
1842 ; AVX512BW-NEXT: vpsravw %zmm1, %zmm0, %zmm0
1843 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 killed $zmm0
1844 ; AVX512BW-NEXT: vzeroupper
1845 ; AVX512BW-NEXT: retq
1847 ; AVX512DQVL-LABEL: constant_shift_v4i16:
1848 ; AVX512DQVL: # %bb.0:
1849 ; AVX512DQVL-NEXT: vpmovsxwd %xmm0, %ymm0
1850 ; AVX512DQVL-NEXT: vpsravd {{.*}}(%rip), %ymm0, %ymm0
1851 ; AVX512DQVL-NEXT: vpmovdw %ymm0, %xmm0
1852 ; AVX512DQVL-NEXT: vzeroupper
1853 ; AVX512DQVL-NEXT: retq
1855 ; AVX512BWVL-LABEL: constant_shift_v4i16:
1856 ; AVX512BWVL: # %bb.0:
1857 ; AVX512BWVL-NEXT: vpsravw {{.*}}(%rip), %xmm0, %xmm0
1858 ; AVX512BWVL-NEXT: retq
1860 ; X32-SSE-LABEL: constant_shift_v4i16:
1862 ; X32-SSE-NEXT: movdqa %xmm0, %xmm1
1863 ; X32-SSE-NEXT: psraw $2, %xmm1
1864 ; X32-SSE-NEXT: shufps {{.*#+}} xmm1 = xmm1[1,0],xmm0[0,0]
1865 ; X32-SSE-NEXT: shufps {{.*#+}} xmm1 = xmm1[2,0],xmm0[2,3]
1866 ; X32-SSE-NEXT: movaps {{.*#+}} xmm2 = [65535,0,65535,0,65535,65535,65535,65535]
1867 ; X32-SSE-NEXT: movaps %xmm1, %xmm0
1868 ; X32-SSE-NEXT: andps %xmm2, %xmm0
1869 ; X32-SSE-NEXT: psraw $1, %xmm1
1870 ; X32-SSE-NEXT: andnps %xmm1, %xmm2
1871 ; X32-SSE-NEXT: orps %xmm2, %xmm0
1872 ; X32-SSE-NEXT: retl
1873 %shift = ashr <4 x i16> %a, <i16 0, i16 1, i16 2, i16 3>
1874 ret <4 x i16> %shift
1877 define <2 x i16> @constant_shift_v2i16(<2 x i16> %a) nounwind {
1878 ; SSE2-LABEL: constant_shift_v2i16:
1880 ; SSE2-NEXT: movdqa %xmm0, %xmm1
1881 ; SSE2-NEXT: psraw $3, %xmm1
1882 ; SSE2-NEXT: movdqa {{.*#+}} xmm2 = [65535,0,65535,65535,65535,65535,65535,65535]
1883 ; SSE2-NEXT: psraw $2, %xmm0
1884 ; SSE2-NEXT: pand %xmm2, %xmm0
1885 ; SSE2-NEXT: pandn %xmm1, %xmm2
1886 ; SSE2-NEXT: por %xmm2, %xmm0
1889 ; SSE41-LABEL: constant_shift_v2i16:
1891 ; SSE41-NEXT: movdqa %xmm0, %xmm1
1892 ; SSE41-NEXT: psraw $3, %xmm1
1893 ; SSE41-NEXT: psraw $2, %xmm0
1894 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm0[0],xmm1[1],xmm0[2,3,4,5,6,7]
1897 ; AVX-LABEL: constant_shift_v2i16:
1899 ; AVX-NEXT: vpsraw $3, %xmm0, %xmm1
1900 ; AVX-NEXT: vpsraw $2, %xmm0, %xmm0
1901 ; AVX-NEXT: vpblendw {{.*#+}} xmm0 = xmm0[0],xmm1[1],xmm0[2,3,4,5,6,7]
1904 ; XOP-LABEL: constant_shift_v2i16:
1906 ; XOP-NEXT: vpshaw {{.*}}(%rip), %xmm0, %xmm0
1909 ; AVX512DQ-LABEL: constant_shift_v2i16:
1910 ; AVX512DQ: # %bb.0:
1911 ; AVX512DQ-NEXT: vpsraw $3, %xmm0, %xmm1
1912 ; AVX512DQ-NEXT: vpsraw $2, %xmm0, %xmm0
1913 ; AVX512DQ-NEXT: vpblendw {{.*#+}} xmm0 = xmm0[0],xmm1[1],xmm0[2,3,4,5,6,7]
1914 ; AVX512DQ-NEXT: retq
1916 ; AVX512BW-LABEL: constant_shift_v2i16:
1917 ; AVX512BW: # %bb.0:
1918 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
1919 ; AVX512BW-NEXT: vmovdqa {{.*#+}} xmm1 = <2,3,u,u,u,u,u,u>
1920 ; AVX512BW-NEXT: vpsravw %zmm1, %zmm0, %zmm0
1921 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 killed $zmm0
1922 ; AVX512BW-NEXT: vzeroupper
1923 ; AVX512BW-NEXT: retq
1925 ; AVX512DQVL-LABEL: constant_shift_v2i16:
1926 ; AVX512DQVL: # %bb.0:
1927 ; AVX512DQVL-NEXT: vpsraw $3, %xmm0, %xmm1
1928 ; AVX512DQVL-NEXT: vpsraw $2, %xmm0, %xmm0
1929 ; AVX512DQVL-NEXT: vpblendw {{.*#+}} xmm0 = xmm0[0],xmm1[1],xmm0[2,3,4,5,6,7]
1930 ; AVX512DQVL-NEXT: retq
1932 ; AVX512BWVL-LABEL: constant_shift_v2i16:
1933 ; AVX512BWVL: # %bb.0:
1934 ; AVX512BWVL-NEXT: vpsravw {{.*}}(%rip), %xmm0, %xmm0
1935 ; AVX512BWVL-NEXT: retq
1937 ; X32-SSE-LABEL: constant_shift_v2i16:
1939 ; X32-SSE-NEXT: movdqa %xmm0, %xmm1
1940 ; X32-SSE-NEXT: psraw $3, %xmm1
1941 ; X32-SSE-NEXT: movdqa {{.*#+}} xmm2 = [65535,0,65535,65535,65535,65535,65535,65535]
1942 ; X32-SSE-NEXT: psraw $2, %xmm0
1943 ; X32-SSE-NEXT: pand %xmm2, %xmm0
1944 ; X32-SSE-NEXT: pandn %xmm1, %xmm2
1945 ; X32-SSE-NEXT: por %xmm2, %xmm0
1946 ; X32-SSE-NEXT: retl
1947 %shift = ashr <2 x i16> %a, <i16 2, i16 3>
1948 ret <2 x i16> %shift
1951 define <8 x i8> @constant_shift_v8i8(<8 x i8> %a) nounwind {
1952 ; SSE-LABEL: constant_shift_v8i8:
1954 ; SSE-NEXT: pxor %xmm1, %xmm1
1955 ; SSE-NEXT: movdqa %xmm0, %xmm2
1956 ; SSE-NEXT: punpckhbw {{.*#+}} xmm2 = xmm2[8],xmm1[8],xmm2[9],xmm1[9],xmm2[10],xmm1[10],xmm2[11],xmm1[11],xmm2[12],xmm1[12],xmm2[13],xmm1[13],xmm2[14],xmm1[14],xmm2[15],xmm1[15]
1957 ; SSE-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
1958 ; SSE-NEXT: psraw $8, %xmm0
1959 ; SSE-NEXT: pmullw {{.*}}(%rip), %xmm0
1960 ; SSE-NEXT: psrlw $8, %xmm0
1961 ; SSE-NEXT: packuswb %xmm2, %xmm0
1964 ; AVX1-LABEL: constant_shift_v8i8:
1966 ; AVX1-NEXT: vpxor %xmm1, %xmm1, %xmm1
1967 ; AVX1-NEXT: vpunpckhbw {{.*#+}} xmm1 = xmm0[8],xmm1[8],xmm0[9],xmm1[9],xmm0[10],xmm1[10],xmm0[11],xmm1[11],xmm0[12],xmm1[12],xmm0[13],xmm1[13],xmm0[14],xmm1[14],xmm0[15],xmm1[15]
1968 ; AVX1-NEXT: vpunpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
1969 ; AVX1-NEXT: vpsraw $8, %xmm0, %xmm0
1970 ; AVX1-NEXT: vpmullw {{.*}}(%rip), %xmm0, %xmm0
1971 ; AVX1-NEXT: vpsrlw $8, %xmm0, %xmm0
1972 ; AVX1-NEXT: vpackuswb %xmm1, %xmm0, %xmm0
1975 ; AVX2-LABEL: constant_shift_v8i8:
1977 ; AVX2-NEXT: vpmovsxbw %xmm0, %ymm0
1978 ; AVX2-NEXT: vpmullw {{.*}}(%rip), %ymm0, %ymm0
1979 ; AVX2-NEXT: vpsrlw $8, %ymm0, %ymm0
1980 ; AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
1981 ; AVX2-NEXT: vpackuswb %xmm1, %xmm0, %xmm0
1982 ; AVX2-NEXT: vzeroupper
1985 ; XOP-LABEL: constant_shift_v8i8:
1987 ; XOP-NEXT: vpshab {{.*}}(%rip), %xmm0, %xmm0
1990 ; AVX512DQ-LABEL: constant_shift_v8i8:
1991 ; AVX512DQ: # %bb.0:
1992 ; AVX512DQ-NEXT: vpmovsxbd %xmm0, %zmm0
1993 ; AVX512DQ-NEXT: vpsravd {{.*}}(%rip), %zmm0, %zmm0
1994 ; AVX512DQ-NEXT: vpmovdb %zmm0, %xmm0
1995 ; AVX512DQ-NEXT: vzeroupper
1996 ; AVX512DQ-NEXT: retq
1998 ; AVX512BW-LABEL: constant_shift_v8i8:
1999 ; AVX512BW: # %bb.0:
2000 ; AVX512BW-NEXT: vmovdqa {{.*#+}} ymm1 = [0,1,2,3,4,5,6,7,0,0,0,0,0,0,0,0]
2001 ; AVX512BW-NEXT: vpmovsxbw %xmm0, %ymm0
2002 ; AVX512BW-NEXT: vpsravw %zmm1, %zmm0, %zmm0
2003 ; AVX512BW-NEXT: vpmovwb %zmm0, %ymm0
2004 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 killed $ymm0
2005 ; AVX512BW-NEXT: vzeroupper
2006 ; AVX512BW-NEXT: retq
2008 ; AVX512DQVL-LABEL: constant_shift_v8i8:
2009 ; AVX512DQVL: # %bb.0:
2010 ; AVX512DQVL-NEXT: vpmovsxbd %xmm0, %zmm0
2011 ; AVX512DQVL-NEXT: vpsravd {{.*}}(%rip), %zmm0, %zmm0
2012 ; AVX512DQVL-NEXT: vpmovdb %zmm0, %xmm0
2013 ; AVX512DQVL-NEXT: vzeroupper
2014 ; AVX512DQVL-NEXT: retq
2016 ; AVX512BWVL-LABEL: constant_shift_v8i8:
2017 ; AVX512BWVL: # %bb.0:
2018 ; AVX512BWVL-NEXT: vpmovsxbw %xmm0, %ymm0
2019 ; AVX512BWVL-NEXT: vpsravw {{.*}}(%rip), %ymm0, %ymm0
2020 ; AVX512BWVL-NEXT: vpmovwb %ymm0, %xmm0
2021 ; AVX512BWVL-NEXT: vzeroupper
2022 ; AVX512BWVL-NEXT: retq
2024 ; X32-SSE-LABEL: constant_shift_v8i8:
2026 ; X32-SSE-NEXT: pxor %xmm1, %xmm1
2027 ; X32-SSE-NEXT: movdqa %xmm0, %xmm2
2028 ; X32-SSE-NEXT: punpckhbw {{.*#+}} xmm2 = xmm2[8],xmm1[8],xmm2[9],xmm1[9],xmm2[10],xmm1[10],xmm2[11],xmm1[11],xmm2[12],xmm1[12],xmm2[13],xmm1[13],xmm2[14],xmm1[14],xmm2[15],xmm1[15]
2029 ; X32-SSE-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
2030 ; X32-SSE-NEXT: psraw $8, %xmm0
2031 ; X32-SSE-NEXT: pmullw {{\.LCPI.*}}, %xmm0
2032 ; X32-SSE-NEXT: psrlw $8, %xmm0
2033 ; X32-SSE-NEXT: packuswb %xmm2, %xmm0
2034 ; X32-SSE-NEXT: retl
2035 %shift = ashr <8 x i8> %a, <i8 0, i8 1, i8 2, i8 3, i8 4, i8 5, i8 6, i8 7>
2039 define <4 x i8> @constant_shift_v4i8(<4 x i8> %a) nounwind {
2040 ; SSE-LABEL: constant_shift_v4i8:
2042 ; SSE-NEXT: pxor %xmm1, %xmm1
2043 ; SSE-NEXT: movdqa %xmm0, %xmm2
2044 ; SSE-NEXT: punpckhbw {{.*#+}} xmm2 = xmm2[8],xmm1[8],xmm2[9],xmm1[9],xmm2[10],xmm1[10],xmm2[11],xmm1[11],xmm2[12],xmm1[12],xmm2[13],xmm1[13],xmm2[14],xmm1[14],xmm2[15],xmm1[15]
2045 ; SSE-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
2046 ; SSE-NEXT: psraw $8, %xmm0
2047 ; SSE-NEXT: pmullw {{.*}}(%rip), %xmm0
2048 ; SSE-NEXT: psrlw $8, %xmm0
2049 ; SSE-NEXT: packuswb %xmm2, %xmm0
2052 ; AVX1-LABEL: constant_shift_v4i8:
2054 ; AVX1-NEXT: vpxor %xmm1, %xmm1, %xmm1
2055 ; AVX1-NEXT: vpunpckhbw {{.*#+}} xmm1 = xmm0[8],xmm1[8],xmm0[9],xmm1[9],xmm0[10],xmm1[10],xmm0[11],xmm1[11],xmm0[12],xmm1[12],xmm0[13],xmm1[13],xmm0[14],xmm1[14],xmm0[15],xmm1[15]
2056 ; AVX1-NEXT: vpunpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
2057 ; AVX1-NEXT: vpsraw $8, %xmm0, %xmm0
2058 ; AVX1-NEXT: vpmullw {{.*}}(%rip), %xmm0, %xmm0
2059 ; AVX1-NEXT: vpsrlw $8, %xmm0, %xmm0
2060 ; AVX1-NEXT: vpackuswb %xmm1, %xmm0, %xmm0
2063 ; AVX2-LABEL: constant_shift_v4i8:
2065 ; AVX2-NEXT: vpmovsxbw %xmm0, %ymm0
2066 ; AVX2-NEXT: vpmullw {{.*}}(%rip), %ymm0, %ymm0
2067 ; AVX2-NEXT: vpsrlw $8, %ymm0, %ymm0
2068 ; AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
2069 ; AVX2-NEXT: vpackuswb %xmm1, %xmm0, %xmm0
2070 ; AVX2-NEXT: vzeroupper
2073 ; XOP-LABEL: constant_shift_v4i8:
2075 ; XOP-NEXT: vpshab {{.*}}(%rip), %xmm0, %xmm0
2078 ; AVX512DQ-LABEL: constant_shift_v4i8:
2079 ; AVX512DQ: # %bb.0:
2080 ; AVX512DQ-NEXT: vpmovsxbd %xmm0, %zmm0
2081 ; AVX512DQ-NEXT: vpsravd {{.*}}(%rip), %zmm0, %zmm0
2082 ; AVX512DQ-NEXT: vpmovdb %zmm0, %xmm0
2083 ; AVX512DQ-NEXT: vzeroupper
2084 ; AVX512DQ-NEXT: retq
2086 ; AVX512BW-LABEL: constant_shift_v4i8:
2087 ; AVX512BW: # %bb.0:
2088 ; AVX512BW-NEXT: vmovdqa {{.*#+}} ymm1 = [0,1,2,3,0,0,0,0,0,0,0,0,0,0,0,0]
2089 ; AVX512BW-NEXT: vpmovsxbw %xmm0, %ymm0
2090 ; AVX512BW-NEXT: vpsravw %zmm1, %zmm0, %zmm0
2091 ; AVX512BW-NEXT: vpmovwb %zmm0, %ymm0
2092 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 killed $ymm0
2093 ; AVX512BW-NEXT: vzeroupper
2094 ; AVX512BW-NEXT: retq
2096 ; AVX512DQVL-LABEL: constant_shift_v4i8:
2097 ; AVX512DQVL: # %bb.0:
2098 ; AVX512DQVL-NEXT: vpmovsxbd %xmm0, %zmm0
2099 ; AVX512DQVL-NEXT: vpsravd {{.*}}(%rip), %zmm0, %zmm0
2100 ; AVX512DQVL-NEXT: vpmovdb %zmm0, %xmm0
2101 ; AVX512DQVL-NEXT: vzeroupper
2102 ; AVX512DQVL-NEXT: retq
2104 ; AVX512BWVL-LABEL: constant_shift_v4i8:
2105 ; AVX512BWVL: # %bb.0:
2106 ; AVX512BWVL-NEXT: vpmovsxbw %xmm0, %ymm0
2107 ; AVX512BWVL-NEXT: vpsravw {{.*}}(%rip), %ymm0, %ymm0
2108 ; AVX512BWVL-NEXT: vpmovwb %ymm0, %xmm0
2109 ; AVX512BWVL-NEXT: vzeroupper
2110 ; AVX512BWVL-NEXT: retq
2112 ; X32-SSE-LABEL: constant_shift_v4i8:
2114 ; X32-SSE-NEXT: pxor %xmm1, %xmm1
2115 ; X32-SSE-NEXT: movdqa %xmm0, %xmm2
2116 ; X32-SSE-NEXT: punpckhbw {{.*#+}} xmm2 = xmm2[8],xmm1[8],xmm2[9],xmm1[9],xmm2[10],xmm1[10],xmm2[11],xmm1[11],xmm2[12],xmm1[12],xmm2[13],xmm1[13],xmm2[14],xmm1[14],xmm2[15],xmm1[15]
2117 ; X32-SSE-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
2118 ; X32-SSE-NEXT: psraw $8, %xmm0
2119 ; X32-SSE-NEXT: pmullw {{\.LCPI.*}}, %xmm0
2120 ; X32-SSE-NEXT: psrlw $8, %xmm0
2121 ; X32-SSE-NEXT: packuswb %xmm2, %xmm0
2122 ; X32-SSE-NEXT: retl
2123 %shift = ashr <4 x i8> %a, <i8 0, i8 1, i8 2, i8 3>
2127 define <2 x i8> @constant_shift_v2i8(<2 x i8> %a) nounwind {
2128 ; SSE-LABEL: constant_shift_v2i8:
2130 ; SSE-NEXT: pxor %xmm1, %xmm1
2131 ; SSE-NEXT: movdqa %xmm0, %xmm2
2132 ; SSE-NEXT: punpckhbw {{.*#+}} xmm2 = xmm2[8],xmm1[8],xmm2[9],xmm1[9],xmm2[10],xmm1[10],xmm2[11],xmm1[11],xmm2[12],xmm1[12],xmm2[13],xmm1[13],xmm2[14],xmm1[14],xmm2[15],xmm1[15]
2133 ; SSE-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
2134 ; SSE-NEXT: psraw $8, %xmm0
2135 ; SSE-NEXT: pmullw {{.*}}(%rip), %xmm0
2136 ; SSE-NEXT: psrlw $8, %xmm0
2137 ; SSE-NEXT: packuswb %xmm2, %xmm0
2140 ; AVX1-LABEL: constant_shift_v2i8:
2142 ; AVX1-NEXT: vpxor %xmm1, %xmm1, %xmm1
2143 ; AVX1-NEXT: vpunpckhbw {{.*#+}} xmm1 = xmm0[8],xmm1[8],xmm0[9],xmm1[9],xmm0[10],xmm1[10],xmm0[11],xmm1[11],xmm0[12],xmm1[12],xmm0[13],xmm1[13],xmm0[14],xmm1[14],xmm0[15],xmm1[15]
2144 ; AVX1-NEXT: vpunpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
2145 ; AVX1-NEXT: vpsraw $8, %xmm0, %xmm0
2146 ; AVX1-NEXT: vpmullw {{.*}}(%rip), %xmm0, %xmm0
2147 ; AVX1-NEXT: vpsrlw $8, %xmm0, %xmm0
2148 ; AVX1-NEXT: vpackuswb %xmm1, %xmm0, %xmm0
2151 ; AVX2-LABEL: constant_shift_v2i8:
2153 ; AVX2-NEXT: vpmovsxbw %xmm0, %ymm0
2154 ; AVX2-NEXT: vpmullw {{.*}}(%rip), %ymm0, %ymm0
2155 ; AVX2-NEXT: vpsrlw $8, %ymm0, %ymm0
2156 ; AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
2157 ; AVX2-NEXT: vpackuswb %xmm1, %xmm0, %xmm0
2158 ; AVX2-NEXT: vzeroupper
2161 ; XOP-LABEL: constant_shift_v2i8:
2163 ; XOP-NEXT: vpshab {{.*}}(%rip), %xmm0, %xmm0
2166 ; AVX512DQ-LABEL: constant_shift_v2i8:
2167 ; AVX512DQ: # %bb.0:
2168 ; AVX512DQ-NEXT: vpmovsxbd %xmm0, %zmm0
2169 ; AVX512DQ-NEXT: vpsravd {{.*}}(%rip), %zmm0, %zmm0
2170 ; AVX512DQ-NEXT: vpmovdb %zmm0, %xmm0
2171 ; AVX512DQ-NEXT: vzeroupper
2172 ; AVX512DQ-NEXT: retq
2174 ; AVX512BW-LABEL: constant_shift_v2i8:
2175 ; AVX512BW: # %bb.0:
2176 ; AVX512BW-NEXT: vmovdqa {{.*#+}} ymm1 = [2,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
2177 ; AVX512BW-NEXT: vpmovsxbw %xmm0, %ymm0
2178 ; AVX512BW-NEXT: vpsravw %zmm1, %zmm0, %zmm0
2179 ; AVX512BW-NEXT: vpmovwb %zmm0, %ymm0
2180 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 killed $ymm0
2181 ; AVX512BW-NEXT: vzeroupper
2182 ; AVX512BW-NEXT: retq
2184 ; AVX512DQVL-LABEL: constant_shift_v2i8:
2185 ; AVX512DQVL: # %bb.0:
2186 ; AVX512DQVL-NEXT: vpmovsxbd %xmm0, %zmm0
2187 ; AVX512DQVL-NEXT: vpsravd {{.*}}(%rip), %zmm0, %zmm0
2188 ; AVX512DQVL-NEXT: vpmovdb %zmm0, %xmm0
2189 ; AVX512DQVL-NEXT: vzeroupper
2190 ; AVX512DQVL-NEXT: retq
2192 ; AVX512BWVL-LABEL: constant_shift_v2i8:
2193 ; AVX512BWVL: # %bb.0:
2194 ; AVX512BWVL-NEXT: vpmovsxbw %xmm0, %ymm0
2195 ; AVX512BWVL-NEXT: vpsravw {{.*}}(%rip), %ymm0, %ymm0
2196 ; AVX512BWVL-NEXT: vpmovwb %ymm0, %xmm0
2197 ; AVX512BWVL-NEXT: vzeroupper
2198 ; AVX512BWVL-NEXT: retq
2200 ; X32-SSE-LABEL: constant_shift_v2i8:
2202 ; X32-SSE-NEXT: pxor %xmm1, %xmm1
2203 ; X32-SSE-NEXT: movdqa %xmm0, %xmm2
2204 ; X32-SSE-NEXT: punpckhbw {{.*#+}} xmm2 = xmm2[8],xmm1[8],xmm2[9],xmm1[9],xmm2[10],xmm1[10],xmm2[11],xmm1[11],xmm2[12],xmm1[12],xmm2[13],xmm1[13],xmm2[14],xmm1[14],xmm2[15],xmm1[15]
2205 ; X32-SSE-NEXT: punpcklbw {{.*#+}} xmm0 = xmm0[0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7]
2206 ; X32-SSE-NEXT: psraw $8, %xmm0
2207 ; X32-SSE-NEXT: pmullw {{\.LCPI.*}}, %xmm0
2208 ; X32-SSE-NEXT: psrlw $8, %xmm0
2209 ; X32-SSE-NEXT: packuswb %xmm2, %xmm0
2210 ; X32-SSE-NEXT: retl
2211 %shift = ashr <2 x i8> %a, <i8 2, i8 3>
2216 ; Uniform Constant Shifts
2219 define <2 x i32> @splatconstant_shift_v2i32(<2 x i32> %a) nounwind {
2220 ; SSE-LABEL: splatconstant_shift_v2i32:
2222 ; SSE-NEXT: psrad $5, %xmm0
2225 ; AVX-LABEL: splatconstant_shift_v2i32:
2227 ; AVX-NEXT: vpsrad $5, %xmm0, %xmm0
2230 ; XOP-LABEL: splatconstant_shift_v2i32:
2232 ; XOP-NEXT: vpsrad $5, %xmm0, %xmm0
2235 ; AVX512-LABEL: splatconstant_shift_v2i32:
2237 ; AVX512-NEXT: vpsrad $5, %xmm0, %xmm0
2240 ; AVX512VL-LABEL: splatconstant_shift_v2i32:
2241 ; AVX512VL: # %bb.0:
2242 ; AVX512VL-NEXT: vpsrad $5, %xmm0, %xmm0
2243 ; AVX512VL-NEXT: retq
2245 ; X32-SSE-LABEL: splatconstant_shift_v2i32:
2247 ; X32-SSE-NEXT: psrad $5, %xmm0
2248 ; X32-SSE-NEXT: retl
2249 %shift = ashr <2 x i32> %a, <i32 5, i32 5>
2250 ret <2 x i32> %shift
2253 define <4 x i16> @splatconstant_shift_v4i16(<4 x i16> %a) nounwind {
2254 ; SSE-LABEL: splatconstant_shift_v4i16:
2256 ; SSE-NEXT: psraw $3, %xmm0
2259 ; AVX-LABEL: splatconstant_shift_v4i16:
2261 ; AVX-NEXT: vpsraw $3, %xmm0, %xmm0
2264 ; XOP-LABEL: splatconstant_shift_v4i16:
2266 ; XOP-NEXT: vpsraw $3, %xmm0, %xmm0
2269 ; AVX512-LABEL: splatconstant_shift_v4i16:
2271 ; AVX512-NEXT: vpsraw $3, %xmm0, %xmm0
2274 ; AVX512VL-LABEL: splatconstant_shift_v4i16:
2275 ; AVX512VL: # %bb.0:
2276 ; AVX512VL-NEXT: vpsraw $3, %xmm0, %xmm0
2277 ; AVX512VL-NEXT: retq
2279 ; X32-SSE-LABEL: splatconstant_shift_v4i16:
2281 ; X32-SSE-NEXT: psraw $3, %xmm0
2282 ; X32-SSE-NEXT: retl
2283 %shift = ashr <4 x i16> %a, <i16 3, i16 3, i16 3, i16 3>
2284 ret <4 x i16> %shift
2287 define <2 x i16> @splatconstant_shift_v2i16(<2 x i16> %a) nounwind {
2288 ; SSE-LABEL: splatconstant_shift_v2i16:
2290 ; SSE-NEXT: psraw $3, %xmm0
2293 ; AVX-LABEL: splatconstant_shift_v2i16:
2295 ; AVX-NEXT: vpsraw $3, %xmm0, %xmm0
2298 ; XOP-LABEL: splatconstant_shift_v2i16:
2300 ; XOP-NEXT: vpsraw $3, %xmm0, %xmm0
2303 ; AVX512-LABEL: splatconstant_shift_v2i16:
2305 ; AVX512-NEXT: vpsraw $3, %xmm0, %xmm0
2308 ; AVX512VL-LABEL: splatconstant_shift_v2i16:
2309 ; AVX512VL: # %bb.0:
2310 ; AVX512VL-NEXT: vpsraw $3, %xmm0, %xmm0
2311 ; AVX512VL-NEXT: retq
2313 ; X32-SSE-LABEL: splatconstant_shift_v2i16:
2315 ; X32-SSE-NEXT: psraw $3, %xmm0
2316 ; X32-SSE-NEXT: retl
2317 %shift = ashr <2 x i16> %a, <i16 3, i16 3>
2318 ret <2 x i16> %shift
2321 define <8 x i8> @splatconstant_shift_v8i8(<8 x i8> %a) nounwind {
2322 ; SSE-LABEL: splatconstant_shift_v8i8:
2324 ; SSE-NEXT: psrlw $3, %xmm0
2325 ; SSE-NEXT: pand {{.*}}(%rip), %xmm0
2326 ; SSE-NEXT: movdqa {{.*#+}} xmm1 = [16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]
2327 ; SSE-NEXT: pxor %xmm1, %xmm0
2328 ; SSE-NEXT: psubb %xmm1, %xmm0
2331 ; AVX-LABEL: splatconstant_shift_v8i8:
2333 ; AVX-NEXT: vpsrlw $3, %xmm0, %xmm0
2334 ; AVX-NEXT: vpand {{.*}}(%rip), %xmm0, %xmm0
2335 ; AVX-NEXT: vmovdqa {{.*#+}} xmm1 = [16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]
2336 ; AVX-NEXT: vpxor %xmm1, %xmm0, %xmm0
2337 ; AVX-NEXT: vpsubb %xmm1, %xmm0, %xmm0
2340 ; XOP-LABEL: splatconstant_shift_v8i8:
2342 ; XOP-NEXT: vpshab {{.*}}(%rip), %xmm0, %xmm0
2345 ; AVX512-LABEL: splatconstant_shift_v8i8:
2347 ; AVX512-NEXT: vpsrlw $3, %xmm0, %xmm0
2348 ; AVX512-NEXT: vpand {{.*}}(%rip), %xmm0, %xmm0
2349 ; AVX512-NEXT: vmovdqa {{.*#+}} xmm1 = [16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]
2350 ; AVX512-NEXT: vpxor %xmm1, %xmm0, %xmm0
2351 ; AVX512-NEXT: vpsubb %xmm1, %xmm0, %xmm0
2354 ; AVX512VL-LABEL: splatconstant_shift_v8i8:
2355 ; AVX512VL: # %bb.0:
2356 ; AVX512VL-NEXT: vpsrlw $3, %xmm0, %xmm0
2357 ; AVX512VL-NEXT: vpand {{.*}}(%rip), %xmm0, %xmm0
2358 ; AVX512VL-NEXT: vmovdqa {{.*#+}} xmm1 = [16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]
2359 ; AVX512VL-NEXT: vpxor %xmm1, %xmm0, %xmm0
2360 ; AVX512VL-NEXT: vpsubb %xmm1, %xmm0, %xmm0
2361 ; AVX512VL-NEXT: retq
2363 ; X32-SSE-LABEL: splatconstant_shift_v8i8:
2365 ; X32-SSE-NEXT: psrlw $3, %xmm0
2366 ; X32-SSE-NEXT: pand {{\.LCPI.*}}, %xmm0
2367 ; X32-SSE-NEXT: movdqa {{.*#+}} xmm1 = [16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]
2368 ; X32-SSE-NEXT: pxor %xmm1, %xmm0
2369 ; X32-SSE-NEXT: psubb %xmm1, %xmm0
2370 ; X32-SSE-NEXT: retl
2371 %shift = ashr <8 x i8> %a, <i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3, i8 3>
2375 define <4 x i8> @splatconstant_shift_v4i8(<4 x i8> %a) nounwind {
2376 ; SSE-LABEL: splatconstant_shift_v4i8:
2378 ; SSE-NEXT: psrlw $3, %xmm0
2379 ; SSE-NEXT: pand {{.*}}(%rip), %xmm0
2380 ; SSE-NEXT: movdqa {{.*#+}} xmm1 = [16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]
2381 ; SSE-NEXT: pxor %xmm1, %xmm0
2382 ; SSE-NEXT: psubb %xmm1, %xmm0
2385 ; AVX-LABEL: splatconstant_shift_v4i8:
2387 ; AVX-NEXT: vpsrlw $3, %xmm0, %xmm0
2388 ; AVX-NEXT: vpand {{.*}}(%rip), %xmm0, %xmm0
2389 ; AVX-NEXT: vmovdqa {{.*#+}} xmm1 = [16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]
2390 ; AVX-NEXT: vpxor %xmm1, %xmm0, %xmm0
2391 ; AVX-NEXT: vpsubb %xmm1, %xmm0, %xmm0
2394 ; XOP-LABEL: splatconstant_shift_v4i8:
2396 ; XOP-NEXT: vpshab {{.*}}(%rip), %xmm0, %xmm0
2399 ; AVX512-LABEL: splatconstant_shift_v4i8:
2401 ; AVX512-NEXT: vpsrlw $3, %xmm0, %xmm0
2402 ; AVX512-NEXT: vpand {{.*}}(%rip), %xmm0, %xmm0
2403 ; AVX512-NEXT: vmovdqa {{.*#+}} xmm1 = [16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]
2404 ; AVX512-NEXT: vpxor %xmm1, %xmm0, %xmm0
2405 ; AVX512-NEXT: vpsubb %xmm1, %xmm0, %xmm0
2408 ; AVX512VL-LABEL: splatconstant_shift_v4i8:
2409 ; AVX512VL: # %bb.0:
2410 ; AVX512VL-NEXT: vpsrlw $3, %xmm0, %xmm0
2411 ; AVX512VL-NEXT: vpand {{.*}}(%rip), %xmm0, %xmm0
2412 ; AVX512VL-NEXT: vmovdqa {{.*#+}} xmm1 = [16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]
2413 ; AVX512VL-NEXT: vpxor %xmm1, %xmm0, %xmm0
2414 ; AVX512VL-NEXT: vpsubb %xmm1, %xmm0, %xmm0
2415 ; AVX512VL-NEXT: retq
2417 ; X32-SSE-LABEL: splatconstant_shift_v4i8:
2419 ; X32-SSE-NEXT: psrlw $3, %xmm0
2420 ; X32-SSE-NEXT: pand {{\.LCPI.*}}, %xmm0
2421 ; X32-SSE-NEXT: movdqa {{.*#+}} xmm1 = [16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]
2422 ; X32-SSE-NEXT: pxor %xmm1, %xmm0
2423 ; X32-SSE-NEXT: psubb %xmm1, %xmm0
2424 ; X32-SSE-NEXT: retl
2425 %shift = ashr <4 x i8> %a, <i8 3, i8 3, i8 3, i8 3>
2429 define <2 x i8> @splatconstant_shift_v2i8(<2 x i8> %a) nounwind {
2430 ; SSE-LABEL: splatconstant_shift_v2i8:
2432 ; SSE-NEXT: psrlw $3, %xmm0
2433 ; SSE-NEXT: pand {{.*}}(%rip), %xmm0
2434 ; SSE-NEXT: movdqa {{.*#+}} xmm1 = [16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]
2435 ; SSE-NEXT: pxor %xmm1, %xmm0
2436 ; SSE-NEXT: psubb %xmm1, %xmm0
2439 ; AVX-LABEL: splatconstant_shift_v2i8:
2441 ; AVX-NEXT: vpsrlw $3, %xmm0, %xmm0
2442 ; AVX-NEXT: vpand {{.*}}(%rip), %xmm0, %xmm0
2443 ; AVX-NEXT: vmovdqa {{.*#+}} xmm1 = [16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]
2444 ; AVX-NEXT: vpxor %xmm1, %xmm0, %xmm0
2445 ; AVX-NEXT: vpsubb %xmm1, %xmm0, %xmm0
2448 ; XOP-LABEL: splatconstant_shift_v2i8:
2450 ; XOP-NEXT: vpshab {{.*}}(%rip), %xmm0, %xmm0
2453 ; AVX512-LABEL: splatconstant_shift_v2i8:
2455 ; AVX512-NEXT: vpsrlw $3, %xmm0, %xmm0
2456 ; AVX512-NEXT: vpand {{.*}}(%rip), %xmm0, %xmm0
2457 ; AVX512-NEXT: vmovdqa {{.*#+}} xmm1 = [16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]
2458 ; AVX512-NEXT: vpxor %xmm1, %xmm0, %xmm0
2459 ; AVX512-NEXT: vpsubb %xmm1, %xmm0, %xmm0
2462 ; AVX512VL-LABEL: splatconstant_shift_v2i8:
2463 ; AVX512VL: # %bb.0:
2464 ; AVX512VL-NEXT: vpsrlw $3, %xmm0, %xmm0
2465 ; AVX512VL-NEXT: vpand {{.*}}(%rip), %xmm0, %xmm0
2466 ; AVX512VL-NEXT: vmovdqa {{.*#+}} xmm1 = [16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]
2467 ; AVX512VL-NEXT: vpxor %xmm1, %xmm0, %xmm0
2468 ; AVX512VL-NEXT: vpsubb %xmm1, %xmm0, %xmm0
2469 ; AVX512VL-NEXT: retq
2471 ; X32-SSE-LABEL: splatconstant_shift_v2i8:
2473 ; X32-SSE-NEXT: psrlw $3, %xmm0
2474 ; X32-SSE-NEXT: pand {{\.LCPI.*}}, %xmm0
2475 ; X32-SSE-NEXT: movdqa {{.*#+}} xmm1 = [16,16,16,16,16,16,16,16,16,16,16,16,16,16,16,16]
2476 ; X32-SSE-NEXT: pxor %xmm1, %xmm0
2477 ; X32-SSE-NEXT: psubb %xmm1, %xmm0
2478 ; X32-SSE-NEXT: retl
2479 %shift = ashr <2 x i8> %a, <i8 3, i8 3>