1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s --check-prefixes=SSE,SSE2
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse3 | FileCheck %s --check-prefixes=SSE,SSE3
4 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+ssse3 | FileCheck %s --check-prefixes=SSE,SSSE3
5 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse4.1 | FileCheck %s --check-prefixes=SSE,SSE41
6 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx | FileCheck %s --check-prefixes=AVX,AVX1
7 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2 | FileCheck %s --check-prefixes=AVX,AVX2
8 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512cd,+avx512vl | FileCheck %s --check-prefixes=AVX,AVX512CDVL
9 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512cd,-avx512vl | FileCheck %s --check-prefixes=AVX,AVX512CD
10 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512vpopcntdq | FileCheck %s --check-prefix=AVX512VPOPCNTDQ
11 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512vpopcntdq,+avx512vl | FileCheck %s --check-prefix=AVX512VPOPCNTDQVL
12 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512bitalg | FileCheck %s --check-prefix=BITALG_NOVLX
13 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512bitalg,+avx512vl | FileCheck %s --check-prefix=BITALG
15 ; Just one 32-bit run to make sure we do reasonable things for i64 tzcnt.
16 ; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+sse4.1 | FileCheck %s --check-prefix=X86-SSE
18 define <2 x i64> @testv2i64(<2 x i64> %in) nounwind {
19 ; SSE2-LABEL: testv2i64:
21 ; SSE2-NEXT: pcmpeqd %xmm1, %xmm1
22 ; SSE2-NEXT: paddq %xmm0, %xmm1
23 ; SSE2-NEXT: pandn %xmm1, %xmm0
24 ; SSE2-NEXT: movdqa %xmm0, %xmm1
25 ; SSE2-NEXT: psrlw $1, %xmm1
26 ; SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
27 ; SSE2-NEXT: psubb %xmm1, %xmm0
28 ; SSE2-NEXT: movdqa {{.*#+}} xmm1 = [51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51]
29 ; SSE2-NEXT: movdqa %xmm0, %xmm2
30 ; SSE2-NEXT: pand %xmm1, %xmm2
31 ; SSE2-NEXT: psrlw $2, %xmm0
32 ; SSE2-NEXT: pand %xmm1, %xmm0
33 ; SSE2-NEXT: paddb %xmm2, %xmm0
34 ; SSE2-NEXT: movdqa %xmm0, %xmm1
35 ; SSE2-NEXT: psrlw $4, %xmm1
36 ; SSE2-NEXT: paddb %xmm1, %xmm0
37 ; SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
38 ; SSE2-NEXT: pxor %xmm1, %xmm1
39 ; SSE2-NEXT: psadbw %xmm1, %xmm0
42 ; SSE3-LABEL: testv2i64:
44 ; SSE3-NEXT: pcmpeqd %xmm1, %xmm1
45 ; SSE3-NEXT: paddq %xmm0, %xmm1
46 ; SSE3-NEXT: pandn %xmm1, %xmm0
47 ; SSE3-NEXT: movdqa %xmm0, %xmm1
48 ; SSE3-NEXT: psrlw $1, %xmm1
49 ; SSE3-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
50 ; SSE3-NEXT: psubb %xmm1, %xmm0
51 ; SSE3-NEXT: movdqa {{.*#+}} xmm1 = [51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51]
52 ; SSE3-NEXT: movdqa %xmm0, %xmm2
53 ; SSE3-NEXT: pand %xmm1, %xmm2
54 ; SSE3-NEXT: psrlw $2, %xmm0
55 ; SSE3-NEXT: pand %xmm1, %xmm0
56 ; SSE3-NEXT: paddb %xmm2, %xmm0
57 ; SSE3-NEXT: movdqa %xmm0, %xmm1
58 ; SSE3-NEXT: psrlw $4, %xmm1
59 ; SSE3-NEXT: paddb %xmm1, %xmm0
60 ; SSE3-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
61 ; SSE3-NEXT: pxor %xmm1, %xmm1
62 ; SSE3-NEXT: psadbw %xmm1, %xmm0
65 ; SSSE3-LABEL: testv2i64:
67 ; SSSE3-NEXT: pcmpeqd %xmm1, %xmm1
68 ; SSSE3-NEXT: paddq %xmm0, %xmm1
69 ; SSSE3-NEXT: pandn %xmm1, %xmm0
70 ; SSSE3-NEXT: movdqa {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
71 ; SSSE3-NEXT: movdqa %xmm0, %xmm2
72 ; SSSE3-NEXT: pand %xmm1, %xmm2
73 ; SSSE3-NEXT: movdqa {{.*#+}} xmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
74 ; SSSE3-NEXT: movdqa %xmm3, %xmm4
75 ; SSSE3-NEXT: pshufb %xmm2, %xmm4
76 ; SSSE3-NEXT: psrlw $4, %xmm0
77 ; SSSE3-NEXT: pand %xmm1, %xmm0
78 ; SSSE3-NEXT: pshufb %xmm0, %xmm3
79 ; SSSE3-NEXT: paddb %xmm4, %xmm3
80 ; SSSE3-NEXT: pxor %xmm0, %xmm0
81 ; SSSE3-NEXT: psadbw %xmm3, %xmm0
84 ; SSE41-LABEL: testv2i64:
86 ; SSE41-NEXT: pcmpeqd %xmm1, %xmm1
87 ; SSE41-NEXT: paddq %xmm0, %xmm1
88 ; SSE41-NEXT: pandn %xmm1, %xmm0
89 ; SSE41-NEXT: movdqa {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
90 ; SSE41-NEXT: movdqa %xmm0, %xmm2
91 ; SSE41-NEXT: pand %xmm1, %xmm2
92 ; SSE41-NEXT: movdqa {{.*#+}} xmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
93 ; SSE41-NEXT: movdqa %xmm3, %xmm4
94 ; SSE41-NEXT: pshufb %xmm2, %xmm4
95 ; SSE41-NEXT: psrlw $4, %xmm0
96 ; SSE41-NEXT: pand %xmm1, %xmm0
97 ; SSE41-NEXT: pshufb %xmm0, %xmm3
98 ; SSE41-NEXT: paddb %xmm4, %xmm3
99 ; SSE41-NEXT: pxor %xmm0, %xmm0
100 ; SSE41-NEXT: psadbw %xmm3, %xmm0
103 ; AVX1-LABEL: testv2i64:
105 ; AVX1-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
106 ; AVX1-NEXT: vpaddq %xmm1, %xmm0, %xmm1
107 ; AVX1-NEXT: vpandn %xmm1, %xmm0, %xmm0
108 ; AVX1-NEXT: vbroadcastss {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
109 ; AVX1-NEXT: vpand %xmm1, %xmm0, %xmm2
110 ; AVX1-NEXT: vmovdqa {{.*#+}} xmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
111 ; AVX1-NEXT: vpshufb %xmm2, %xmm3, %xmm2
112 ; AVX1-NEXT: vpsrlw $4, %xmm0, %xmm0
113 ; AVX1-NEXT: vpand %xmm1, %xmm0, %xmm0
114 ; AVX1-NEXT: vpshufb %xmm0, %xmm3, %xmm0
115 ; AVX1-NEXT: vpaddb %xmm2, %xmm0, %xmm0
116 ; AVX1-NEXT: vpxor %xmm1, %xmm1, %xmm1
117 ; AVX1-NEXT: vpsadbw %xmm1, %xmm0, %xmm0
120 ; AVX2-LABEL: testv2i64:
122 ; AVX2-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
123 ; AVX2-NEXT: vpaddq %xmm1, %xmm0, %xmm1
124 ; AVX2-NEXT: vpandn %xmm1, %xmm0, %xmm0
125 ; AVX2-NEXT: vpbroadcastb {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
126 ; AVX2-NEXT: vpand %xmm1, %xmm0, %xmm2
127 ; AVX2-NEXT: vmovdqa {{.*#+}} xmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
128 ; AVX2-NEXT: vpshufb %xmm2, %xmm3, %xmm2
129 ; AVX2-NEXT: vpsrlw $4, %xmm0, %xmm0
130 ; AVX2-NEXT: vpand %xmm1, %xmm0, %xmm0
131 ; AVX2-NEXT: vpshufb %xmm0, %xmm3, %xmm0
132 ; AVX2-NEXT: vpaddb %xmm2, %xmm0, %xmm0
133 ; AVX2-NEXT: vpxor %xmm1, %xmm1, %xmm1
134 ; AVX2-NEXT: vpsadbw %xmm1, %xmm0, %xmm0
137 ; AVX512CDVL-LABEL: testv2i64:
138 ; AVX512CDVL: # %bb.0:
139 ; AVX512CDVL-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
140 ; AVX512CDVL-NEXT: vpaddq %xmm1, %xmm0, %xmm1
141 ; AVX512CDVL-NEXT: vpandn %xmm1, %xmm0, %xmm0
142 ; AVX512CDVL-NEXT: vplzcntq %xmm0, %xmm0
143 ; AVX512CDVL-NEXT: vpbroadcastq {{.*#+}} xmm1 = [64,64]
144 ; AVX512CDVL-NEXT: vpsubq %xmm0, %xmm1, %xmm0
145 ; AVX512CDVL-NEXT: retq
147 ; AVX512CD-LABEL: testv2i64:
149 ; AVX512CD-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
150 ; AVX512CD-NEXT: vpaddq %xmm1, %xmm0, %xmm1
151 ; AVX512CD-NEXT: vpandn %xmm1, %xmm0, %xmm0
152 ; AVX512CD-NEXT: vplzcntq %zmm0, %zmm0
153 ; AVX512CD-NEXT: vpbroadcastq {{.*#+}} xmm1 = [64,64]
154 ; AVX512CD-NEXT: vpsubq %xmm0, %xmm1, %xmm0
155 ; AVX512CD-NEXT: vzeroupper
156 ; AVX512CD-NEXT: retq
158 ; AVX512VPOPCNTDQ-LABEL: testv2i64:
159 ; AVX512VPOPCNTDQ: # %bb.0:
160 ; AVX512VPOPCNTDQ-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
161 ; AVX512VPOPCNTDQ-NEXT: vpaddq %xmm1, %xmm0, %xmm1
162 ; AVX512VPOPCNTDQ-NEXT: vpandn %xmm1, %xmm0, %xmm0
163 ; AVX512VPOPCNTDQ-NEXT: vpopcntq %zmm0, %zmm0
164 ; AVX512VPOPCNTDQ-NEXT: # kill: def $xmm0 killed $xmm0 killed $zmm0
165 ; AVX512VPOPCNTDQ-NEXT: vzeroupper
166 ; AVX512VPOPCNTDQ-NEXT: retq
168 ; AVX512VPOPCNTDQVL-LABEL: testv2i64:
169 ; AVX512VPOPCNTDQVL: # %bb.0:
170 ; AVX512VPOPCNTDQVL-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
171 ; AVX512VPOPCNTDQVL-NEXT: vpaddq %xmm1, %xmm0, %xmm1
172 ; AVX512VPOPCNTDQVL-NEXT: vpandn %xmm1, %xmm0, %xmm0
173 ; AVX512VPOPCNTDQVL-NEXT: vpopcntq %xmm0, %xmm0
174 ; AVX512VPOPCNTDQVL-NEXT: retq
176 ; BITALG_NOVLX-LABEL: testv2i64:
177 ; BITALG_NOVLX: # %bb.0:
178 ; BITALG_NOVLX-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
179 ; BITALG_NOVLX-NEXT: vpaddq %xmm1, %xmm0, %xmm1
180 ; BITALG_NOVLX-NEXT: vpandn %xmm1, %xmm0, %xmm0
181 ; BITALG_NOVLX-NEXT: vpopcntb %zmm0, %zmm0
182 ; BITALG_NOVLX-NEXT: vpxor %xmm1, %xmm1, %xmm1
183 ; BITALG_NOVLX-NEXT: vpsadbw %xmm1, %xmm0, %xmm0
184 ; BITALG_NOVLX-NEXT: vzeroupper
185 ; BITALG_NOVLX-NEXT: retq
187 ; BITALG-LABEL: testv2i64:
189 ; BITALG-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
190 ; BITALG-NEXT: vpaddq %xmm1, %xmm0, %xmm1
191 ; BITALG-NEXT: vpandn %xmm1, %xmm0, %xmm0
192 ; BITALG-NEXT: vpopcntb %xmm0, %xmm0
193 ; BITALG-NEXT: vpxor %xmm1, %xmm1, %xmm1
194 ; BITALG-NEXT: vpsadbw %xmm1, %xmm0, %xmm0
197 ; X86-SSE-LABEL: testv2i64:
199 ; X86-SSE-NEXT: pcmpeqd %xmm1, %xmm1
200 ; X86-SSE-NEXT: paddq %xmm0, %xmm1
201 ; X86-SSE-NEXT: pandn %xmm1, %xmm0
202 ; X86-SSE-NEXT: movdqa {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
203 ; X86-SSE-NEXT: movdqa %xmm0, %xmm2
204 ; X86-SSE-NEXT: pand %xmm1, %xmm2
205 ; X86-SSE-NEXT: movdqa {{.*#+}} xmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
206 ; X86-SSE-NEXT: movdqa %xmm3, %xmm4
207 ; X86-SSE-NEXT: pshufb %xmm2, %xmm4
208 ; X86-SSE-NEXT: psrlw $4, %xmm0
209 ; X86-SSE-NEXT: pand %xmm1, %xmm0
210 ; X86-SSE-NEXT: pshufb %xmm0, %xmm3
211 ; X86-SSE-NEXT: paddb %xmm4, %xmm3
212 ; X86-SSE-NEXT: pxor %xmm0, %xmm0
213 ; X86-SSE-NEXT: psadbw %xmm3, %xmm0
215 %out = call <2 x i64> @llvm.cttz.v2i64(<2 x i64> %in, i1 0)
219 define <2 x i64> @testv2i64u(<2 x i64> %in) nounwind {
220 ; SSE2-LABEL: testv2i64u:
222 ; SSE2-NEXT: pcmpeqd %xmm1, %xmm1
223 ; SSE2-NEXT: paddq %xmm0, %xmm1
224 ; SSE2-NEXT: pandn %xmm1, %xmm0
225 ; SSE2-NEXT: movdqa %xmm0, %xmm1
226 ; SSE2-NEXT: psrlw $1, %xmm1
227 ; SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
228 ; SSE2-NEXT: psubb %xmm1, %xmm0
229 ; SSE2-NEXT: movdqa {{.*#+}} xmm1 = [51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51]
230 ; SSE2-NEXT: movdqa %xmm0, %xmm2
231 ; SSE2-NEXT: pand %xmm1, %xmm2
232 ; SSE2-NEXT: psrlw $2, %xmm0
233 ; SSE2-NEXT: pand %xmm1, %xmm0
234 ; SSE2-NEXT: paddb %xmm2, %xmm0
235 ; SSE2-NEXT: movdqa %xmm0, %xmm1
236 ; SSE2-NEXT: psrlw $4, %xmm1
237 ; SSE2-NEXT: paddb %xmm1, %xmm0
238 ; SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
239 ; SSE2-NEXT: pxor %xmm1, %xmm1
240 ; SSE2-NEXT: psadbw %xmm1, %xmm0
243 ; SSE3-LABEL: testv2i64u:
245 ; SSE3-NEXT: pcmpeqd %xmm1, %xmm1
246 ; SSE3-NEXT: paddq %xmm0, %xmm1
247 ; SSE3-NEXT: pandn %xmm1, %xmm0
248 ; SSE3-NEXT: movdqa %xmm0, %xmm1
249 ; SSE3-NEXT: psrlw $1, %xmm1
250 ; SSE3-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
251 ; SSE3-NEXT: psubb %xmm1, %xmm0
252 ; SSE3-NEXT: movdqa {{.*#+}} xmm1 = [51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51]
253 ; SSE3-NEXT: movdqa %xmm0, %xmm2
254 ; SSE3-NEXT: pand %xmm1, %xmm2
255 ; SSE3-NEXT: psrlw $2, %xmm0
256 ; SSE3-NEXT: pand %xmm1, %xmm0
257 ; SSE3-NEXT: paddb %xmm2, %xmm0
258 ; SSE3-NEXT: movdqa %xmm0, %xmm1
259 ; SSE3-NEXT: psrlw $4, %xmm1
260 ; SSE3-NEXT: paddb %xmm1, %xmm0
261 ; SSE3-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
262 ; SSE3-NEXT: pxor %xmm1, %xmm1
263 ; SSE3-NEXT: psadbw %xmm1, %xmm0
266 ; SSSE3-LABEL: testv2i64u:
268 ; SSSE3-NEXT: pcmpeqd %xmm1, %xmm1
269 ; SSSE3-NEXT: paddq %xmm0, %xmm1
270 ; SSSE3-NEXT: pandn %xmm1, %xmm0
271 ; SSSE3-NEXT: movdqa {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
272 ; SSSE3-NEXT: movdqa %xmm0, %xmm2
273 ; SSSE3-NEXT: pand %xmm1, %xmm2
274 ; SSSE3-NEXT: movdqa {{.*#+}} xmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
275 ; SSSE3-NEXT: movdqa %xmm3, %xmm4
276 ; SSSE3-NEXT: pshufb %xmm2, %xmm4
277 ; SSSE3-NEXT: psrlw $4, %xmm0
278 ; SSSE3-NEXT: pand %xmm1, %xmm0
279 ; SSSE3-NEXT: pshufb %xmm0, %xmm3
280 ; SSSE3-NEXT: paddb %xmm4, %xmm3
281 ; SSSE3-NEXT: pxor %xmm0, %xmm0
282 ; SSSE3-NEXT: psadbw %xmm3, %xmm0
285 ; SSE41-LABEL: testv2i64u:
287 ; SSE41-NEXT: pcmpeqd %xmm1, %xmm1
288 ; SSE41-NEXT: paddq %xmm0, %xmm1
289 ; SSE41-NEXT: pandn %xmm1, %xmm0
290 ; SSE41-NEXT: movdqa {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
291 ; SSE41-NEXT: movdqa %xmm0, %xmm2
292 ; SSE41-NEXT: pand %xmm1, %xmm2
293 ; SSE41-NEXT: movdqa {{.*#+}} xmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
294 ; SSE41-NEXT: movdqa %xmm3, %xmm4
295 ; SSE41-NEXT: pshufb %xmm2, %xmm4
296 ; SSE41-NEXT: psrlw $4, %xmm0
297 ; SSE41-NEXT: pand %xmm1, %xmm0
298 ; SSE41-NEXT: pshufb %xmm0, %xmm3
299 ; SSE41-NEXT: paddb %xmm4, %xmm3
300 ; SSE41-NEXT: pxor %xmm0, %xmm0
301 ; SSE41-NEXT: psadbw %xmm3, %xmm0
304 ; AVX1-LABEL: testv2i64u:
306 ; AVX1-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
307 ; AVX1-NEXT: vpaddq %xmm1, %xmm0, %xmm1
308 ; AVX1-NEXT: vpandn %xmm1, %xmm0, %xmm0
309 ; AVX1-NEXT: vbroadcastss {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
310 ; AVX1-NEXT: vpand %xmm1, %xmm0, %xmm2
311 ; AVX1-NEXT: vmovdqa {{.*#+}} xmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
312 ; AVX1-NEXT: vpshufb %xmm2, %xmm3, %xmm2
313 ; AVX1-NEXT: vpsrlw $4, %xmm0, %xmm0
314 ; AVX1-NEXT: vpand %xmm1, %xmm0, %xmm0
315 ; AVX1-NEXT: vpshufb %xmm0, %xmm3, %xmm0
316 ; AVX1-NEXT: vpaddb %xmm2, %xmm0, %xmm0
317 ; AVX1-NEXT: vpxor %xmm1, %xmm1, %xmm1
318 ; AVX1-NEXT: vpsadbw %xmm1, %xmm0, %xmm0
321 ; AVX2-LABEL: testv2i64u:
323 ; AVX2-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
324 ; AVX2-NEXT: vpaddq %xmm1, %xmm0, %xmm1
325 ; AVX2-NEXT: vpandn %xmm1, %xmm0, %xmm0
326 ; AVX2-NEXT: vpbroadcastb {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
327 ; AVX2-NEXT: vpand %xmm1, %xmm0, %xmm2
328 ; AVX2-NEXT: vmovdqa {{.*#+}} xmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
329 ; AVX2-NEXT: vpshufb %xmm2, %xmm3, %xmm2
330 ; AVX2-NEXT: vpsrlw $4, %xmm0, %xmm0
331 ; AVX2-NEXT: vpand %xmm1, %xmm0, %xmm0
332 ; AVX2-NEXT: vpshufb %xmm0, %xmm3, %xmm0
333 ; AVX2-NEXT: vpaddb %xmm2, %xmm0, %xmm0
334 ; AVX2-NEXT: vpxor %xmm1, %xmm1, %xmm1
335 ; AVX2-NEXT: vpsadbw %xmm1, %xmm0, %xmm0
338 ; AVX512CDVL-LABEL: testv2i64u:
339 ; AVX512CDVL: # %bb.0:
340 ; AVX512CDVL-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
341 ; AVX512CDVL-NEXT: vpaddq %xmm1, %xmm0, %xmm1
342 ; AVX512CDVL-NEXT: vpandn %xmm1, %xmm0, %xmm0
343 ; AVX512CDVL-NEXT: vplzcntq %xmm0, %xmm0
344 ; AVX512CDVL-NEXT: vpbroadcastq {{.*#+}} xmm1 = [64,64]
345 ; AVX512CDVL-NEXT: vpsubq %xmm0, %xmm1, %xmm0
346 ; AVX512CDVL-NEXT: retq
348 ; AVX512CD-LABEL: testv2i64u:
350 ; AVX512CD-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
351 ; AVX512CD-NEXT: vpaddq %xmm1, %xmm0, %xmm1
352 ; AVX512CD-NEXT: vpandn %xmm1, %xmm0, %xmm0
353 ; AVX512CD-NEXT: vplzcntq %zmm0, %zmm0
354 ; AVX512CD-NEXT: vpbroadcastq {{.*#+}} xmm1 = [64,64]
355 ; AVX512CD-NEXT: vpsubq %xmm0, %xmm1, %xmm0
356 ; AVX512CD-NEXT: vzeroupper
357 ; AVX512CD-NEXT: retq
359 ; AVX512VPOPCNTDQ-LABEL: testv2i64u:
360 ; AVX512VPOPCNTDQ: # %bb.0:
361 ; AVX512VPOPCNTDQ-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
362 ; AVX512VPOPCNTDQ-NEXT: vpaddq %xmm1, %xmm0, %xmm1
363 ; AVX512VPOPCNTDQ-NEXT: vpandn %xmm1, %xmm0, %xmm0
364 ; AVX512VPOPCNTDQ-NEXT: vpopcntq %zmm0, %zmm0
365 ; AVX512VPOPCNTDQ-NEXT: # kill: def $xmm0 killed $xmm0 killed $zmm0
366 ; AVX512VPOPCNTDQ-NEXT: vzeroupper
367 ; AVX512VPOPCNTDQ-NEXT: retq
369 ; AVX512VPOPCNTDQVL-LABEL: testv2i64u:
370 ; AVX512VPOPCNTDQVL: # %bb.0:
371 ; AVX512VPOPCNTDQVL-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
372 ; AVX512VPOPCNTDQVL-NEXT: vpaddq %xmm1, %xmm0, %xmm1
373 ; AVX512VPOPCNTDQVL-NEXT: vpandn %xmm1, %xmm0, %xmm0
374 ; AVX512VPOPCNTDQVL-NEXT: vpopcntq %xmm0, %xmm0
375 ; AVX512VPOPCNTDQVL-NEXT: retq
377 ; BITALG_NOVLX-LABEL: testv2i64u:
378 ; BITALG_NOVLX: # %bb.0:
379 ; BITALG_NOVLX-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
380 ; BITALG_NOVLX-NEXT: vpaddq %xmm1, %xmm0, %xmm1
381 ; BITALG_NOVLX-NEXT: vpandn %xmm1, %xmm0, %xmm0
382 ; BITALG_NOVLX-NEXT: vpopcntb %zmm0, %zmm0
383 ; BITALG_NOVLX-NEXT: vpxor %xmm1, %xmm1, %xmm1
384 ; BITALG_NOVLX-NEXT: vpsadbw %xmm1, %xmm0, %xmm0
385 ; BITALG_NOVLX-NEXT: vzeroupper
386 ; BITALG_NOVLX-NEXT: retq
388 ; BITALG-LABEL: testv2i64u:
390 ; BITALG-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
391 ; BITALG-NEXT: vpaddq %xmm1, %xmm0, %xmm1
392 ; BITALG-NEXT: vpandn %xmm1, %xmm0, %xmm0
393 ; BITALG-NEXT: vpopcntb %xmm0, %xmm0
394 ; BITALG-NEXT: vpxor %xmm1, %xmm1, %xmm1
395 ; BITALG-NEXT: vpsadbw %xmm1, %xmm0, %xmm0
398 ; X86-SSE-LABEL: testv2i64u:
400 ; X86-SSE-NEXT: pcmpeqd %xmm1, %xmm1
401 ; X86-SSE-NEXT: paddq %xmm0, %xmm1
402 ; X86-SSE-NEXT: pandn %xmm1, %xmm0
403 ; X86-SSE-NEXT: movdqa {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
404 ; X86-SSE-NEXT: movdqa %xmm0, %xmm2
405 ; X86-SSE-NEXT: pand %xmm1, %xmm2
406 ; X86-SSE-NEXT: movdqa {{.*#+}} xmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
407 ; X86-SSE-NEXT: movdqa %xmm3, %xmm4
408 ; X86-SSE-NEXT: pshufb %xmm2, %xmm4
409 ; X86-SSE-NEXT: psrlw $4, %xmm0
410 ; X86-SSE-NEXT: pand %xmm1, %xmm0
411 ; X86-SSE-NEXT: pshufb %xmm0, %xmm3
412 ; X86-SSE-NEXT: paddb %xmm4, %xmm3
413 ; X86-SSE-NEXT: pxor %xmm0, %xmm0
414 ; X86-SSE-NEXT: psadbw %xmm3, %xmm0
416 %out = call <2 x i64> @llvm.cttz.v2i64(<2 x i64> %in, i1 -1)
420 define <4 x i32> @testv4i32(<4 x i32> %in) nounwind {
421 ; SSE2-LABEL: testv4i32:
423 ; SSE2-NEXT: pcmpeqd %xmm1, %xmm1
424 ; SSE2-NEXT: paddd %xmm0, %xmm1
425 ; SSE2-NEXT: pandn %xmm1, %xmm0
426 ; SSE2-NEXT: movdqa %xmm0, %xmm1
427 ; SSE2-NEXT: psrlw $1, %xmm1
428 ; SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
429 ; SSE2-NEXT: psubb %xmm1, %xmm0
430 ; SSE2-NEXT: movdqa {{.*#+}} xmm1 = [51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51]
431 ; SSE2-NEXT: movdqa %xmm0, %xmm2
432 ; SSE2-NEXT: pand %xmm1, %xmm2
433 ; SSE2-NEXT: psrlw $2, %xmm0
434 ; SSE2-NEXT: pand %xmm1, %xmm0
435 ; SSE2-NEXT: paddb %xmm2, %xmm0
436 ; SSE2-NEXT: movdqa %xmm0, %xmm1
437 ; SSE2-NEXT: psrlw $4, %xmm1
438 ; SSE2-NEXT: paddb %xmm1, %xmm0
439 ; SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
440 ; SSE2-NEXT: pxor %xmm1, %xmm1
441 ; SSE2-NEXT: movdqa %xmm0, %xmm2
442 ; SSE2-NEXT: punpckhdq {{.*#+}} xmm2 = xmm2[2],xmm1[2],xmm2[3],xmm1[3]
443 ; SSE2-NEXT: psadbw %xmm1, %xmm2
444 ; SSE2-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
445 ; SSE2-NEXT: psadbw %xmm1, %xmm0
446 ; SSE2-NEXT: packuswb %xmm2, %xmm0
449 ; SSE3-LABEL: testv4i32:
451 ; SSE3-NEXT: pcmpeqd %xmm1, %xmm1
452 ; SSE3-NEXT: paddd %xmm0, %xmm1
453 ; SSE3-NEXT: pandn %xmm1, %xmm0
454 ; SSE3-NEXT: movdqa %xmm0, %xmm1
455 ; SSE3-NEXT: psrlw $1, %xmm1
456 ; SSE3-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
457 ; SSE3-NEXT: psubb %xmm1, %xmm0
458 ; SSE3-NEXT: movdqa {{.*#+}} xmm1 = [51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51]
459 ; SSE3-NEXT: movdqa %xmm0, %xmm2
460 ; SSE3-NEXT: pand %xmm1, %xmm2
461 ; SSE3-NEXT: psrlw $2, %xmm0
462 ; SSE3-NEXT: pand %xmm1, %xmm0
463 ; SSE3-NEXT: paddb %xmm2, %xmm0
464 ; SSE3-NEXT: movdqa %xmm0, %xmm1
465 ; SSE3-NEXT: psrlw $4, %xmm1
466 ; SSE3-NEXT: paddb %xmm1, %xmm0
467 ; SSE3-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
468 ; SSE3-NEXT: pxor %xmm1, %xmm1
469 ; SSE3-NEXT: movdqa %xmm0, %xmm2
470 ; SSE3-NEXT: punpckhdq {{.*#+}} xmm2 = xmm2[2],xmm1[2],xmm2[3],xmm1[3]
471 ; SSE3-NEXT: psadbw %xmm1, %xmm2
472 ; SSE3-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
473 ; SSE3-NEXT: psadbw %xmm1, %xmm0
474 ; SSE3-NEXT: packuswb %xmm2, %xmm0
477 ; SSSE3-LABEL: testv4i32:
479 ; SSSE3-NEXT: pcmpeqd %xmm1, %xmm1
480 ; SSSE3-NEXT: paddd %xmm0, %xmm1
481 ; SSSE3-NEXT: pandn %xmm1, %xmm0
482 ; SSSE3-NEXT: movdqa {{.*#+}} xmm2 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
483 ; SSSE3-NEXT: movdqa %xmm0, %xmm3
484 ; SSSE3-NEXT: pand %xmm2, %xmm3
485 ; SSSE3-NEXT: movdqa {{.*#+}} xmm1 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
486 ; SSSE3-NEXT: movdqa %xmm1, %xmm4
487 ; SSSE3-NEXT: pshufb %xmm3, %xmm4
488 ; SSSE3-NEXT: psrlw $4, %xmm0
489 ; SSSE3-NEXT: pand %xmm2, %xmm0
490 ; SSSE3-NEXT: pshufb %xmm0, %xmm1
491 ; SSSE3-NEXT: paddb %xmm4, %xmm1
492 ; SSSE3-NEXT: pxor %xmm0, %xmm0
493 ; SSSE3-NEXT: movdqa %xmm1, %xmm2
494 ; SSSE3-NEXT: punpckhdq {{.*#+}} xmm2 = xmm2[2],xmm0[2],xmm2[3],xmm0[3]
495 ; SSSE3-NEXT: psadbw %xmm0, %xmm2
496 ; SSSE3-NEXT: punpckldq {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
497 ; SSSE3-NEXT: psadbw %xmm0, %xmm1
498 ; SSSE3-NEXT: packuswb %xmm2, %xmm1
499 ; SSSE3-NEXT: movdqa %xmm1, %xmm0
502 ; SSE41-LABEL: testv4i32:
504 ; SSE41-NEXT: pcmpeqd %xmm1, %xmm1
505 ; SSE41-NEXT: paddd %xmm0, %xmm1
506 ; SSE41-NEXT: pandn %xmm1, %xmm0
507 ; SSE41-NEXT: movdqa {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
508 ; SSE41-NEXT: movdqa %xmm0, %xmm2
509 ; SSE41-NEXT: pand %xmm1, %xmm2
510 ; SSE41-NEXT: movdqa {{.*#+}} xmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
511 ; SSE41-NEXT: movdqa %xmm3, %xmm4
512 ; SSE41-NEXT: pshufb %xmm2, %xmm4
513 ; SSE41-NEXT: psrlw $4, %xmm0
514 ; SSE41-NEXT: pand %xmm1, %xmm0
515 ; SSE41-NEXT: pshufb %xmm0, %xmm3
516 ; SSE41-NEXT: paddb %xmm4, %xmm3
517 ; SSE41-NEXT: pxor %xmm1, %xmm1
518 ; SSE41-NEXT: pmovzxdq {{.*#+}} xmm0 = xmm3[0],zero,xmm3[1],zero
519 ; SSE41-NEXT: punpckhdq {{.*#+}} xmm3 = xmm3[2],xmm1[2],xmm3[3],xmm1[3]
520 ; SSE41-NEXT: psadbw %xmm1, %xmm3
521 ; SSE41-NEXT: psadbw %xmm1, %xmm0
522 ; SSE41-NEXT: packuswb %xmm3, %xmm0
525 ; AVX1-LABEL: testv4i32:
527 ; AVX1-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
528 ; AVX1-NEXT: vpaddd %xmm1, %xmm0, %xmm1
529 ; AVX1-NEXT: vpandn %xmm1, %xmm0, %xmm0
530 ; AVX1-NEXT: vbroadcastss {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
531 ; AVX1-NEXT: vpand %xmm1, %xmm0, %xmm2
532 ; AVX1-NEXT: vmovdqa {{.*#+}} xmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
533 ; AVX1-NEXT: vpshufb %xmm2, %xmm3, %xmm2
534 ; AVX1-NEXT: vpsrlw $4, %xmm0, %xmm0
535 ; AVX1-NEXT: vpand %xmm1, %xmm0, %xmm0
536 ; AVX1-NEXT: vpshufb %xmm0, %xmm3, %xmm0
537 ; AVX1-NEXT: vpaddb %xmm2, %xmm0, %xmm0
538 ; AVX1-NEXT: vpxor %xmm1, %xmm1, %xmm1
539 ; AVX1-NEXT: vpunpckhdq {{.*#+}} xmm2 = xmm0[2],xmm1[2],xmm0[3],xmm1[3]
540 ; AVX1-NEXT: vpsadbw %xmm1, %xmm2, %xmm2
541 ; AVX1-NEXT: vpmovzxdq {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero
542 ; AVX1-NEXT: vpsadbw %xmm1, %xmm0, %xmm0
543 ; AVX1-NEXT: vpackuswb %xmm2, %xmm0, %xmm0
546 ; AVX2-LABEL: testv4i32:
548 ; AVX2-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
549 ; AVX2-NEXT: vpaddd %xmm1, %xmm0, %xmm1
550 ; AVX2-NEXT: vpandn %xmm1, %xmm0, %xmm0
551 ; AVX2-NEXT: vpbroadcastb {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
552 ; AVX2-NEXT: vpand %xmm1, %xmm0, %xmm2
553 ; AVX2-NEXT: vmovdqa {{.*#+}} xmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
554 ; AVX2-NEXT: vpshufb %xmm2, %xmm3, %xmm2
555 ; AVX2-NEXT: vpsrlw $4, %xmm0, %xmm0
556 ; AVX2-NEXT: vpand %xmm1, %xmm0, %xmm0
557 ; AVX2-NEXT: vpshufb %xmm0, %xmm3, %xmm0
558 ; AVX2-NEXT: vpaddb %xmm2, %xmm0, %xmm0
559 ; AVX2-NEXT: vpxor %xmm1, %xmm1, %xmm1
560 ; AVX2-NEXT: vpunpckhdq {{.*#+}} xmm2 = xmm0[2],xmm1[2],xmm0[3],xmm1[3]
561 ; AVX2-NEXT: vpsadbw %xmm1, %xmm2, %xmm2
562 ; AVX2-NEXT: vpmovzxdq {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero
563 ; AVX2-NEXT: vpsadbw %xmm1, %xmm0, %xmm0
564 ; AVX2-NEXT: vpackuswb %xmm2, %xmm0, %xmm0
567 ; AVX512CDVL-LABEL: testv4i32:
568 ; AVX512CDVL: # %bb.0:
569 ; AVX512CDVL-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
570 ; AVX512CDVL-NEXT: vpaddd %xmm1, %xmm0, %xmm1
571 ; AVX512CDVL-NEXT: vpandn %xmm1, %xmm0, %xmm0
572 ; AVX512CDVL-NEXT: vplzcntd %xmm0, %xmm0
573 ; AVX512CDVL-NEXT: vpbroadcastd {{.*#+}} xmm1 = [32,32,32,32]
574 ; AVX512CDVL-NEXT: vpsubd %xmm0, %xmm1, %xmm0
575 ; AVX512CDVL-NEXT: retq
577 ; AVX512CD-LABEL: testv4i32:
579 ; AVX512CD-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
580 ; AVX512CD-NEXT: vpaddd %xmm1, %xmm0, %xmm1
581 ; AVX512CD-NEXT: vpandn %xmm1, %xmm0, %xmm0
582 ; AVX512CD-NEXT: vplzcntd %zmm0, %zmm0
583 ; AVX512CD-NEXT: vpbroadcastd {{.*#+}} xmm1 = [32,32,32,32]
584 ; AVX512CD-NEXT: vpsubd %xmm0, %xmm1, %xmm0
585 ; AVX512CD-NEXT: vzeroupper
586 ; AVX512CD-NEXT: retq
588 ; AVX512VPOPCNTDQ-LABEL: testv4i32:
589 ; AVX512VPOPCNTDQ: # %bb.0:
590 ; AVX512VPOPCNTDQ-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
591 ; AVX512VPOPCNTDQ-NEXT: vpaddd %xmm1, %xmm0, %xmm1
592 ; AVX512VPOPCNTDQ-NEXT: vpandn %xmm1, %xmm0, %xmm0
593 ; AVX512VPOPCNTDQ-NEXT: vpopcntd %zmm0, %zmm0
594 ; AVX512VPOPCNTDQ-NEXT: # kill: def $xmm0 killed $xmm0 killed $zmm0
595 ; AVX512VPOPCNTDQ-NEXT: vzeroupper
596 ; AVX512VPOPCNTDQ-NEXT: retq
598 ; AVX512VPOPCNTDQVL-LABEL: testv4i32:
599 ; AVX512VPOPCNTDQVL: # %bb.0:
600 ; AVX512VPOPCNTDQVL-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
601 ; AVX512VPOPCNTDQVL-NEXT: vpaddd %xmm1, %xmm0, %xmm1
602 ; AVX512VPOPCNTDQVL-NEXT: vpandn %xmm1, %xmm0, %xmm0
603 ; AVX512VPOPCNTDQVL-NEXT: vpopcntd %xmm0, %xmm0
604 ; AVX512VPOPCNTDQVL-NEXT: retq
606 ; BITALG_NOVLX-LABEL: testv4i32:
607 ; BITALG_NOVLX: # %bb.0:
608 ; BITALG_NOVLX-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
609 ; BITALG_NOVLX-NEXT: vpaddd %xmm1, %xmm0, %xmm1
610 ; BITALG_NOVLX-NEXT: vpandn %xmm1, %xmm0, %xmm0
611 ; BITALG_NOVLX-NEXT: vpopcntb %zmm0, %zmm0
612 ; BITALG_NOVLX-NEXT: vpxor %xmm1, %xmm1, %xmm1
613 ; BITALG_NOVLX-NEXT: vpunpckhdq {{.*#+}} xmm2 = xmm0[2],xmm1[2],xmm0[3],xmm1[3]
614 ; BITALG_NOVLX-NEXT: vpsadbw %xmm1, %xmm2, %xmm2
615 ; BITALG_NOVLX-NEXT: vpmovzxdq {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero
616 ; BITALG_NOVLX-NEXT: vpsadbw %xmm1, %xmm0, %xmm0
617 ; BITALG_NOVLX-NEXT: vpackuswb %xmm2, %xmm0, %xmm0
618 ; BITALG_NOVLX-NEXT: vzeroupper
619 ; BITALG_NOVLX-NEXT: retq
621 ; BITALG-LABEL: testv4i32:
623 ; BITALG-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
624 ; BITALG-NEXT: vpaddd %xmm1, %xmm0, %xmm1
625 ; BITALG-NEXT: vpandn %xmm1, %xmm0, %xmm0
626 ; BITALG-NEXT: vpopcntb %xmm0, %xmm0
627 ; BITALG-NEXT: vpxor %xmm1, %xmm1, %xmm1
628 ; BITALG-NEXT: vpunpckhdq {{.*#+}} xmm2 = xmm0[2],xmm1[2],xmm0[3],xmm1[3]
629 ; BITALG-NEXT: vpsadbw %xmm1, %xmm2, %xmm2
630 ; BITALG-NEXT: vpmovzxdq {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero
631 ; BITALG-NEXT: vpsadbw %xmm1, %xmm0, %xmm0
632 ; BITALG-NEXT: vpackuswb %xmm2, %xmm0, %xmm0
635 ; X86-SSE-LABEL: testv4i32:
637 ; X86-SSE-NEXT: pcmpeqd %xmm1, %xmm1
638 ; X86-SSE-NEXT: paddd %xmm0, %xmm1
639 ; X86-SSE-NEXT: pandn %xmm1, %xmm0
640 ; X86-SSE-NEXT: movdqa {{.*#+}} xmm2 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
641 ; X86-SSE-NEXT: movdqa %xmm0, %xmm3
642 ; X86-SSE-NEXT: pand %xmm2, %xmm3
643 ; X86-SSE-NEXT: movdqa {{.*#+}} xmm1 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
644 ; X86-SSE-NEXT: movdqa %xmm1, %xmm4
645 ; X86-SSE-NEXT: pshufb %xmm3, %xmm4
646 ; X86-SSE-NEXT: psrlw $4, %xmm0
647 ; X86-SSE-NEXT: pand %xmm2, %xmm0
648 ; X86-SSE-NEXT: pshufb %xmm0, %xmm1
649 ; X86-SSE-NEXT: paddb %xmm4, %xmm1
650 ; X86-SSE-NEXT: pxor %xmm2, %xmm2
651 ; X86-SSE-NEXT: pmovzxdq {{.*#+}} xmm0 = xmm1[0],zero,xmm1[1],zero
652 ; X86-SSE-NEXT: punpckhdq {{.*#+}} xmm1 = xmm1[2],xmm2[2],xmm1[3],xmm2[3]
653 ; X86-SSE-NEXT: psadbw %xmm2, %xmm1
654 ; X86-SSE-NEXT: psadbw %xmm2, %xmm0
655 ; X86-SSE-NEXT: packuswb %xmm1, %xmm0
657 %out = call <4 x i32> @llvm.cttz.v4i32(<4 x i32> %in, i1 0)
661 define <4 x i32> @testv4i32u(<4 x i32> %in) nounwind {
662 ; SSE2-LABEL: testv4i32u:
664 ; SSE2-NEXT: pcmpeqd %xmm1, %xmm1
665 ; SSE2-NEXT: paddd %xmm0, %xmm1
666 ; SSE2-NEXT: pandn %xmm1, %xmm0
667 ; SSE2-NEXT: movdqa %xmm0, %xmm1
668 ; SSE2-NEXT: psrlw $1, %xmm1
669 ; SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
670 ; SSE2-NEXT: psubb %xmm1, %xmm0
671 ; SSE2-NEXT: movdqa {{.*#+}} xmm1 = [51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51]
672 ; SSE2-NEXT: movdqa %xmm0, %xmm2
673 ; SSE2-NEXT: pand %xmm1, %xmm2
674 ; SSE2-NEXT: psrlw $2, %xmm0
675 ; SSE2-NEXT: pand %xmm1, %xmm0
676 ; SSE2-NEXT: paddb %xmm2, %xmm0
677 ; SSE2-NEXT: movdqa %xmm0, %xmm1
678 ; SSE2-NEXT: psrlw $4, %xmm1
679 ; SSE2-NEXT: paddb %xmm1, %xmm0
680 ; SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
681 ; SSE2-NEXT: pxor %xmm1, %xmm1
682 ; SSE2-NEXT: movdqa %xmm0, %xmm2
683 ; SSE2-NEXT: punpckhdq {{.*#+}} xmm2 = xmm2[2],xmm1[2],xmm2[3],xmm1[3]
684 ; SSE2-NEXT: psadbw %xmm1, %xmm2
685 ; SSE2-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
686 ; SSE2-NEXT: psadbw %xmm1, %xmm0
687 ; SSE2-NEXT: packuswb %xmm2, %xmm0
690 ; SSE3-LABEL: testv4i32u:
692 ; SSE3-NEXT: pcmpeqd %xmm1, %xmm1
693 ; SSE3-NEXT: paddd %xmm0, %xmm1
694 ; SSE3-NEXT: pandn %xmm1, %xmm0
695 ; SSE3-NEXT: movdqa %xmm0, %xmm1
696 ; SSE3-NEXT: psrlw $1, %xmm1
697 ; SSE3-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
698 ; SSE3-NEXT: psubb %xmm1, %xmm0
699 ; SSE3-NEXT: movdqa {{.*#+}} xmm1 = [51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51]
700 ; SSE3-NEXT: movdqa %xmm0, %xmm2
701 ; SSE3-NEXT: pand %xmm1, %xmm2
702 ; SSE3-NEXT: psrlw $2, %xmm0
703 ; SSE3-NEXT: pand %xmm1, %xmm0
704 ; SSE3-NEXT: paddb %xmm2, %xmm0
705 ; SSE3-NEXT: movdqa %xmm0, %xmm1
706 ; SSE3-NEXT: psrlw $4, %xmm1
707 ; SSE3-NEXT: paddb %xmm1, %xmm0
708 ; SSE3-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
709 ; SSE3-NEXT: pxor %xmm1, %xmm1
710 ; SSE3-NEXT: movdqa %xmm0, %xmm2
711 ; SSE3-NEXT: punpckhdq {{.*#+}} xmm2 = xmm2[2],xmm1[2],xmm2[3],xmm1[3]
712 ; SSE3-NEXT: psadbw %xmm1, %xmm2
713 ; SSE3-NEXT: punpckldq {{.*#+}} xmm0 = xmm0[0],xmm1[0],xmm0[1],xmm1[1]
714 ; SSE3-NEXT: psadbw %xmm1, %xmm0
715 ; SSE3-NEXT: packuswb %xmm2, %xmm0
718 ; SSSE3-LABEL: testv4i32u:
720 ; SSSE3-NEXT: pcmpeqd %xmm1, %xmm1
721 ; SSSE3-NEXT: paddd %xmm0, %xmm1
722 ; SSSE3-NEXT: pandn %xmm1, %xmm0
723 ; SSSE3-NEXT: movdqa {{.*#+}} xmm2 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
724 ; SSSE3-NEXT: movdqa %xmm0, %xmm3
725 ; SSSE3-NEXT: pand %xmm2, %xmm3
726 ; SSSE3-NEXT: movdqa {{.*#+}} xmm1 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
727 ; SSSE3-NEXT: movdqa %xmm1, %xmm4
728 ; SSSE3-NEXT: pshufb %xmm3, %xmm4
729 ; SSSE3-NEXT: psrlw $4, %xmm0
730 ; SSSE3-NEXT: pand %xmm2, %xmm0
731 ; SSSE3-NEXT: pshufb %xmm0, %xmm1
732 ; SSSE3-NEXT: paddb %xmm4, %xmm1
733 ; SSSE3-NEXT: pxor %xmm0, %xmm0
734 ; SSSE3-NEXT: movdqa %xmm1, %xmm2
735 ; SSSE3-NEXT: punpckhdq {{.*#+}} xmm2 = xmm2[2],xmm0[2],xmm2[3],xmm0[3]
736 ; SSSE3-NEXT: psadbw %xmm0, %xmm2
737 ; SSSE3-NEXT: punpckldq {{.*#+}} xmm1 = xmm1[0],xmm0[0],xmm1[1],xmm0[1]
738 ; SSSE3-NEXT: psadbw %xmm0, %xmm1
739 ; SSSE3-NEXT: packuswb %xmm2, %xmm1
740 ; SSSE3-NEXT: movdqa %xmm1, %xmm0
743 ; SSE41-LABEL: testv4i32u:
745 ; SSE41-NEXT: pcmpeqd %xmm1, %xmm1
746 ; SSE41-NEXT: paddd %xmm0, %xmm1
747 ; SSE41-NEXT: pandn %xmm1, %xmm0
748 ; SSE41-NEXT: movdqa {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
749 ; SSE41-NEXT: movdqa %xmm0, %xmm2
750 ; SSE41-NEXT: pand %xmm1, %xmm2
751 ; SSE41-NEXT: movdqa {{.*#+}} xmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
752 ; SSE41-NEXT: movdqa %xmm3, %xmm4
753 ; SSE41-NEXT: pshufb %xmm2, %xmm4
754 ; SSE41-NEXT: psrlw $4, %xmm0
755 ; SSE41-NEXT: pand %xmm1, %xmm0
756 ; SSE41-NEXT: pshufb %xmm0, %xmm3
757 ; SSE41-NEXT: paddb %xmm4, %xmm3
758 ; SSE41-NEXT: pxor %xmm1, %xmm1
759 ; SSE41-NEXT: pmovzxdq {{.*#+}} xmm0 = xmm3[0],zero,xmm3[1],zero
760 ; SSE41-NEXT: punpckhdq {{.*#+}} xmm3 = xmm3[2],xmm1[2],xmm3[3],xmm1[3]
761 ; SSE41-NEXT: psadbw %xmm1, %xmm3
762 ; SSE41-NEXT: psadbw %xmm1, %xmm0
763 ; SSE41-NEXT: packuswb %xmm3, %xmm0
766 ; AVX1-LABEL: testv4i32u:
768 ; AVX1-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
769 ; AVX1-NEXT: vpaddd %xmm1, %xmm0, %xmm1
770 ; AVX1-NEXT: vpandn %xmm1, %xmm0, %xmm0
771 ; AVX1-NEXT: vbroadcastss {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
772 ; AVX1-NEXT: vpand %xmm1, %xmm0, %xmm2
773 ; AVX1-NEXT: vmovdqa {{.*#+}} xmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
774 ; AVX1-NEXT: vpshufb %xmm2, %xmm3, %xmm2
775 ; AVX1-NEXT: vpsrlw $4, %xmm0, %xmm0
776 ; AVX1-NEXT: vpand %xmm1, %xmm0, %xmm0
777 ; AVX1-NEXT: vpshufb %xmm0, %xmm3, %xmm0
778 ; AVX1-NEXT: vpaddb %xmm2, %xmm0, %xmm0
779 ; AVX1-NEXT: vpxor %xmm1, %xmm1, %xmm1
780 ; AVX1-NEXT: vpunpckhdq {{.*#+}} xmm2 = xmm0[2],xmm1[2],xmm0[3],xmm1[3]
781 ; AVX1-NEXT: vpsadbw %xmm1, %xmm2, %xmm2
782 ; AVX1-NEXT: vpmovzxdq {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero
783 ; AVX1-NEXT: vpsadbw %xmm1, %xmm0, %xmm0
784 ; AVX1-NEXT: vpackuswb %xmm2, %xmm0, %xmm0
787 ; AVX2-LABEL: testv4i32u:
789 ; AVX2-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
790 ; AVX2-NEXT: vpaddd %xmm1, %xmm0, %xmm1
791 ; AVX2-NEXT: vpandn %xmm1, %xmm0, %xmm0
792 ; AVX2-NEXT: vpbroadcastb {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
793 ; AVX2-NEXT: vpand %xmm1, %xmm0, %xmm2
794 ; AVX2-NEXT: vmovdqa {{.*#+}} xmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
795 ; AVX2-NEXT: vpshufb %xmm2, %xmm3, %xmm2
796 ; AVX2-NEXT: vpsrlw $4, %xmm0, %xmm0
797 ; AVX2-NEXT: vpand %xmm1, %xmm0, %xmm0
798 ; AVX2-NEXT: vpshufb %xmm0, %xmm3, %xmm0
799 ; AVX2-NEXT: vpaddb %xmm2, %xmm0, %xmm0
800 ; AVX2-NEXT: vpxor %xmm1, %xmm1, %xmm1
801 ; AVX2-NEXT: vpunpckhdq {{.*#+}} xmm2 = xmm0[2],xmm1[2],xmm0[3],xmm1[3]
802 ; AVX2-NEXT: vpsadbw %xmm1, %xmm2, %xmm2
803 ; AVX2-NEXT: vpmovzxdq {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero
804 ; AVX2-NEXT: vpsadbw %xmm1, %xmm0, %xmm0
805 ; AVX2-NEXT: vpackuswb %xmm2, %xmm0, %xmm0
808 ; AVX512CDVL-LABEL: testv4i32u:
809 ; AVX512CDVL: # %bb.0:
810 ; AVX512CDVL-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
811 ; AVX512CDVL-NEXT: vpaddd %xmm1, %xmm0, %xmm1
812 ; AVX512CDVL-NEXT: vpandn %xmm1, %xmm0, %xmm0
813 ; AVX512CDVL-NEXT: vplzcntd %xmm0, %xmm0
814 ; AVX512CDVL-NEXT: vpbroadcastd {{.*#+}} xmm1 = [32,32,32,32]
815 ; AVX512CDVL-NEXT: vpsubd %xmm0, %xmm1, %xmm0
816 ; AVX512CDVL-NEXT: retq
818 ; AVX512CD-LABEL: testv4i32u:
820 ; AVX512CD-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
821 ; AVX512CD-NEXT: vpaddd %xmm1, %xmm0, %xmm1
822 ; AVX512CD-NEXT: vpandn %xmm1, %xmm0, %xmm0
823 ; AVX512CD-NEXT: vplzcntd %zmm0, %zmm0
824 ; AVX512CD-NEXT: vpbroadcastd {{.*#+}} xmm1 = [32,32,32,32]
825 ; AVX512CD-NEXT: vpsubd %xmm0, %xmm1, %xmm0
826 ; AVX512CD-NEXT: vzeroupper
827 ; AVX512CD-NEXT: retq
829 ; AVX512VPOPCNTDQ-LABEL: testv4i32u:
830 ; AVX512VPOPCNTDQ: # %bb.0:
831 ; AVX512VPOPCNTDQ-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
832 ; AVX512VPOPCNTDQ-NEXT: vpaddd %xmm1, %xmm0, %xmm1
833 ; AVX512VPOPCNTDQ-NEXT: vpandn %xmm1, %xmm0, %xmm0
834 ; AVX512VPOPCNTDQ-NEXT: vpopcntd %zmm0, %zmm0
835 ; AVX512VPOPCNTDQ-NEXT: # kill: def $xmm0 killed $xmm0 killed $zmm0
836 ; AVX512VPOPCNTDQ-NEXT: vzeroupper
837 ; AVX512VPOPCNTDQ-NEXT: retq
839 ; AVX512VPOPCNTDQVL-LABEL: testv4i32u:
840 ; AVX512VPOPCNTDQVL: # %bb.0:
841 ; AVX512VPOPCNTDQVL-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
842 ; AVX512VPOPCNTDQVL-NEXT: vpaddd %xmm1, %xmm0, %xmm1
843 ; AVX512VPOPCNTDQVL-NEXT: vpandn %xmm1, %xmm0, %xmm0
844 ; AVX512VPOPCNTDQVL-NEXT: vpopcntd %xmm0, %xmm0
845 ; AVX512VPOPCNTDQVL-NEXT: retq
847 ; BITALG_NOVLX-LABEL: testv4i32u:
848 ; BITALG_NOVLX: # %bb.0:
849 ; BITALG_NOVLX-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
850 ; BITALG_NOVLX-NEXT: vpaddd %xmm1, %xmm0, %xmm1
851 ; BITALG_NOVLX-NEXT: vpandn %xmm1, %xmm0, %xmm0
852 ; BITALG_NOVLX-NEXT: vpopcntb %zmm0, %zmm0
853 ; BITALG_NOVLX-NEXT: vpxor %xmm1, %xmm1, %xmm1
854 ; BITALG_NOVLX-NEXT: vpunpckhdq {{.*#+}} xmm2 = xmm0[2],xmm1[2],xmm0[3],xmm1[3]
855 ; BITALG_NOVLX-NEXT: vpsadbw %xmm1, %xmm2, %xmm2
856 ; BITALG_NOVLX-NEXT: vpmovzxdq {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero
857 ; BITALG_NOVLX-NEXT: vpsadbw %xmm1, %xmm0, %xmm0
858 ; BITALG_NOVLX-NEXT: vpackuswb %xmm2, %xmm0, %xmm0
859 ; BITALG_NOVLX-NEXT: vzeroupper
860 ; BITALG_NOVLX-NEXT: retq
862 ; BITALG-LABEL: testv4i32u:
864 ; BITALG-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
865 ; BITALG-NEXT: vpaddd %xmm1, %xmm0, %xmm1
866 ; BITALG-NEXT: vpandn %xmm1, %xmm0, %xmm0
867 ; BITALG-NEXT: vpopcntb %xmm0, %xmm0
868 ; BITALG-NEXT: vpxor %xmm1, %xmm1, %xmm1
869 ; BITALG-NEXT: vpunpckhdq {{.*#+}} xmm2 = xmm0[2],xmm1[2],xmm0[3],xmm1[3]
870 ; BITALG-NEXT: vpsadbw %xmm1, %xmm2, %xmm2
871 ; BITALG-NEXT: vpmovzxdq {{.*#+}} xmm0 = xmm0[0],zero,xmm0[1],zero
872 ; BITALG-NEXT: vpsadbw %xmm1, %xmm0, %xmm0
873 ; BITALG-NEXT: vpackuswb %xmm2, %xmm0, %xmm0
876 ; X86-SSE-LABEL: testv4i32u:
878 ; X86-SSE-NEXT: pcmpeqd %xmm1, %xmm1
879 ; X86-SSE-NEXT: paddd %xmm0, %xmm1
880 ; X86-SSE-NEXT: pandn %xmm1, %xmm0
881 ; X86-SSE-NEXT: movdqa {{.*#+}} xmm2 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
882 ; X86-SSE-NEXT: movdqa %xmm0, %xmm3
883 ; X86-SSE-NEXT: pand %xmm2, %xmm3
884 ; X86-SSE-NEXT: movdqa {{.*#+}} xmm1 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
885 ; X86-SSE-NEXT: movdqa %xmm1, %xmm4
886 ; X86-SSE-NEXT: pshufb %xmm3, %xmm4
887 ; X86-SSE-NEXT: psrlw $4, %xmm0
888 ; X86-SSE-NEXT: pand %xmm2, %xmm0
889 ; X86-SSE-NEXT: pshufb %xmm0, %xmm1
890 ; X86-SSE-NEXT: paddb %xmm4, %xmm1
891 ; X86-SSE-NEXT: pxor %xmm2, %xmm2
892 ; X86-SSE-NEXT: pmovzxdq {{.*#+}} xmm0 = xmm1[0],zero,xmm1[1],zero
893 ; X86-SSE-NEXT: punpckhdq {{.*#+}} xmm1 = xmm1[2],xmm2[2],xmm1[3],xmm2[3]
894 ; X86-SSE-NEXT: psadbw %xmm2, %xmm1
895 ; X86-SSE-NEXT: psadbw %xmm2, %xmm0
896 ; X86-SSE-NEXT: packuswb %xmm1, %xmm0
898 %out = call <4 x i32> @llvm.cttz.v4i32(<4 x i32> %in, i1 -1)
902 define <8 x i16> @testv8i16(<8 x i16> %in) nounwind {
903 ; SSE2-LABEL: testv8i16:
905 ; SSE2-NEXT: pcmpeqd %xmm1, %xmm1
906 ; SSE2-NEXT: paddw %xmm0, %xmm1
907 ; SSE2-NEXT: pandn %xmm1, %xmm0
908 ; SSE2-NEXT: movdqa %xmm0, %xmm1
909 ; SSE2-NEXT: psrlw $1, %xmm1
910 ; SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
911 ; SSE2-NEXT: psubb %xmm1, %xmm0
912 ; SSE2-NEXT: movdqa {{.*#+}} xmm1 = [51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51]
913 ; SSE2-NEXT: movdqa %xmm0, %xmm2
914 ; SSE2-NEXT: pand %xmm1, %xmm2
915 ; SSE2-NEXT: psrlw $2, %xmm0
916 ; SSE2-NEXT: pand %xmm1, %xmm0
917 ; SSE2-NEXT: paddb %xmm2, %xmm0
918 ; SSE2-NEXT: movdqa %xmm0, %xmm1
919 ; SSE2-NEXT: psrlw $4, %xmm1
920 ; SSE2-NEXT: paddb %xmm1, %xmm0
921 ; SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
922 ; SSE2-NEXT: movdqa %xmm0, %xmm1
923 ; SSE2-NEXT: psllw $8, %xmm1
924 ; SSE2-NEXT: paddb %xmm1, %xmm0
925 ; SSE2-NEXT: psrlw $8, %xmm0
928 ; SSE3-LABEL: testv8i16:
930 ; SSE3-NEXT: pcmpeqd %xmm1, %xmm1
931 ; SSE3-NEXT: paddw %xmm0, %xmm1
932 ; SSE3-NEXT: pandn %xmm1, %xmm0
933 ; SSE3-NEXT: movdqa %xmm0, %xmm1
934 ; SSE3-NEXT: psrlw $1, %xmm1
935 ; SSE3-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
936 ; SSE3-NEXT: psubb %xmm1, %xmm0
937 ; SSE3-NEXT: movdqa {{.*#+}} xmm1 = [51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51]
938 ; SSE3-NEXT: movdqa %xmm0, %xmm2
939 ; SSE3-NEXT: pand %xmm1, %xmm2
940 ; SSE3-NEXT: psrlw $2, %xmm0
941 ; SSE3-NEXT: pand %xmm1, %xmm0
942 ; SSE3-NEXT: paddb %xmm2, %xmm0
943 ; SSE3-NEXT: movdqa %xmm0, %xmm1
944 ; SSE3-NEXT: psrlw $4, %xmm1
945 ; SSE3-NEXT: paddb %xmm1, %xmm0
946 ; SSE3-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
947 ; SSE3-NEXT: movdqa %xmm0, %xmm1
948 ; SSE3-NEXT: psllw $8, %xmm1
949 ; SSE3-NEXT: paddb %xmm1, %xmm0
950 ; SSE3-NEXT: psrlw $8, %xmm0
953 ; SSSE3-LABEL: testv8i16:
955 ; SSSE3-NEXT: pcmpeqd %xmm1, %xmm1
956 ; SSSE3-NEXT: paddw %xmm0, %xmm1
957 ; SSSE3-NEXT: pandn %xmm1, %xmm0
958 ; SSSE3-NEXT: movdqa {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
959 ; SSSE3-NEXT: movdqa %xmm0, %xmm2
960 ; SSSE3-NEXT: pand %xmm1, %xmm2
961 ; SSSE3-NEXT: movdqa {{.*#+}} xmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
962 ; SSSE3-NEXT: movdqa %xmm3, %xmm4
963 ; SSSE3-NEXT: pshufb %xmm2, %xmm4
964 ; SSSE3-NEXT: psrlw $4, %xmm0
965 ; SSSE3-NEXT: pand %xmm1, %xmm0
966 ; SSSE3-NEXT: pshufb %xmm0, %xmm3
967 ; SSSE3-NEXT: paddb %xmm4, %xmm3
968 ; SSSE3-NEXT: movdqa %xmm3, %xmm0
969 ; SSSE3-NEXT: psllw $8, %xmm0
970 ; SSSE3-NEXT: paddb %xmm3, %xmm0
971 ; SSSE3-NEXT: psrlw $8, %xmm0
974 ; SSE41-LABEL: testv8i16:
976 ; SSE41-NEXT: pcmpeqd %xmm1, %xmm1
977 ; SSE41-NEXT: paddw %xmm0, %xmm1
978 ; SSE41-NEXT: pandn %xmm1, %xmm0
979 ; SSE41-NEXT: movdqa {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
980 ; SSE41-NEXT: movdqa %xmm0, %xmm2
981 ; SSE41-NEXT: pand %xmm1, %xmm2
982 ; SSE41-NEXT: movdqa {{.*#+}} xmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
983 ; SSE41-NEXT: movdqa %xmm3, %xmm4
984 ; SSE41-NEXT: pshufb %xmm2, %xmm4
985 ; SSE41-NEXT: psrlw $4, %xmm0
986 ; SSE41-NEXT: pand %xmm1, %xmm0
987 ; SSE41-NEXT: pshufb %xmm0, %xmm3
988 ; SSE41-NEXT: paddb %xmm4, %xmm3
989 ; SSE41-NEXT: movdqa %xmm3, %xmm0
990 ; SSE41-NEXT: psllw $8, %xmm0
991 ; SSE41-NEXT: paddb %xmm3, %xmm0
992 ; SSE41-NEXT: psrlw $8, %xmm0
995 ; AVX1-LABEL: testv8i16:
997 ; AVX1-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
998 ; AVX1-NEXT: vpaddw %xmm1, %xmm0, %xmm1
999 ; AVX1-NEXT: vpandn %xmm1, %xmm0, %xmm0
1000 ; AVX1-NEXT: vbroadcastss {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
1001 ; AVX1-NEXT: vpand %xmm1, %xmm0, %xmm2
1002 ; AVX1-NEXT: vmovdqa {{.*#+}} xmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
1003 ; AVX1-NEXT: vpshufb %xmm2, %xmm3, %xmm2
1004 ; AVX1-NEXT: vpsrlw $4, %xmm0, %xmm0
1005 ; AVX1-NEXT: vpand %xmm1, %xmm0, %xmm0
1006 ; AVX1-NEXT: vpshufb %xmm0, %xmm3, %xmm0
1007 ; AVX1-NEXT: vpaddb %xmm2, %xmm0, %xmm0
1008 ; AVX1-NEXT: vpsllw $8, %xmm0, %xmm1
1009 ; AVX1-NEXT: vpaddb %xmm0, %xmm1, %xmm0
1010 ; AVX1-NEXT: vpsrlw $8, %xmm0, %xmm0
1013 ; AVX2-LABEL: testv8i16:
1015 ; AVX2-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
1016 ; AVX2-NEXT: vpaddw %xmm1, %xmm0, %xmm1
1017 ; AVX2-NEXT: vpandn %xmm1, %xmm0, %xmm0
1018 ; AVX2-NEXT: vpbroadcastb {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
1019 ; AVX2-NEXT: vpand %xmm1, %xmm0, %xmm2
1020 ; AVX2-NEXT: vmovdqa {{.*#+}} xmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
1021 ; AVX2-NEXT: vpshufb %xmm2, %xmm3, %xmm2
1022 ; AVX2-NEXT: vpsrlw $4, %xmm0, %xmm0
1023 ; AVX2-NEXT: vpand %xmm1, %xmm0, %xmm0
1024 ; AVX2-NEXT: vpshufb %xmm0, %xmm3, %xmm0
1025 ; AVX2-NEXT: vpaddb %xmm2, %xmm0, %xmm0
1026 ; AVX2-NEXT: vpsllw $8, %xmm0, %xmm1
1027 ; AVX2-NEXT: vpaddb %xmm0, %xmm1, %xmm0
1028 ; AVX2-NEXT: vpsrlw $8, %xmm0, %xmm0
1031 ; AVX512CDVL-LABEL: testv8i16:
1032 ; AVX512CDVL: # %bb.0:
1033 ; AVX512CDVL-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
1034 ; AVX512CDVL-NEXT: vpaddw %xmm1, %xmm0, %xmm1
1035 ; AVX512CDVL-NEXT: vpandn %xmm1, %xmm0, %xmm0
1036 ; AVX512CDVL-NEXT: vpbroadcastd {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
1037 ; AVX512CDVL-NEXT: vpand %xmm1, %xmm0, %xmm2
1038 ; AVX512CDVL-NEXT: vmovdqa {{.*#+}} xmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
1039 ; AVX512CDVL-NEXT: vpshufb %xmm2, %xmm3, %xmm2
1040 ; AVX512CDVL-NEXT: vpsrlw $4, %xmm0, %xmm0
1041 ; AVX512CDVL-NEXT: vpand %xmm1, %xmm0, %xmm0
1042 ; AVX512CDVL-NEXT: vpshufb %xmm0, %xmm3, %xmm0
1043 ; AVX512CDVL-NEXT: vpaddb %xmm2, %xmm0, %xmm0
1044 ; AVX512CDVL-NEXT: vpsllw $8, %xmm0, %xmm1
1045 ; AVX512CDVL-NEXT: vpaddb %xmm0, %xmm1, %xmm0
1046 ; AVX512CDVL-NEXT: vpsrlw $8, %xmm0, %xmm0
1047 ; AVX512CDVL-NEXT: retq
1049 ; AVX512CD-LABEL: testv8i16:
1050 ; AVX512CD: # %bb.0:
1051 ; AVX512CD-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
1052 ; AVX512CD-NEXT: vpaddw %xmm1, %xmm0, %xmm1
1053 ; AVX512CD-NEXT: vpandn %xmm1, %xmm0, %xmm0
1054 ; AVX512CD-NEXT: vpbroadcastb {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
1055 ; AVX512CD-NEXT: vpand %xmm1, %xmm0, %xmm2
1056 ; AVX512CD-NEXT: vmovdqa {{.*#+}} xmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
1057 ; AVX512CD-NEXT: vpshufb %xmm2, %xmm3, %xmm2
1058 ; AVX512CD-NEXT: vpsrlw $4, %xmm0, %xmm0
1059 ; AVX512CD-NEXT: vpand %xmm1, %xmm0, %xmm0
1060 ; AVX512CD-NEXT: vpshufb %xmm0, %xmm3, %xmm0
1061 ; AVX512CD-NEXT: vpaddb %xmm2, %xmm0, %xmm0
1062 ; AVX512CD-NEXT: vpsllw $8, %xmm0, %xmm1
1063 ; AVX512CD-NEXT: vpaddb %xmm0, %xmm1, %xmm0
1064 ; AVX512CD-NEXT: vpsrlw $8, %xmm0, %xmm0
1065 ; AVX512CD-NEXT: retq
1067 ; AVX512VPOPCNTDQ-LABEL: testv8i16:
1068 ; AVX512VPOPCNTDQ: # %bb.0:
1069 ; AVX512VPOPCNTDQ-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
1070 ; AVX512VPOPCNTDQ-NEXT: vpaddw %xmm1, %xmm0, %xmm1
1071 ; AVX512VPOPCNTDQ-NEXT: vpandn %xmm1, %xmm0, %xmm0
1072 ; AVX512VPOPCNTDQ-NEXT: vpmovzxwd {{.*#+}} ymm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero
1073 ; AVX512VPOPCNTDQ-NEXT: vpopcntd %zmm0, %zmm0
1074 ; AVX512VPOPCNTDQ-NEXT: vpmovdw %zmm0, %ymm0
1075 ; AVX512VPOPCNTDQ-NEXT: # kill: def $xmm0 killed $xmm0 killed $ymm0
1076 ; AVX512VPOPCNTDQ-NEXT: vzeroupper
1077 ; AVX512VPOPCNTDQ-NEXT: retq
1079 ; AVX512VPOPCNTDQVL-LABEL: testv8i16:
1080 ; AVX512VPOPCNTDQVL: # %bb.0:
1081 ; AVX512VPOPCNTDQVL-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
1082 ; AVX512VPOPCNTDQVL-NEXT: vpaddw %xmm1, %xmm0, %xmm1
1083 ; AVX512VPOPCNTDQVL-NEXT: vpandn %xmm1, %xmm0, %xmm0
1084 ; AVX512VPOPCNTDQVL-NEXT: vpmovzxwd {{.*#+}} ymm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero
1085 ; AVX512VPOPCNTDQVL-NEXT: vpopcntd %ymm0, %ymm0
1086 ; AVX512VPOPCNTDQVL-NEXT: vpmovdw %ymm0, %xmm0
1087 ; AVX512VPOPCNTDQVL-NEXT: vzeroupper
1088 ; AVX512VPOPCNTDQVL-NEXT: retq
1090 ; BITALG_NOVLX-LABEL: testv8i16:
1091 ; BITALG_NOVLX: # %bb.0:
1092 ; BITALG_NOVLX-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
1093 ; BITALG_NOVLX-NEXT: vpaddw %xmm1, %xmm0, %xmm1
1094 ; BITALG_NOVLX-NEXT: vpandn %xmm1, %xmm0, %xmm0
1095 ; BITALG_NOVLX-NEXT: vpopcntw %zmm0, %zmm0
1096 ; BITALG_NOVLX-NEXT: # kill: def $xmm0 killed $xmm0 killed $zmm0
1097 ; BITALG_NOVLX-NEXT: vzeroupper
1098 ; BITALG_NOVLX-NEXT: retq
1100 ; BITALG-LABEL: testv8i16:
1102 ; BITALG-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
1103 ; BITALG-NEXT: vpaddw %xmm1, %xmm0, %xmm1
1104 ; BITALG-NEXT: vpandn %xmm1, %xmm0, %xmm0
1105 ; BITALG-NEXT: vpopcntw %xmm0, %xmm0
1108 ; X86-SSE-LABEL: testv8i16:
1110 ; X86-SSE-NEXT: pcmpeqd %xmm1, %xmm1
1111 ; X86-SSE-NEXT: paddw %xmm0, %xmm1
1112 ; X86-SSE-NEXT: pandn %xmm1, %xmm0
1113 ; X86-SSE-NEXT: movdqa {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
1114 ; X86-SSE-NEXT: movdqa %xmm0, %xmm2
1115 ; X86-SSE-NEXT: pand %xmm1, %xmm2
1116 ; X86-SSE-NEXT: movdqa {{.*#+}} xmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
1117 ; X86-SSE-NEXT: movdqa %xmm3, %xmm4
1118 ; X86-SSE-NEXT: pshufb %xmm2, %xmm4
1119 ; X86-SSE-NEXT: psrlw $4, %xmm0
1120 ; X86-SSE-NEXT: pand %xmm1, %xmm0
1121 ; X86-SSE-NEXT: pshufb %xmm0, %xmm3
1122 ; X86-SSE-NEXT: paddb %xmm4, %xmm3
1123 ; X86-SSE-NEXT: movdqa %xmm3, %xmm0
1124 ; X86-SSE-NEXT: psllw $8, %xmm0
1125 ; X86-SSE-NEXT: paddb %xmm3, %xmm0
1126 ; X86-SSE-NEXT: psrlw $8, %xmm0
1127 ; X86-SSE-NEXT: retl
1128 %out = call <8 x i16> @llvm.cttz.v8i16(<8 x i16> %in, i1 0)
1132 define <8 x i16> @testv8i16u(<8 x i16> %in) nounwind {
1133 ; SSE2-LABEL: testv8i16u:
1135 ; SSE2-NEXT: pcmpeqd %xmm1, %xmm1
1136 ; SSE2-NEXT: paddw %xmm0, %xmm1
1137 ; SSE2-NEXT: pandn %xmm1, %xmm0
1138 ; SSE2-NEXT: movdqa %xmm0, %xmm1
1139 ; SSE2-NEXT: psrlw $1, %xmm1
1140 ; SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
1141 ; SSE2-NEXT: psubb %xmm1, %xmm0
1142 ; SSE2-NEXT: movdqa {{.*#+}} xmm1 = [51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51]
1143 ; SSE2-NEXT: movdqa %xmm0, %xmm2
1144 ; SSE2-NEXT: pand %xmm1, %xmm2
1145 ; SSE2-NEXT: psrlw $2, %xmm0
1146 ; SSE2-NEXT: pand %xmm1, %xmm0
1147 ; SSE2-NEXT: paddb %xmm2, %xmm0
1148 ; SSE2-NEXT: movdqa %xmm0, %xmm1
1149 ; SSE2-NEXT: psrlw $4, %xmm1
1150 ; SSE2-NEXT: paddb %xmm1, %xmm0
1151 ; SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
1152 ; SSE2-NEXT: movdqa %xmm0, %xmm1
1153 ; SSE2-NEXT: psllw $8, %xmm1
1154 ; SSE2-NEXT: paddb %xmm1, %xmm0
1155 ; SSE2-NEXT: psrlw $8, %xmm0
1158 ; SSE3-LABEL: testv8i16u:
1160 ; SSE3-NEXT: pcmpeqd %xmm1, %xmm1
1161 ; SSE3-NEXT: paddw %xmm0, %xmm1
1162 ; SSE3-NEXT: pandn %xmm1, %xmm0
1163 ; SSE3-NEXT: movdqa %xmm0, %xmm1
1164 ; SSE3-NEXT: psrlw $1, %xmm1
1165 ; SSE3-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
1166 ; SSE3-NEXT: psubb %xmm1, %xmm0
1167 ; SSE3-NEXT: movdqa {{.*#+}} xmm1 = [51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51]
1168 ; SSE3-NEXT: movdqa %xmm0, %xmm2
1169 ; SSE3-NEXT: pand %xmm1, %xmm2
1170 ; SSE3-NEXT: psrlw $2, %xmm0
1171 ; SSE3-NEXT: pand %xmm1, %xmm0
1172 ; SSE3-NEXT: paddb %xmm2, %xmm0
1173 ; SSE3-NEXT: movdqa %xmm0, %xmm1
1174 ; SSE3-NEXT: psrlw $4, %xmm1
1175 ; SSE3-NEXT: paddb %xmm1, %xmm0
1176 ; SSE3-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
1177 ; SSE3-NEXT: movdqa %xmm0, %xmm1
1178 ; SSE3-NEXT: psllw $8, %xmm1
1179 ; SSE3-NEXT: paddb %xmm1, %xmm0
1180 ; SSE3-NEXT: psrlw $8, %xmm0
1183 ; SSSE3-LABEL: testv8i16u:
1185 ; SSSE3-NEXT: pcmpeqd %xmm1, %xmm1
1186 ; SSSE3-NEXT: paddw %xmm0, %xmm1
1187 ; SSSE3-NEXT: pandn %xmm1, %xmm0
1188 ; SSSE3-NEXT: movdqa {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
1189 ; SSSE3-NEXT: movdqa %xmm0, %xmm2
1190 ; SSSE3-NEXT: pand %xmm1, %xmm2
1191 ; SSSE3-NEXT: movdqa {{.*#+}} xmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
1192 ; SSSE3-NEXT: movdqa %xmm3, %xmm4
1193 ; SSSE3-NEXT: pshufb %xmm2, %xmm4
1194 ; SSSE3-NEXT: psrlw $4, %xmm0
1195 ; SSSE3-NEXT: pand %xmm1, %xmm0
1196 ; SSSE3-NEXT: pshufb %xmm0, %xmm3
1197 ; SSSE3-NEXT: paddb %xmm4, %xmm3
1198 ; SSSE3-NEXT: movdqa %xmm3, %xmm0
1199 ; SSSE3-NEXT: psllw $8, %xmm0
1200 ; SSSE3-NEXT: paddb %xmm3, %xmm0
1201 ; SSSE3-NEXT: psrlw $8, %xmm0
1204 ; SSE41-LABEL: testv8i16u:
1206 ; SSE41-NEXT: pcmpeqd %xmm1, %xmm1
1207 ; SSE41-NEXT: paddw %xmm0, %xmm1
1208 ; SSE41-NEXT: pandn %xmm1, %xmm0
1209 ; SSE41-NEXT: movdqa {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
1210 ; SSE41-NEXT: movdqa %xmm0, %xmm2
1211 ; SSE41-NEXT: pand %xmm1, %xmm2
1212 ; SSE41-NEXT: movdqa {{.*#+}} xmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
1213 ; SSE41-NEXT: movdqa %xmm3, %xmm4
1214 ; SSE41-NEXT: pshufb %xmm2, %xmm4
1215 ; SSE41-NEXT: psrlw $4, %xmm0
1216 ; SSE41-NEXT: pand %xmm1, %xmm0
1217 ; SSE41-NEXT: pshufb %xmm0, %xmm3
1218 ; SSE41-NEXT: paddb %xmm4, %xmm3
1219 ; SSE41-NEXT: movdqa %xmm3, %xmm0
1220 ; SSE41-NEXT: psllw $8, %xmm0
1221 ; SSE41-NEXT: paddb %xmm3, %xmm0
1222 ; SSE41-NEXT: psrlw $8, %xmm0
1225 ; AVX1-LABEL: testv8i16u:
1227 ; AVX1-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
1228 ; AVX1-NEXT: vpaddw %xmm1, %xmm0, %xmm1
1229 ; AVX1-NEXT: vpandn %xmm1, %xmm0, %xmm0
1230 ; AVX1-NEXT: vbroadcastss {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
1231 ; AVX1-NEXT: vpand %xmm1, %xmm0, %xmm2
1232 ; AVX1-NEXT: vmovdqa {{.*#+}} xmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
1233 ; AVX1-NEXT: vpshufb %xmm2, %xmm3, %xmm2
1234 ; AVX1-NEXT: vpsrlw $4, %xmm0, %xmm0
1235 ; AVX1-NEXT: vpand %xmm1, %xmm0, %xmm0
1236 ; AVX1-NEXT: vpshufb %xmm0, %xmm3, %xmm0
1237 ; AVX1-NEXT: vpaddb %xmm2, %xmm0, %xmm0
1238 ; AVX1-NEXT: vpsllw $8, %xmm0, %xmm1
1239 ; AVX1-NEXT: vpaddb %xmm0, %xmm1, %xmm0
1240 ; AVX1-NEXT: vpsrlw $8, %xmm0, %xmm0
1243 ; AVX2-LABEL: testv8i16u:
1245 ; AVX2-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
1246 ; AVX2-NEXT: vpaddw %xmm1, %xmm0, %xmm1
1247 ; AVX2-NEXT: vpandn %xmm1, %xmm0, %xmm0
1248 ; AVX2-NEXT: vpbroadcastb {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
1249 ; AVX2-NEXT: vpand %xmm1, %xmm0, %xmm2
1250 ; AVX2-NEXT: vmovdqa {{.*#+}} xmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
1251 ; AVX2-NEXT: vpshufb %xmm2, %xmm3, %xmm2
1252 ; AVX2-NEXT: vpsrlw $4, %xmm0, %xmm0
1253 ; AVX2-NEXT: vpand %xmm1, %xmm0, %xmm0
1254 ; AVX2-NEXT: vpshufb %xmm0, %xmm3, %xmm0
1255 ; AVX2-NEXT: vpaddb %xmm2, %xmm0, %xmm0
1256 ; AVX2-NEXT: vpsllw $8, %xmm0, %xmm1
1257 ; AVX2-NEXT: vpaddb %xmm0, %xmm1, %xmm0
1258 ; AVX2-NEXT: vpsrlw $8, %xmm0, %xmm0
1261 ; AVX512CDVL-LABEL: testv8i16u:
1262 ; AVX512CDVL: # %bb.0:
1263 ; AVX512CDVL-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
1264 ; AVX512CDVL-NEXT: vpaddw %xmm1, %xmm0, %xmm1
1265 ; AVX512CDVL-NEXT: vpandn %xmm1, %xmm0, %xmm0
1266 ; AVX512CDVL-NEXT: vpbroadcastd {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
1267 ; AVX512CDVL-NEXT: vpand %xmm1, %xmm0, %xmm2
1268 ; AVX512CDVL-NEXT: vmovdqa {{.*#+}} xmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
1269 ; AVX512CDVL-NEXT: vpshufb %xmm2, %xmm3, %xmm2
1270 ; AVX512CDVL-NEXT: vpsrlw $4, %xmm0, %xmm0
1271 ; AVX512CDVL-NEXT: vpand %xmm1, %xmm0, %xmm0
1272 ; AVX512CDVL-NEXT: vpshufb %xmm0, %xmm3, %xmm0
1273 ; AVX512CDVL-NEXT: vpaddb %xmm2, %xmm0, %xmm0
1274 ; AVX512CDVL-NEXT: vpsllw $8, %xmm0, %xmm1
1275 ; AVX512CDVL-NEXT: vpaddb %xmm0, %xmm1, %xmm0
1276 ; AVX512CDVL-NEXT: vpsrlw $8, %xmm0, %xmm0
1277 ; AVX512CDVL-NEXT: retq
1279 ; AVX512CD-LABEL: testv8i16u:
1280 ; AVX512CD: # %bb.0:
1281 ; AVX512CD-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
1282 ; AVX512CD-NEXT: vpaddw %xmm1, %xmm0, %xmm1
1283 ; AVX512CD-NEXT: vpandn %xmm1, %xmm0, %xmm0
1284 ; AVX512CD-NEXT: vpbroadcastb {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
1285 ; AVX512CD-NEXT: vpand %xmm1, %xmm0, %xmm2
1286 ; AVX512CD-NEXT: vmovdqa {{.*#+}} xmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
1287 ; AVX512CD-NEXT: vpshufb %xmm2, %xmm3, %xmm2
1288 ; AVX512CD-NEXT: vpsrlw $4, %xmm0, %xmm0
1289 ; AVX512CD-NEXT: vpand %xmm1, %xmm0, %xmm0
1290 ; AVX512CD-NEXT: vpshufb %xmm0, %xmm3, %xmm0
1291 ; AVX512CD-NEXT: vpaddb %xmm2, %xmm0, %xmm0
1292 ; AVX512CD-NEXT: vpsllw $8, %xmm0, %xmm1
1293 ; AVX512CD-NEXT: vpaddb %xmm0, %xmm1, %xmm0
1294 ; AVX512CD-NEXT: vpsrlw $8, %xmm0, %xmm0
1295 ; AVX512CD-NEXT: retq
1297 ; AVX512VPOPCNTDQ-LABEL: testv8i16u:
1298 ; AVX512VPOPCNTDQ: # %bb.0:
1299 ; AVX512VPOPCNTDQ-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
1300 ; AVX512VPOPCNTDQ-NEXT: vpaddw %xmm1, %xmm0, %xmm1
1301 ; AVX512VPOPCNTDQ-NEXT: vpandn %xmm1, %xmm0, %xmm0
1302 ; AVX512VPOPCNTDQ-NEXT: vpmovzxwd {{.*#+}} ymm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero
1303 ; AVX512VPOPCNTDQ-NEXT: vpopcntd %zmm0, %zmm0
1304 ; AVX512VPOPCNTDQ-NEXT: vpmovdw %zmm0, %ymm0
1305 ; AVX512VPOPCNTDQ-NEXT: # kill: def $xmm0 killed $xmm0 killed $ymm0
1306 ; AVX512VPOPCNTDQ-NEXT: vzeroupper
1307 ; AVX512VPOPCNTDQ-NEXT: retq
1309 ; AVX512VPOPCNTDQVL-LABEL: testv8i16u:
1310 ; AVX512VPOPCNTDQVL: # %bb.0:
1311 ; AVX512VPOPCNTDQVL-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
1312 ; AVX512VPOPCNTDQVL-NEXT: vpaddw %xmm1, %xmm0, %xmm1
1313 ; AVX512VPOPCNTDQVL-NEXT: vpandn %xmm1, %xmm0, %xmm0
1314 ; AVX512VPOPCNTDQVL-NEXT: vpmovzxwd {{.*#+}} ymm0 = xmm0[0],zero,xmm0[1],zero,xmm0[2],zero,xmm0[3],zero,xmm0[4],zero,xmm0[5],zero,xmm0[6],zero,xmm0[7],zero
1315 ; AVX512VPOPCNTDQVL-NEXT: vpopcntd %ymm0, %ymm0
1316 ; AVX512VPOPCNTDQVL-NEXT: vpmovdw %ymm0, %xmm0
1317 ; AVX512VPOPCNTDQVL-NEXT: vzeroupper
1318 ; AVX512VPOPCNTDQVL-NEXT: retq
1320 ; BITALG_NOVLX-LABEL: testv8i16u:
1321 ; BITALG_NOVLX: # %bb.0:
1322 ; BITALG_NOVLX-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
1323 ; BITALG_NOVLX-NEXT: vpaddw %xmm1, %xmm0, %xmm1
1324 ; BITALG_NOVLX-NEXT: vpandn %xmm1, %xmm0, %xmm0
1325 ; BITALG_NOVLX-NEXT: vpopcntw %zmm0, %zmm0
1326 ; BITALG_NOVLX-NEXT: # kill: def $xmm0 killed $xmm0 killed $zmm0
1327 ; BITALG_NOVLX-NEXT: vzeroupper
1328 ; BITALG_NOVLX-NEXT: retq
1330 ; BITALG-LABEL: testv8i16u:
1332 ; BITALG-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
1333 ; BITALG-NEXT: vpaddw %xmm1, %xmm0, %xmm1
1334 ; BITALG-NEXT: vpandn %xmm1, %xmm0, %xmm0
1335 ; BITALG-NEXT: vpopcntw %xmm0, %xmm0
1338 ; X86-SSE-LABEL: testv8i16u:
1340 ; X86-SSE-NEXT: pcmpeqd %xmm1, %xmm1
1341 ; X86-SSE-NEXT: paddw %xmm0, %xmm1
1342 ; X86-SSE-NEXT: pandn %xmm1, %xmm0
1343 ; X86-SSE-NEXT: movdqa {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
1344 ; X86-SSE-NEXT: movdqa %xmm0, %xmm2
1345 ; X86-SSE-NEXT: pand %xmm1, %xmm2
1346 ; X86-SSE-NEXT: movdqa {{.*#+}} xmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
1347 ; X86-SSE-NEXT: movdqa %xmm3, %xmm4
1348 ; X86-SSE-NEXT: pshufb %xmm2, %xmm4
1349 ; X86-SSE-NEXT: psrlw $4, %xmm0
1350 ; X86-SSE-NEXT: pand %xmm1, %xmm0
1351 ; X86-SSE-NEXT: pshufb %xmm0, %xmm3
1352 ; X86-SSE-NEXT: paddb %xmm4, %xmm3
1353 ; X86-SSE-NEXT: movdqa %xmm3, %xmm0
1354 ; X86-SSE-NEXT: psllw $8, %xmm0
1355 ; X86-SSE-NEXT: paddb %xmm3, %xmm0
1356 ; X86-SSE-NEXT: psrlw $8, %xmm0
1357 ; X86-SSE-NEXT: retl
1358 %out = call <8 x i16> @llvm.cttz.v8i16(<8 x i16> %in, i1 -1)
1362 define <16 x i8> @testv16i8(<16 x i8> %in) nounwind {
1363 ; SSE2-LABEL: testv16i8:
1365 ; SSE2-NEXT: pcmpeqd %xmm1, %xmm1
1366 ; SSE2-NEXT: paddb %xmm0, %xmm1
1367 ; SSE2-NEXT: pandn %xmm1, %xmm0
1368 ; SSE2-NEXT: movdqa %xmm0, %xmm1
1369 ; SSE2-NEXT: psrlw $1, %xmm1
1370 ; SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
1371 ; SSE2-NEXT: psubb %xmm1, %xmm0
1372 ; SSE2-NEXT: movdqa {{.*#+}} xmm1 = [51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51]
1373 ; SSE2-NEXT: movdqa %xmm0, %xmm2
1374 ; SSE2-NEXT: pand %xmm1, %xmm2
1375 ; SSE2-NEXT: psrlw $2, %xmm0
1376 ; SSE2-NEXT: pand %xmm1, %xmm0
1377 ; SSE2-NEXT: paddb %xmm2, %xmm0
1378 ; SSE2-NEXT: movdqa %xmm0, %xmm1
1379 ; SSE2-NEXT: psrlw $4, %xmm1
1380 ; SSE2-NEXT: paddb %xmm1, %xmm0
1381 ; SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
1384 ; SSE3-LABEL: testv16i8:
1386 ; SSE3-NEXT: pcmpeqd %xmm1, %xmm1
1387 ; SSE3-NEXT: paddb %xmm0, %xmm1
1388 ; SSE3-NEXT: pandn %xmm1, %xmm0
1389 ; SSE3-NEXT: movdqa %xmm0, %xmm1
1390 ; SSE3-NEXT: psrlw $1, %xmm1
1391 ; SSE3-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
1392 ; SSE3-NEXT: psubb %xmm1, %xmm0
1393 ; SSE3-NEXT: movdqa {{.*#+}} xmm1 = [51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51]
1394 ; SSE3-NEXT: movdqa %xmm0, %xmm2
1395 ; SSE3-NEXT: pand %xmm1, %xmm2
1396 ; SSE3-NEXT: psrlw $2, %xmm0
1397 ; SSE3-NEXT: pand %xmm1, %xmm0
1398 ; SSE3-NEXT: paddb %xmm2, %xmm0
1399 ; SSE3-NEXT: movdqa %xmm0, %xmm1
1400 ; SSE3-NEXT: psrlw $4, %xmm1
1401 ; SSE3-NEXT: paddb %xmm1, %xmm0
1402 ; SSE3-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
1405 ; SSSE3-LABEL: testv16i8:
1407 ; SSSE3-NEXT: pcmpeqd %xmm1, %xmm1
1408 ; SSSE3-NEXT: paddb %xmm0, %xmm1
1409 ; SSSE3-NEXT: pandn %xmm1, %xmm0
1410 ; SSSE3-NEXT: movdqa {{.*#+}} xmm2 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
1411 ; SSSE3-NEXT: movdqa %xmm0, %xmm3
1412 ; SSSE3-NEXT: pand %xmm2, %xmm3
1413 ; SSSE3-NEXT: movdqa {{.*#+}} xmm1 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
1414 ; SSSE3-NEXT: movdqa %xmm1, %xmm4
1415 ; SSSE3-NEXT: pshufb %xmm3, %xmm4
1416 ; SSSE3-NEXT: psrlw $4, %xmm0
1417 ; SSSE3-NEXT: pand %xmm2, %xmm0
1418 ; SSSE3-NEXT: pshufb %xmm0, %xmm1
1419 ; SSSE3-NEXT: paddb %xmm4, %xmm1
1420 ; SSSE3-NEXT: movdqa %xmm1, %xmm0
1423 ; SSE41-LABEL: testv16i8:
1425 ; SSE41-NEXT: pcmpeqd %xmm1, %xmm1
1426 ; SSE41-NEXT: paddb %xmm0, %xmm1
1427 ; SSE41-NEXT: pandn %xmm1, %xmm0
1428 ; SSE41-NEXT: movdqa {{.*#+}} xmm2 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
1429 ; SSE41-NEXT: movdqa %xmm0, %xmm3
1430 ; SSE41-NEXT: pand %xmm2, %xmm3
1431 ; SSE41-NEXT: movdqa {{.*#+}} xmm1 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
1432 ; SSE41-NEXT: movdqa %xmm1, %xmm4
1433 ; SSE41-NEXT: pshufb %xmm3, %xmm4
1434 ; SSE41-NEXT: psrlw $4, %xmm0
1435 ; SSE41-NEXT: pand %xmm2, %xmm0
1436 ; SSE41-NEXT: pshufb %xmm0, %xmm1
1437 ; SSE41-NEXT: paddb %xmm4, %xmm1
1438 ; SSE41-NEXT: movdqa %xmm1, %xmm0
1441 ; AVX1-LABEL: testv16i8:
1443 ; AVX1-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
1444 ; AVX1-NEXT: vpaddb %xmm1, %xmm0, %xmm1
1445 ; AVX1-NEXT: vpandn %xmm1, %xmm0, %xmm0
1446 ; AVX1-NEXT: vbroadcastss {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
1447 ; AVX1-NEXT: vpand %xmm1, %xmm0, %xmm2
1448 ; AVX1-NEXT: vmovdqa {{.*#+}} xmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
1449 ; AVX1-NEXT: vpshufb %xmm2, %xmm3, %xmm2
1450 ; AVX1-NEXT: vpsrlw $4, %xmm0, %xmm0
1451 ; AVX1-NEXT: vpand %xmm1, %xmm0, %xmm0
1452 ; AVX1-NEXT: vpshufb %xmm0, %xmm3, %xmm0
1453 ; AVX1-NEXT: vpaddb %xmm2, %xmm0, %xmm0
1456 ; AVX2-LABEL: testv16i8:
1458 ; AVX2-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
1459 ; AVX2-NEXT: vpaddb %xmm1, %xmm0, %xmm1
1460 ; AVX2-NEXT: vpandn %xmm1, %xmm0, %xmm0
1461 ; AVX2-NEXT: vpbroadcastb {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
1462 ; AVX2-NEXT: vpand %xmm1, %xmm0, %xmm2
1463 ; AVX2-NEXT: vmovdqa {{.*#+}} xmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
1464 ; AVX2-NEXT: vpshufb %xmm2, %xmm3, %xmm2
1465 ; AVX2-NEXT: vpsrlw $4, %xmm0, %xmm0
1466 ; AVX2-NEXT: vpand %xmm1, %xmm0, %xmm0
1467 ; AVX2-NEXT: vpshufb %xmm0, %xmm3, %xmm0
1468 ; AVX2-NEXT: vpaddb %xmm2, %xmm0, %xmm0
1471 ; AVX512CDVL-LABEL: testv16i8:
1472 ; AVX512CDVL: # %bb.0:
1473 ; AVX512CDVL-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
1474 ; AVX512CDVL-NEXT: vpaddb %xmm1, %xmm0, %xmm1
1475 ; AVX512CDVL-NEXT: vpandn %xmm1, %xmm0, %xmm0
1476 ; AVX512CDVL-NEXT: vpbroadcastd {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
1477 ; AVX512CDVL-NEXT: vpand %xmm1, %xmm0, %xmm2
1478 ; AVX512CDVL-NEXT: vmovdqa {{.*#+}} xmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
1479 ; AVX512CDVL-NEXT: vpshufb %xmm2, %xmm3, %xmm2
1480 ; AVX512CDVL-NEXT: vpsrlw $4, %xmm0, %xmm0
1481 ; AVX512CDVL-NEXT: vpand %xmm1, %xmm0, %xmm0
1482 ; AVX512CDVL-NEXT: vpshufb %xmm0, %xmm3, %xmm0
1483 ; AVX512CDVL-NEXT: vpaddb %xmm2, %xmm0, %xmm0
1484 ; AVX512CDVL-NEXT: retq
1486 ; AVX512CD-LABEL: testv16i8:
1487 ; AVX512CD: # %bb.0:
1488 ; AVX512CD-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
1489 ; AVX512CD-NEXT: vpaddb %xmm1, %xmm0, %xmm1
1490 ; AVX512CD-NEXT: vpandn %xmm1, %xmm0, %xmm0
1491 ; AVX512CD-NEXT: vpbroadcastb {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
1492 ; AVX512CD-NEXT: vpand %xmm1, %xmm0, %xmm2
1493 ; AVX512CD-NEXT: vmovdqa {{.*#+}} xmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
1494 ; AVX512CD-NEXT: vpshufb %xmm2, %xmm3, %xmm2
1495 ; AVX512CD-NEXT: vpsrlw $4, %xmm0, %xmm0
1496 ; AVX512CD-NEXT: vpand %xmm1, %xmm0, %xmm0
1497 ; AVX512CD-NEXT: vpshufb %xmm0, %xmm3, %xmm0
1498 ; AVX512CD-NEXT: vpaddb %xmm2, %xmm0, %xmm0
1499 ; AVX512CD-NEXT: retq
1501 ; AVX512VPOPCNTDQ-LABEL: testv16i8:
1502 ; AVX512VPOPCNTDQ: # %bb.0:
1503 ; AVX512VPOPCNTDQ-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
1504 ; AVX512VPOPCNTDQ-NEXT: vpaddb %xmm1, %xmm0, %xmm1
1505 ; AVX512VPOPCNTDQ-NEXT: vpandn %xmm1, %xmm0, %xmm0
1506 ; AVX512VPOPCNTDQ-NEXT: vpmovzxbd {{.*#+}} zmm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero,xmm0[2],zero,zero,zero,xmm0[3],zero,zero,zero,xmm0[4],zero,zero,zero,xmm0[5],zero,zero,zero,xmm0[6],zero,zero,zero,xmm0[7],zero,zero,zero,xmm0[8],zero,zero,zero,xmm0[9],zero,zero,zero,xmm0[10],zero,zero,zero,xmm0[11],zero,zero,zero,xmm0[12],zero,zero,zero,xmm0[13],zero,zero,zero,xmm0[14],zero,zero,zero,xmm0[15],zero,zero,zero
1507 ; AVX512VPOPCNTDQ-NEXT: vpopcntd %zmm0, %zmm0
1508 ; AVX512VPOPCNTDQ-NEXT: vpmovdb %zmm0, %xmm0
1509 ; AVX512VPOPCNTDQ-NEXT: vzeroupper
1510 ; AVX512VPOPCNTDQ-NEXT: retq
1512 ; AVX512VPOPCNTDQVL-LABEL: testv16i8:
1513 ; AVX512VPOPCNTDQVL: # %bb.0:
1514 ; AVX512VPOPCNTDQVL-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
1515 ; AVX512VPOPCNTDQVL-NEXT: vpaddb %xmm1, %xmm0, %xmm1
1516 ; AVX512VPOPCNTDQVL-NEXT: vpandn %xmm1, %xmm0, %xmm0
1517 ; AVX512VPOPCNTDQVL-NEXT: vpmovzxbd {{.*#+}} zmm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero,xmm0[2],zero,zero,zero,xmm0[3],zero,zero,zero,xmm0[4],zero,zero,zero,xmm0[5],zero,zero,zero,xmm0[6],zero,zero,zero,xmm0[7],zero,zero,zero,xmm0[8],zero,zero,zero,xmm0[9],zero,zero,zero,xmm0[10],zero,zero,zero,xmm0[11],zero,zero,zero,xmm0[12],zero,zero,zero,xmm0[13],zero,zero,zero,xmm0[14],zero,zero,zero,xmm0[15],zero,zero,zero
1518 ; AVX512VPOPCNTDQVL-NEXT: vpopcntd %zmm0, %zmm0
1519 ; AVX512VPOPCNTDQVL-NEXT: vpmovdb %zmm0, %xmm0
1520 ; AVX512VPOPCNTDQVL-NEXT: vzeroupper
1521 ; AVX512VPOPCNTDQVL-NEXT: retq
1523 ; BITALG_NOVLX-LABEL: testv16i8:
1524 ; BITALG_NOVLX: # %bb.0:
1525 ; BITALG_NOVLX-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
1526 ; BITALG_NOVLX-NEXT: vpaddb %xmm1, %xmm0, %xmm1
1527 ; BITALG_NOVLX-NEXT: vpandn %xmm1, %xmm0, %xmm0
1528 ; BITALG_NOVLX-NEXT: vpopcntb %zmm0, %zmm0
1529 ; BITALG_NOVLX-NEXT: # kill: def $xmm0 killed $xmm0 killed $zmm0
1530 ; BITALG_NOVLX-NEXT: vzeroupper
1531 ; BITALG_NOVLX-NEXT: retq
1533 ; BITALG-LABEL: testv16i8:
1535 ; BITALG-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
1536 ; BITALG-NEXT: vpaddb %xmm1, %xmm0, %xmm1
1537 ; BITALG-NEXT: vpandn %xmm1, %xmm0, %xmm0
1538 ; BITALG-NEXT: vpopcntb %xmm0, %xmm0
1541 ; X86-SSE-LABEL: testv16i8:
1543 ; X86-SSE-NEXT: pcmpeqd %xmm1, %xmm1
1544 ; X86-SSE-NEXT: paddb %xmm0, %xmm1
1545 ; X86-SSE-NEXT: pandn %xmm1, %xmm0
1546 ; X86-SSE-NEXT: movdqa {{.*#+}} xmm2 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
1547 ; X86-SSE-NEXT: movdqa %xmm0, %xmm3
1548 ; X86-SSE-NEXT: pand %xmm2, %xmm3
1549 ; X86-SSE-NEXT: movdqa {{.*#+}} xmm1 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
1550 ; X86-SSE-NEXT: movdqa %xmm1, %xmm4
1551 ; X86-SSE-NEXT: pshufb %xmm3, %xmm4
1552 ; X86-SSE-NEXT: psrlw $4, %xmm0
1553 ; X86-SSE-NEXT: pand %xmm2, %xmm0
1554 ; X86-SSE-NEXT: pshufb %xmm0, %xmm1
1555 ; X86-SSE-NEXT: paddb %xmm4, %xmm1
1556 ; X86-SSE-NEXT: movdqa %xmm1, %xmm0
1557 ; X86-SSE-NEXT: retl
1558 %out = call <16 x i8> @llvm.cttz.v16i8(<16 x i8> %in, i1 0)
1562 define <16 x i8> @testv16i8u(<16 x i8> %in) nounwind {
1563 ; SSE2-LABEL: testv16i8u:
1565 ; SSE2-NEXT: pcmpeqd %xmm1, %xmm1
1566 ; SSE2-NEXT: paddb %xmm0, %xmm1
1567 ; SSE2-NEXT: pandn %xmm1, %xmm0
1568 ; SSE2-NEXT: movdqa %xmm0, %xmm1
1569 ; SSE2-NEXT: psrlw $1, %xmm1
1570 ; SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
1571 ; SSE2-NEXT: psubb %xmm1, %xmm0
1572 ; SSE2-NEXT: movdqa {{.*#+}} xmm1 = [51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51]
1573 ; SSE2-NEXT: movdqa %xmm0, %xmm2
1574 ; SSE2-NEXT: pand %xmm1, %xmm2
1575 ; SSE2-NEXT: psrlw $2, %xmm0
1576 ; SSE2-NEXT: pand %xmm1, %xmm0
1577 ; SSE2-NEXT: paddb %xmm2, %xmm0
1578 ; SSE2-NEXT: movdqa %xmm0, %xmm1
1579 ; SSE2-NEXT: psrlw $4, %xmm1
1580 ; SSE2-NEXT: paddb %xmm1, %xmm0
1581 ; SSE2-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
1584 ; SSE3-LABEL: testv16i8u:
1586 ; SSE3-NEXT: pcmpeqd %xmm1, %xmm1
1587 ; SSE3-NEXT: paddb %xmm0, %xmm1
1588 ; SSE3-NEXT: pandn %xmm1, %xmm0
1589 ; SSE3-NEXT: movdqa %xmm0, %xmm1
1590 ; SSE3-NEXT: psrlw $1, %xmm1
1591 ; SSE3-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm1
1592 ; SSE3-NEXT: psubb %xmm1, %xmm0
1593 ; SSE3-NEXT: movdqa {{.*#+}} xmm1 = [51,51,51,51,51,51,51,51,51,51,51,51,51,51,51,51]
1594 ; SSE3-NEXT: movdqa %xmm0, %xmm2
1595 ; SSE3-NEXT: pand %xmm1, %xmm2
1596 ; SSE3-NEXT: psrlw $2, %xmm0
1597 ; SSE3-NEXT: pand %xmm1, %xmm0
1598 ; SSE3-NEXT: paddb %xmm2, %xmm0
1599 ; SSE3-NEXT: movdqa %xmm0, %xmm1
1600 ; SSE3-NEXT: psrlw $4, %xmm1
1601 ; SSE3-NEXT: paddb %xmm1, %xmm0
1602 ; SSE3-NEXT: pand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
1605 ; SSSE3-LABEL: testv16i8u:
1607 ; SSSE3-NEXT: pcmpeqd %xmm1, %xmm1
1608 ; SSSE3-NEXT: paddb %xmm0, %xmm1
1609 ; SSSE3-NEXT: pandn %xmm1, %xmm0
1610 ; SSSE3-NEXT: movdqa {{.*#+}} xmm2 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
1611 ; SSSE3-NEXT: movdqa %xmm0, %xmm3
1612 ; SSSE3-NEXT: pand %xmm2, %xmm3
1613 ; SSSE3-NEXT: movdqa {{.*#+}} xmm1 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
1614 ; SSSE3-NEXT: movdqa %xmm1, %xmm4
1615 ; SSSE3-NEXT: pshufb %xmm3, %xmm4
1616 ; SSSE3-NEXT: psrlw $4, %xmm0
1617 ; SSSE3-NEXT: pand %xmm2, %xmm0
1618 ; SSSE3-NEXT: pshufb %xmm0, %xmm1
1619 ; SSSE3-NEXT: paddb %xmm4, %xmm1
1620 ; SSSE3-NEXT: movdqa %xmm1, %xmm0
1623 ; SSE41-LABEL: testv16i8u:
1625 ; SSE41-NEXT: pcmpeqd %xmm1, %xmm1
1626 ; SSE41-NEXT: paddb %xmm0, %xmm1
1627 ; SSE41-NEXT: pandn %xmm1, %xmm0
1628 ; SSE41-NEXT: movdqa {{.*#+}} xmm2 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
1629 ; SSE41-NEXT: movdqa %xmm0, %xmm3
1630 ; SSE41-NEXT: pand %xmm2, %xmm3
1631 ; SSE41-NEXT: movdqa {{.*#+}} xmm1 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
1632 ; SSE41-NEXT: movdqa %xmm1, %xmm4
1633 ; SSE41-NEXT: pshufb %xmm3, %xmm4
1634 ; SSE41-NEXT: psrlw $4, %xmm0
1635 ; SSE41-NEXT: pand %xmm2, %xmm0
1636 ; SSE41-NEXT: pshufb %xmm0, %xmm1
1637 ; SSE41-NEXT: paddb %xmm4, %xmm1
1638 ; SSE41-NEXT: movdqa %xmm1, %xmm0
1641 ; AVX1-LABEL: testv16i8u:
1643 ; AVX1-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
1644 ; AVX1-NEXT: vpaddb %xmm1, %xmm0, %xmm1
1645 ; AVX1-NEXT: vpandn %xmm1, %xmm0, %xmm0
1646 ; AVX1-NEXT: vbroadcastss {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
1647 ; AVX1-NEXT: vpand %xmm1, %xmm0, %xmm2
1648 ; AVX1-NEXT: vmovdqa {{.*#+}} xmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
1649 ; AVX1-NEXT: vpshufb %xmm2, %xmm3, %xmm2
1650 ; AVX1-NEXT: vpsrlw $4, %xmm0, %xmm0
1651 ; AVX1-NEXT: vpand %xmm1, %xmm0, %xmm0
1652 ; AVX1-NEXT: vpshufb %xmm0, %xmm3, %xmm0
1653 ; AVX1-NEXT: vpaddb %xmm2, %xmm0, %xmm0
1656 ; AVX2-LABEL: testv16i8u:
1658 ; AVX2-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
1659 ; AVX2-NEXT: vpaddb %xmm1, %xmm0, %xmm1
1660 ; AVX2-NEXT: vpandn %xmm1, %xmm0, %xmm0
1661 ; AVX2-NEXT: vpbroadcastb {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
1662 ; AVX2-NEXT: vpand %xmm1, %xmm0, %xmm2
1663 ; AVX2-NEXT: vmovdqa {{.*#+}} xmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
1664 ; AVX2-NEXT: vpshufb %xmm2, %xmm3, %xmm2
1665 ; AVX2-NEXT: vpsrlw $4, %xmm0, %xmm0
1666 ; AVX2-NEXT: vpand %xmm1, %xmm0, %xmm0
1667 ; AVX2-NEXT: vpshufb %xmm0, %xmm3, %xmm0
1668 ; AVX2-NEXT: vpaddb %xmm2, %xmm0, %xmm0
1671 ; AVX512CDVL-LABEL: testv16i8u:
1672 ; AVX512CDVL: # %bb.0:
1673 ; AVX512CDVL-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
1674 ; AVX512CDVL-NEXT: vpaddb %xmm1, %xmm0, %xmm1
1675 ; AVX512CDVL-NEXT: vpandn %xmm1, %xmm0, %xmm0
1676 ; AVX512CDVL-NEXT: vpbroadcastd {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
1677 ; AVX512CDVL-NEXT: vpand %xmm1, %xmm0, %xmm2
1678 ; AVX512CDVL-NEXT: vmovdqa {{.*#+}} xmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
1679 ; AVX512CDVL-NEXT: vpshufb %xmm2, %xmm3, %xmm2
1680 ; AVX512CDVL-NEXT: vpsrlw $4, %xmm0, %xmm0
1681 ; AVX512CDVL-NEXT: vpand %xmm1, %xmm0, %xmm0
1682 ; AVX512CDVL-NEXT: vpshufb %xmm0, %xmm3, %xmm0
1683 ; AVX512CDVL-NEXT: vpaddb %xmm2, %xmm0, %xmm0
1684 ; AVX512CDVL-NEXT: retq
1686 ; AVX512CD-LABEL: testv16i8u:
1687 ; AVX512CD: # %bb.0:
1688 ; AVX512CD-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
1689 ; AVX512CD-NEXT: vpaddb %xmm1, %xmm0, %xmm1
1690 ; AVX512CD-NEXT: vpandn %xmm1, %xmm0, %xmm0
1691 ; AVX512CD-NEXT: vpbroadcastb {{.*#+}} xmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
1692 ; AVX512CD-NEXT: vpand %xmm1, %xmm0, %xmm2
1693 ; AVX512CD-NEXT: vmovdqa {{.*#+}} xmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
1694 ; AVX512CD-NEXT: vpshufb %xmm2, %xmm3, %xmm2
1695 ; AVX512CD-NEXT: vpsrlw $4, %xmm0, %xmm0
1696 ; AVX512CD-NEXT: vpand %xmm1, %xmm0, %xmm0
1697 ; AVX512CD-NEXT: vpshufb %xmm0, %xmm3, %xmm0
1698 ; AVX512CD-NEXT: vpaddb %xmm2, %xmm0, %xmm0
1699 ; AVX512CD-NEXT: retq
1701 ; AVX512VPOPCNTDQ-LABEL: testv16i8u:
1702 ; AVX512VPOPCNTDQ: # %bb.0:
1703 ; AVX512VPOPCNTDQ-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
1704 ; AVX512VPOPCNTDQ-NEXT: vpaddb %xmm1, %xmm0, %xmm1
1705 ; AVX512VPOPCNTDQ-NEXT: vpandn %xmm1, %xmm0, %xmm0
1706 ; AVX512VPOPCNTDQ-NEXT: vpmovzxbd {{.*#+}} zmm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero,xmm0[2],zero,zero,zero,xmm0[3],zero,zero,zero,xmm0[4],zero,zero,zero,xmm0[5],zero,zero,zero,xmm0[6],zero,zero,zero,xmm0[7],zero,zero,zero,xmm0[8],zero,zero,zero,xmm0[9],zero,zero,zero,xmm0[10],zero,zero,zero,xmm0[11],zero,zero,zero,xmm0[12],zero,zero,zero,xmm0[13],zero,zero,zero,xmm0[14],zero,zero,zero,xmm0[15],zero,zero,zero
1707 ; AVX512VPOPCNTDQ-NEXT: vpopcntd %zmm0, %zmm0
1708 ; AVX512VPOPCNTDQ-NEXT: vpmovdb %zmm0, %xmm0
1709 ; AVX512VPOPCNTDQ-NEXT: vzeroupper
1710 ; AVX512VPOPCNTDQ-NEXT: retq
1712 ; AVX512VPOPCNTDQVL-LABEL: testv16i8u:
1713 ; AVX512VPOPCNTDQVL: # %bb.0:
1714 ; AVX512VPOPCNTDQVL-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
1715 ; AVX512VPOPCNTDQVL-NEXT: vpaddb %xmm1, %xmm0, %xmm1
1716 ; AVX512VPOPCNTDQVL-NEXT: vpandn %xmm1, %xmm0, %xmm0
1717 ; AVX512VPOPCNTDQVL-NEXT: vpmovzxbd {{.*#+}} zmm0 = xmm0[0],zero,zero,zero,xmm0[1],zero,zero,zero,xmm0[2],zero,zero,zero,xmm0[3],zero,zero,zero,xmm0[4],zero,zero,zero,xmm0[5],zero,zero,zero,xmm0[6],zero,zero,zero,xmm0[7],zero,zero,zero,xmm0[8],zero,zero,zero,xmm0[9],zero,zero,zero,xmm0[10],zero,zero,zero,xmm0[11],zero,zero,zero,xmm0[12],zero,zero,zero,xmm0[13],zero,zero,zero,xmm0[14],zero,zero,zero,xmm0[15],zero,zero,zero
1718 ; AVX512VPOPCNTDQVL-NEXT: vpopcntd %zmm0, %zmm0
1719 ; AVX512VPOPCNTDQVL-NEXT: vpmovdb %zmm0, %xmm0
1720 ; AVX512VPOPCNTDQVL-NEXT: vzeroupper
1721 ; AVX512VPOPCNTDQVL-NEXT: retq
1723 ; BITALG_NOVLX-LABEL: testv16i8u:
1724 ; BITALG_NOVLX: # %bb.0:
1725 ; BITALG_NOVLX-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
1726 ; BITALG_NOVLX-NEXT: vpaddb %xmm1, %xmm0, %xmm1
1727 ; BITALG_NOVLX-NEXT: vpandn %xmm1, %xmm0, %xmm0
1728 ; BITALG_NOVLX-NEXT: vpopcntb %zmm0, %zmm0
1729 ; BITALG_NOVLX-NEXT: # kill: def $xmm0 killed $xmm0 killed $zmm0
1730 ; BITALG_NOVLX-NEXT: vzeroupper
1731 ; BITALG_NOVLX-NEXT: retq
1733 ; BITALG-LABEL: testv16i8u:
1735 ; BITALG-NEXT: vpcmpeqd %xmm1, %xmm1, %xmm1
1736 ; BITALG-NEXT: vpaddb %xmm1, %xmm0, %xmm1
1737 ; BITALG-NEXT: vpandn %xmm1, %xmm0, %xmm0
1738 ; BITALG-NEXT: vpopcntb %xmm0, %xmm0
1741 ; X86-SSE-LABEL: testv16i8u:
1743 ; X86-SSE-NEXT: pcmpeqd %xmm1, %xmm1
1744 ; X86-SSE-NEXT: paddb %xmm0, %xmm1
1745 ; X86-SSE-NEXT: pandn %xmm1, %xmm0
1746 ; X86-SSE-NEXT: movdqa {{.*#+}} xmm2 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
1747 ; X86-SSE-NEXT: movdqa %xmm0, %xmm3
1748 ; X86-SSE-NEXT: pand %xmm2, %xmm3
1749 ; X86-SSE-NEXT: movdqa {{.*#+}} xmm1 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
1750 ; X86-SSE-NEXT: movdqa %xmm1, %xmm4
1751 ; X86-SSE-NEXT: pshufb %xmm3, %xmm4
1752 ; X86-SSE-NEXT: psrlw $4, %xmm0
1753 ; X86-SSE-NEXT: pand %xmm2, %xmm0
1754 ; X86-SSE-NEXT: pshufb %xmm0, %xmm1
1755 ; X86-SSE-NEXT: paddb %xmm4, %xmm1
1756 ; X86-SSE-NEXT: movdqa %xmm1, %xmm0
1757 ; X86-SSE-NEXT: retl
1758 %out = call <16 x i8> @llvm.cttz.v16i8(<16 x i8> %in, i1 -1)
1762 define <2 x i64> @foldv2i64() nounwind {
1763 ; SSE-LABEL: foldv2i64:
1765 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [8,0,0,0]
1768 ; AVX-LABEL: foldv2i64:
1770 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,0,0]
1773 ; AVX512VPOPCNTDQ-LABEL: foldv2i64:
1774 ; AVX512VPOPCNTDQ: # %bb.0:
1775 ; AVX512VPOPCNTDQ-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,0,0]
1776 ; AVX512VPOPCNTDQ-NEXT: retq
1778 ; AVX512VPOPCNTDQVL-LABEL: foldv2i64:
1779 ; AVX512VPOPCNTDQVL: # %bb.0:
1780 ; AVX512VPOPCNTDQVL-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,0,0]
1781 ; AVX512VPOPCNTDQVL-NEXT: retq
1783 ; BITALG_NOVLX-LABEL: foldv2i64:
1784 ; BITALG_NOVLX: # %bb.0:
1785 ; BITALG_NOVLX-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,0,0]
1786 ; BITALG_NOVLX-NEXT: retq
1788 ; BITALG-LABEL: foldv2i64:
1790 ; BITALG-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,0,0]
1793 ; X86-SSE-LABEL: foldv2i64:
1795 ; X86-SSE-NEXT: movaps {{.*#+}} xmm0 = [8,0,0,0]
1796 ; X86-SSE-NEXT: retl
1797 %out = call <2 x i64> @llvm.cttz.v2i64(<2 x i64> <i64 256, i64 -1>, i1 0)
1801 define <2 x i64> @foldv2i64u() nounwind {
1802 ; SSE-LABEL: foldv2i64u:
1804 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [8,0,0,0]
1807 ; AVX-LABEL: foldv2i64u:
1809 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,0,0]
1812 ; AVX512VPOPCNTDQ-LABEL: foldv2i64u:
1813 ; AVX512VPOPCNTDQ: # %bb.0:
1814 ; AVX512VPOPCNTDQ-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,0,0]
1815 ; AVX512VPOPCNTDQ-NEXT: retq
1817 ; AVX512VPOPCNTDQVL-LABEL: foldv2i64u:
1818 ; AVX512VPOPCNTDQVL: # %bb.0:
1819 ; AVX512VPOPCNTDQVL-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,0,0]
1820 ; AVX512VPOPCNTDQVL-NEXT: retq
1822 ; BITALG_NOVLX-LABEL: foldv2i64u:
1823 ; BITALG_NOVLX: # %bb.0:
1824 ; BITALG_NOVLX-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,0,0]
1825 ; BITALG_NOVLX-NEXT: retq
1827 ; BITALG-LABEL: foldv2i64u:
1829 ; BITALG-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,0,0]
1832 ; X86-SSE-LABEL: foldv2i64u:
1834 ; X86-SSE-NEXT: movaps {{.*#+}} xmm0 = [8,0,0,0]
1835 ; X86-SSE-NEXT: retl
1836 %out = call <2 x i64> @llvm.cttz.v2i64(<2 x i64> <i64 256, i64 -1>, i1 -1)
1840 define <4 x i32> @foldv4i32() nounwind {
1841 ; SSE-LABEL: foldv4i32:
1843 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [8,0,32,0]
1846 ; AVX-LABEL: foldv4i32:
1848 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,32,0]
1851 ; AVX512VPOPCNTDQ-LABEL: foldv4i32:
1852 ; AVX512VPOPCNTDQ: # %bb.0:
1853 ; AVX512VPOPCNTDQ-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,32,0]
1854 ; AVX512VPOPCNTDQ-NEXT: retq
1856 ; AVX512VPOPCNTDQVL-LABEL: foldv4i32:
1857 ; AVX512VPOPCNTDQVL: # %bb.0:
1858 ; AVX512VPOPCNTDQVL-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,32,0]
1859 ; AVX512VPOPCNTDQVL-NEXT: retq
1861 ; BITALG_NOVLX-LABEL: foldv4i32:
1862 ; BITALG_NOVLX: # %bb.0:
1863 ; BITALG_NOVLX-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,32,0]
1864 ; BITALG_NOVLX-NEXT: retq
1866 ; BITALG-LABEL: foldv4i32:
1868 ; BITALG-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,32,0]
1871 ; X86-SSE-LABEL: foldv4i32:
1873 ; X86-SSE-NEXT: movaps {{.*#+}} xmm0 = [8,0,32,0]
1874 ; X86-SSE-NEXT: retl
1875 %out = call <4 x i32> @llvm.cttz.v4i32(<4 x i32> <i32 256, i32 -1, i32 0, i32 255>, i1 0)
1879 define <4 x i32> @foldv4i32u() nounwind {
1880 ; SSE-LABEL: foldv4i32u:
1882 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [8,0,32,0]
1885 ; AVX-LABEL: foldv4i32u:
1887 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,32,0]
1890 ; AVX512VPOPCNTDQ-LABEL: foldv4i32u:
1891 ; AVX512VPOPCNTDQ: # %bb.0:
1892 ; AVX512VPOPCNTDQ-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,32,0]
1893 ; AVX512VPOPCNTDQ-NEXT: retq
1895 ; AVX512VPOPCNTDQVL-LABEL: foldv4i32u:
1896 ; AVX512VPOPCNTDQVL: # %bb.0:
1897 ; AVX512VPOPCNTDQVL-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,32,0]
1898 ; AVX512VPOPCNTDQVL-NEXT: retq
1900 ; BITALG_NOVLX-LABEL: foldv4i32u:
1901 ; BITALG_NOVLX: # %bb.0:
1902 ; BITALG_NOVLX-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,32,0]
1903 ; BITALG_NOVLX-NEXT: retq
1905 ; BITALG-LABEL: foldv4i32u:
1907 ; BITALG-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,32,0]
1910 ; X86-SSE-LABEL: foldv4i32u:
1912 ; X86-SSE-NEXT: movaps {{.*#+}} xmm0 = [8,0,32,0]
1913 ; X86-SSE-NEXT: retl
1914 %out = call <4 x i32> @llvm.cttz.v4i32(<4 x i32> <i32 256, i32 -1, i32 0, i32 255>, i1 -1)
1918 define <8 x i16> @foldv8i16() nounwind {
1919 ; SSE-LABEL: foldv8i16:
1921 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [8,0,16,0,16,0,3,3]
1924 ; AVX-LABEL: foldv8i16:
1926 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,16,0,16,0,3,3]
1929 ; AVX512VPOPCNTDQ-LABEL: foldv8i16:
1930 ; AVX512VPOPCNTDQ: # %bb.0:
1931 ; AVX512VPOPCNTDQ-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,16,0,16,0,3,3]
1932 ; AVX512VPOPCNTDQ-NEXT: retq
1934 ; AVX512VPOPCNTDQVL-LABEL: foldv8i16:
1935 ; AVX512VPOPCNTDQVL: # %bb.0:
1936 ; AVX512VPOPCNTDQVL-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,16,0,16,0,3,3]
1937 ; AVX512VPOPCNTDQVL-NEXT: retq
1939 ; BITALG_NOVLX-LABEL: foldv8i16:
1940 ; BITALG_NOVLX: # %bb.0:
1941 ; BITALG_NOVLX-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,16,0,16,0,3,3]
1942 ; BITALG_NOVLX-NEXT: retq
1944 ; BITALG-LABEL: foldv8i16:
1946 ; BITALG-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,16,0,16,0,3,3]
1949 ; X86-SSE-LABEL: foldv8i16:
1951 ; X86-SSE-NEXT: movaps {{.*#+}} xmm0 = [8,0,16,0,16,0,3,3]
1952 ; X86-SSE-NEXT: retl
1953 %out = call <8 x i16> @llvm.cttz.v8i16(<8 x i16> <i16 256, i16 -1, i16 0, i16 255, i16 -65536, i16 7, i16 24, i16 88>, i1 0)
1957 define <8 x i16> @foldv8i16u() nounwind {
1958 ; SSE-LABEL: foldv8i16u:
1960 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [8,0,16,0,16,0,3,3]
1963 ; AVX-LABEL: foldv8i16u:
1965 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,16,0,16,0,3,3]
1968 ; AVX512VPOPCNTDQ-LABEL: foldv8i16u:
1969 ; AVX512VPOPCNTDQ: # %bb.0:
1970 ; AVX512VPOPCNTDQ-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,16,0,16,0,3,3]
1971 ; AVX512VPOPCNTDQ-NEXT: retq
1973 ; AVX512VPOPCNTDQVL-LABEL: foldv8i16u:
1974 ; AVX512VPOPCNTDQVL: # %bb.0:
1975 ; AVX512VPOPCNTDQVL-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,16,0,16,0,3,3]
1976 ; AVX512VPOPCNTDQVL-NEXT: retq
1978 ; BITALG_NOVLX-LABEL: foldv8i16u:
1979 ; BITALG_NOVLX: # %bb.0:
1980 ; BITALG_NOVLX-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,16,0,16,0,3,3]
1981 ; BITALG_NOVLX-NEXT: retq
1983 ; BITALG-LABEL: foldv8i16u:
1985 ; BITALG-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,16,0,16,0,3,3]
1988 ; X86-SSE-LABEL: foldv8i16u:
1990 ; X86-SSE-NEXT: movaps {{.*#+}} xmm0 = [8,0,16,0,16,0,3,3]
1991 ; X86-SSE-NEXT: retl
1992 %out = call <8 x i16> @llvm.cttz.v8i16(<8 x i16> <i16 256, i16 -1, i16 0, i16 255, i16 -65536, i16 7, i16 24, i16 88>, i1 -1)
1996 define <16 x i8> @foldv16i8() nounwind {
1997 ; SSE-LABEL: foldv16i8:
1999 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [8,0,8,0,8,0,3,3,1,1,0,1,2,3,4,5]
2002 ; AVX-LABEL: foldv16i8:
2004 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,8,0,8,0,3,3,1,1,0,1,2,3,4,5]
2007 ; AVX512VPOPCNTDQ-LABEL: foldv16i8:
2008 ; AVX512VPOPCNTDQ: # %bb.0:
2009 ; AVX512VPOPCNTDQ-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,8,0,8,0,3,3,1,1,0,1,2,3,4,5]
2010 ; AVX512VPOPCNTDQ-NEXT: retq
2012 ; AVX512VPOPCNTDQVL-LABEL: foldv16i8:
2013 ; AVX512VPOPCNTDQVL: # %bb.0:
2014 ; AVX512VPOPCNTDQVL-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,8,0,8,0,3,3,1,1,0,1,2,3,4,5]
2015 ; AVX512VPOPCNTDQVL-NEXT: retq
2017 ; BITALG_NOVLX-LABEL: foldv16i8:
2018 ; BITALG_NOVLX: # %bb.0:
2019 ; BITALG_NOVLX-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,8,0,8,0,3,3,1,1,0,1,2,3,4,5]
2020 ; BITALG_NOVLX-NEXT: retq
2022 ; BITALG-LABEL: foldv16i8:
2024 ; BITALG-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,8,0,8,0,3,3,1,1,0,1,2,3,4,5]
2027 ; X86-SSE-LABEL: foldv16i8:
2029 ; X86-SSE-NEXT: movaps {{.*#+}} xmm0 = [8,0,8,0,8,0,3,3,1,1,0,1,2,3,4,5]
2030 ; X86-SSE-NEXT: retl
2031 %out = call <16 x i8> @llvm.cttz.v16i8(<16 x i8> <i8 256, i8 -1, i8 0, i8 255, i8 -65536, i8 7, i8 24, i8 88, i8 -2, i8 254, i8 1, i8 2, i8 4, i8 8, i8 16, i8 32>, i1 0)
2035 define <16 x i8> @foldv16i8u() nounwind {
2036 ; SSE-LABEL: foldv16i8u:
2038 ; SSE-NEXT: movaps {{.*#+}} xmm0 = [8,0,8,0,8,0,3,3,1,1,0,1,2,3,4,5]
2041 ; AVX-LABEL: foldv16i8u:
2043 ; AVX-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,8,0,8,0,3,3,1,1,0,1,2,3,4,5]
2046 ; AVX512VPOPCNTDQ-LABEL: foldv16i8u:
2047 ; AVX512VPOPCNTDQ: # %bb.0:
2048 ; AVX512VPOPCNTDQ-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,8,0,8,0,3,3,1,1,0,1,2,3,4,5]
2049 ; AVX512VPOPCNTDQ-NEXT: retq
2051 ; AVX512VPOPCNTDQVL-LABEL: foldv16i8u:
2052 ; AVX512VPOPCNTDQVL: # %bb.0:
2053 ; AVX512VPOPCNTDQVL-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,8,0,8,0,3,3,1,1,0,1,2,3,4,5]
2054 ; AVX512VPOPCNTDQVL-NEXT: retq
2056 ; BITALG_NOVLX-LABEL: foldv16i8u:
2057 ; BITALG_NOVLX: # %bb.0:
2058 ; BITALG_NOVLX-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,8,0,8,0,3,3,1,1,0,1,2,3,4,5]
2059 ; BITALG_NOVLX-NEXT: retq
2061 ; BITALG-LABEL: foldv16i8u:
2063 ; BITALG-NEXT: vmovaps {{.*#+}} xmm0 = [8,0,8,0,8,0,3,3,1,1,0,1,2,3,4,5]
2066 ; X86-SSE-LABEL: foldv16i8u:
2068 ; X86-SSE-NEXT: movaps {{.*#+}} xmm0 = [8,0,8,0,8,0,3,3,1,1,0,1,2,3,4,5]
2069 ; X86-SSE-NEXT: retl
2070 %out = call <16 x i8> @llvm.cttz.v16i8(<16 x i8> <i8 256, i8 -1, i8 0, i8 255, i8 -65536, i8 7, i8 24, i8 88, i8 -2, i8 254, i8 1, i8 2, i8 4, i8 8, i8 16, i8 32>, i1 -1)
2074 declare <2 x i64> @llvm.cttz.v2i64(<2 x i64>, i1)
2075 declare <4 x i32> @llvm.cttz.v4i32(<4 x i32>, i1)
2076 declare <8 x i16> @llvm.cttz.v8i16(<8 x i16>, i1)
2077 declare <16 x i8> @llvm.cttz.v16i8(<16 x i8>, i1)