1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f,+avx512cd | FileCheck %s --check-prefix=ALL --check-prefix=AVX512CD
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f,+avx512cd,+avx512bw | FileCheck %s --check-prefix=ALL --check-prefix=AVX512CDBW
4 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f,+avx512bw | FileCheck %s --check-prefix=ALL --check-prefix=AVX512BW
5 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512vpopcntdq | FileCheck %s --check-prefix=ALL --check-prefix=AVX512VPOPCNTDQ
6 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512bitalg | FileCheck %s --check-prefix=ALL --check-prefix=BITALG
8 define <8 x i64> @testv8i64(<8 x i64> %in) nounwind {
9 ; AVX512CD-LABEL: testv8i64:
11 ; AVX512CD-NEXT: vpternlogd $255, %zmm1, %zmm1, %zmm1
12 ; AVX512CD-NEXT: vpaddq %zmm1, %zmm0, %zmm1
13 ; AVX512CD-NEXT: vpandnq %zmm1, %zmm0, %zmm0
14 ; AVX512CD-NEXT: vplzcntq %zmm0, %zmm0
15 ; AVX512CD-NEXT: vpbroadcastq {{.*#+}} zmm1 = [64,64,64,64,64,64,64,64]
16 ; AVX512CD-NEXT: vpsubq %zmm0, %zmm1, %zmm0
19 ; AVX512CDBW-LABEL: testv8i64:
20 ; AVX512CDBW: # %bb.0:
21 ; AVX512CDBW-NEXT: vpternlogd $255, %zmm1, %zmm1, %zmm1
22 ; AVX512CDBW-NEXT: vpaddq %zmm1, %zmm0, %zmm1
23 ; AVX512CDBW-NEXT: vpandnq %zmm1, %zmm0, %zmm0
24 ; AVX512CDBW-NEXT: vplzcntq %zmm0, %zmm0
25 ; AVX512CDBW-NEXT: vpbroadcastq {{.*#+}} zmm1 = [64,64,64,64,64,64,64,64]
26 ; AVX512CDBW-NEXT: vpsubq %zmm0, %zmm1, %zmm0
27 ; AVX512CDBW-NEXT: retq
29 ; AVX512BW-LABEL: testv8i64:
31 ; AVX512BW-NEXT: vpternlogd $255, %zmm1, %zmm1, %zmm1
32 ; AVX512BW-NEXT: vpaddq %zmm1, %zmm0, %zmm1
33 ; AVX512BW-NEXT: vpandnq %zmm1, %zmm0, %zmm0
34 ; AVX512BW-NEXT: vmovdqa64 {{.*#+}} zmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
35 ; AVX512BW-NEXT: vpandq %zmm1, %zmm0, %zmm2
36 ; AVX512BW-NEXT: vmovdqa64 {{.*#+}} zmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
37 ; AVX512BW-NEXT: vpshufb %zmm2, %zmm3, %zmm2
38 ; AVX512BW-NEXT: vpsrlw $4, %zmm0, %zmm0
39 ; AVX512BW-NEXT: vpandq %zmm1, %zmm0, %zmm0
40 ; AVX512BW-NEXT: vpshufb %zmm0, %zmm3, %zmm0
41 ; AVX512BW-NEXT: vpaddb %zmm2, %zmm0, %zmm0
42 ; AVX512BW-NEXT: vpxor %xmm1, %xmm1, %xmm1
43 ; AVX512BW-NEXT: vpsadbw %zmm1, %zmm0, %zmm0
46 ; AVX512VPOPCNTDQ-LABEL: testv8i64:
47 ; AVX512VPOPCNTDQ: # %bb.0:
48 ; AVX512VPOPCNTDQ-NEXT: vpternlogd $255, %zmm1, %zmm1, %zmm1
49 ; AVX512VPOPCNTDQ-NEXT: vpaddq %zmm1, %zmm0, %zmm1
50 ; AVX512VPOPCNTDQ-NEXT: vpandnq %zmm1, %zmm0, %zmm0
51 ; AVX512VPOPCNTDQ-NEXT: vpopcntq %zmm0, %zmm0
52 ; AVX512VPOPCNTDQ-NEXT: retq
54 ; BITALG-LABEL: testv8i64:
56 ; BITALG-NEXT: vpternlogd $255, %zmm1, %zmm1, %zmm1
57 ; BITALG-NEXT: vpaddq %zmm1, %zmm0, %zmm1
58 ; BITALG-NEXT: vpandnq %zmm1, %zmm0, %zmm0
59 ; BITALG-NEXT: vpopcntb %zmm0, %zmm0
60 ; BITALG-NEXT: vpxor %xmm1, %xmm1, %xmm1
61 ; BITALG-NEXT: vpsadbw %zmm1, %zmm0, %zmm0
63 %out = call <8 x i64> @llvm.cttz.v8i64(<8 x i64> %in, i1 0)
67 define <8 x i64> @testv8i64u(<8 x i64> %in) nounwind {
68 ; AVX512CD-LABEL: testv8i64u:
70 ; AVX512CD-NEXT: vpternlogd $255, %zmm1, %zmm1, %zmm1
71 ; AVX512CD-NEXT: vpaddq %zmm1, %zmm0, %zmm1
72 ; AVX512CD-NEXT: vpandnq %zmm1, %zmm0, %zmm0
73 ; AVX512CD-NEXT: vplzcntq %zmm0, %zmm0
74 ; AVX512CD-NEXT: vpbroadcastq {{.*#+}} zmm1 = [64,64,64,64,64,64,64,64]
75 ; AVX512CD-NEXT: vpsubq %zmm0, %zmm1, %zmm0
78 ; AVX512CDBW-LABEL: testv8i64u:
79 ; AVX512CDBW: # %bb.0:
80 ; AVX512CDBW-NEXT: vpternlogd $255, %zmm1, %zmm1, %zmm1
81 ; AVX512CDBW-NEXT: vpaddq %zmm1, %zmm0, %zmm1
82 ; AVX512CDBW-NEXT: vpandnq %zmm1, %zmm0, %zmm0
83 ; AVX512CDBW-NEXT: vplzcntq %zmm0, %zmm0
84 ; AVX512CDBW-NEXT: vpbroadcastq {{.*#+}} zmm1 = [64,64,64,64,64,64,64,64]
85 ; AVX512CDBW-NEXT: vpsubq %zmm0, %zmm1, %zmm0
86 ; AVX512CDBW-NEXT: retq
88 ; AVX512BW-LABEL: testv8i64u:
90 ; AVX512BW-NEXT: vpternlogd $255, %zmm1, %zmm1, %zmm1
91 ; AVX512BW-NEXT: vpaddq %zmm1, %zmm0, %zmm1
92 ; AVX512BW-NEXT: vpandnq %zmm1, %zmm0, %zmm0
93 ; AVX512BW-NEXT: vmovdqa64 {{.*#+}} zmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
94 ; AVX512BW-NEXT: vpandq %zmm1, %zmm0, %zmm2
95 ; AVX512BW-NEXT: vmovdqa64 {{.*#+}} zmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
96 ; AVX512BW-NEXT: vpshufb %zmm2, %zmm3, %zmm2
97 ; AVX512BW-NEXT: vpsrlw $4, %zmm0, %zmm0
98 ; AVX512BW-NEXT: vpandq %zmm1, %zmm0, %zmm0
99 ; AVX512BW-NEXT: vpshufb %zmm0, %zmm3, %zmm0
100 ; AVX512BW-NEXT: vpaddb %zmm2, %zmm0, %zmm0
101 ; AVX512BW-NEXT: vpxor %xmm1, %xmm1, %xmm1
102 ; AVX512BW-NEXT: vpsadbw %zmm1, %zmm0, %zmm0
103 ; AVX512BW-NEXT: retq
105 ; AVX512VPOPCNTDQ-LABEL: testv8i64u:
106 ; AVX512VPOPCNTDQ: # %bb.0:
107 ; AVX512VPOPCNTDQ-NEXT: vpternlogd $255, %zmm1, %zmm1, %zmm1
108 ; AVX512VPOPCNTDQ-NEXT: vpaddq %zmm1, %zmm0, %zmm1
109 ; AVX512VPOPCNTDQ-NEXT: vpandnq %zmm1, %zmm0, %zmm0
110 ; AVX512VPOPCNTDQ-NEXT: vpopcntq %zmm0, %zmm0
111 ; AVX512VPOPCNTDQ-NEXT: retq
113 ; BITALG-LABEL: testv8i64u:
115 ; BITALG-NEXT: vpternlogd $255, %zmm1, %zmm1, %zmm1
116 ; BITALG-NEXT: vpaddq %zmm1, %zmm0, %zmm1
117 ; BITALG-NEXT: vpandnq %zmm1, %zmm0, %zmm0
118 ; BITALG-NEXT: vpopcntb %zmm0, %zmm0
119 ; BITALG-NEXT: vpxor %xmm1, %xmm1, %xmm1
120 ; BITALG-NEXT: vpsadbw %zmm1, %zmm0, %zmm0
122 %out = call <8 x i64> @llvm.cttz.v8i64(<8 x i64> %in, i1 -1)
126 define <16 x i32> @testv16i32(<16 x i32> %in) nounwind {
127 ; AVX512CD-LABEL: testv16i32:
129 ; AVX512CD-NEXT: vpternlogd $255, %zmm1, %zmm1, %zmm1
130 ; AVX512CD-NEXT: vpaddd %zmm1, %zmm0, %zmm1
131 ; AVX512CD-NEXT: vpandnd %zmm1, %zmm0, %zmm0
132 ; AVX512CD-NEXT: vplzcntd %zmm0, %zmm0
133 ; AVX512CD-NEXT: vpbroadcastd {{.*#+}} zmm1 = [32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32]
134 ; AVX512CD-NEXT: vpsubd %zmm0, %zmm1, %zmm0
135 ; AVX512CD-NEXT: retq
137 ; AVX512CDBW-LABEL: testv16i32:
138 ; AVX512CDBW: # %bb.0:
139 ; AVX512CDBW-NEXT: vpternlogd $255, %zmm1, %zmm1, %zmm1
140 ; AVX512CDBW-NEXT: vpaddd %zmm1, %zmm0, %zmm1
141 ; AVX512CDBW-NEXT: vpandnd %zmm1, %zmm0, %zmm0
142 ; AVX512CDBW-NEXT: vplzcntd %zmm0, %zmm0
143 ; AVX512CDBW-NEXT: vpbroadcastd {{.*#+}} zmm1 = [32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32]
144 ; AVX512CDBW-NEXT: vpsubd %zmm0, %zmm1, %zmm0
145 ; AVX512CDBW-NEXT: retq
147 ; AVX512BW-LABEL: testv16i32:
149 ; AVX512BW-NEXT: vpternlogd $255, %zmm1, %zmm1, %zmm1
150 ; AVX512BW-NEXT: vpaddd %zmm1, %zmm0, %zmm1
151 ; AVX512BW-NEXT: vpandnd %zmm1, %zmm0, %zmm0
152 ; AVX512BW-NEXT: vmovdqa64 {{.*#+}} zmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
153 ; AVX512BW-NEXT: vpandq %zmm1, %zmm0, %zmm2
154 ; AVX512BW-NEXT: vmovdqa64 {{.*#+}} zmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
155 ; AVX512BW-NEXT: vpshufb %zmm2, %zmm3, %zmm2
156 ; AVX512BW-NEXT: vpsrlw $4, %zmm0, %zmm0
157 ; AVX512BW-NEXT: vpandq %zmm1, %zmm0, %zmm0
158 ; AVX512BW-NEXT: vpshufb %zmm0, %zmm3, %zmm0
159 ; AVX512BW-NEXT: vpaddb %zmm2, %zmm0, %zmm0
160 ; AVX512BW-NEXT: vpxor %xmm1, %xmm1, %xmm1
161 ; AVX512BW-NEXT: vpunpckhdq {{.*#+}} zmm2 = zmm0[2],zmm1[2],zmm0[3],zmm1[3],zmm0[6],zmm1[6],zmm0[7],zmm1[7],zmm0[10],zmm1[10],zmm0[11],zmm1[11],zmm0[14],zmm1[14],zmm0[15],zmm1[15]
162 ; AVX512BW-NEXT: vpsadbw %zmm1, %zmm2, %zmm2
163 ; AVX512BW-NEXT: vpunpckldq {{.*#+}} zmm0 = zmm0[0],zmm1[0],zmm0[1],zmm1[1],zmm0[4],zmm1[4],zmm0[5],zmm1[5],zmm0[8],zmm1[8],zmm0[9],zmm1[9],zmm0[12],zmm1[12],zmm0[13],zmm1[13]
164 ; AVX512BW-NEXT: vpsadbw %zmm1, %zmm0, %zmm0
165 ; AVX512BW-NEXT: vpackuswb %zmm2, %zmm0, %zmm0
166 ; AVX512BW-NEXT: retq
168 ; AVX512VPOPCNTDQ-LABEL: testv16i32:
169 ; AVX512VPOPCNTDQ: # %bb.0:
170 ; AVX512VPOPCNTDQ-NEXT: vpternlogd $255, %zmm1, %zmm1, %zmm1
171 ; AVX512VPOPCNTDQ-NEXT: vpaddd %zmm1, %zmm0, %zmm1
172 ; AVX512VPOPCNTDQ-NEXT: vpandnd %zmm1, %zmm0, %zmm0
173 ; AVX512VPOPCNTDQ-NEXT: vpopcntd %zmm0, %zmm0
174 ; AVX512VPOPCNTDQ-NEXT: retq
176 ; BITALG-LABEL: testv16i32:
178 ; BITALG-NEXT: vpternlogd $255, %zmm1, %zmm1, %zmm1
179 ; BITALG-NEXT: vpaddd %zmm1, %zmm0, %zmm1
180 ; BITALG-NEXT: vpandnd %zmm1, %zmm0, %zmm0
181 ; BITALG-NEXT: vpopcntb %zmm0, %zmm0
182 ; BITALG-NEXT: vpxor %xmm1, %xmm1, %xmm1
183 ; BITALG-NEXT: vpunpckhdq {{.*#+}} zmm2 = zmm0[2],zmm1[2],zmm0[3],zmm1[3],zmm0[6],zmm1[6],zmm0[7],zmm1[7],zmm0[10],zmm1[10],zmm0[11],zmm1[11],zmm0[14],zmm1[14],zmm0[15],zmm1[15]
184 ; BITALG-NEXT: vpsadbw %zmm1, %zmm2, %zmm2
185 ; BITALG-NEXT: vpunpckldq {{.*#+}} zmm0 = zmm0[0],zmm1[0],zmm0[1],zmm1[1],zmm0[4],zmm1[4],zmm0[5],zmm1[5],zmm0[8],zmm1[8],zmm0[9],zmm1[9],zmm0[12],zmm1[12],zmm0[13],zmm1[13]
186 ; BITALG-NEXT: vpsadbw %zmm1, %zmm0, %zmm0
187 ; BITALG-NEXT: vpackuswb %zmm2, %zmm0, %zmm0
189 %out = call <16 x i32> @llvm.cttz.v16i32(<16 x i32> %in, i1 0)
193 define <16 x i32> @testv16i32u(<16 x i32> %in) nounwind {
194 ; AVX512CD-LABEL: testv16i32u:
196 ; AVX512CD-NEXT: vpternlogd $255, %zmm1, %zmm1, %zmm1
197 ; AVX512CD-NEXT: vpaddd %zmm1, %zmm0, %zmm1
198 ; AVX512CD-NEXT: vpandnd %zmm1, %zmm0, %zmm0
199 ; AVX512CD-NEXT: vplzcntd %zmm0, %zmm0
200 ; AVX512CD-NEXT: vpbroadcastd {{.*#+}} zmm1 = [32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32]
201 ; AVX512CD-NEXT: vpsubd %zmm0, %zmm1, %zmm0
202 ; AVX512CD-NEXT: retq
204 ; AVX512CDBW-LABEL: testv16i32u:
205 ; AVX512CDBW: # %bb.0:
206 ; AVX512CDBW-NEXT: vpternlogd $255, %zmm1, %zmm1, %zmm1
207 ; AVX512CDBW-NEXT: vpaddd %zmm1, %zmm0, %zmm1
208 ; AVX512CDBW-NEXT: vpandnd %zmm1, %zmm0, %zmm0
209 ; AVX512CDBW-NEXT: vplzcntd %zmm0, %zmm0
210 ; AVX512CDBW-NEXT: vpbroadcastd {{.*#+}} zmm1 = [32,32,32,32,32,32,32,32,32,32,32,32,32,32,32,32]
211 ; AVX512CDBW-NEXT: vpsubd %zmm0, %zmm1, %zmm0
212 ; AVX512CDBW-NEXT: retq
214 ; AVX512BW-LABEL: testv16i32u:
216 ; AVX512BW-NEXT: vpternlogd $255, %zmm1, %zmm1, %zmm1
217 ; AVX512BW-NEXT: vpaddd %zmm1, %zmm0, %zmm1
218 ; AVX512BW-NEXT: vpandnd %zmm1, %zmm0, %zmm0
219 ; AVX512BW-NEXT: vmovdqa64 {{.*#+}} zmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
220 ; AVX512BW-NEXT: vpandq %zmm1, %zmm0, %zmm2
221 ; AVX512BW-NEXT: vmovdqa64 {{.*#+}} zmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
222 ; AVX512BW-NEXT: vpshufb %zmm2, %zmm3, %zmm2
223 ; AVX512BW-NEXT: vpsrlw $4, %zmm0, %zmm0
224 ; AVX512BW-NEXT: vpandq %zmm1, %zmm0, %zmm0
225 ; AVX512BW-NEXT: vpshufb %zmm0, %zmm3, %zmm0
226 ; AVX512BW-NEXT: vpaddb %zmm2, %zmm0, %zmm0
227 ; AVX512BW-NEXT: vpxor %xmm1, %xmm1, %xmm1
228 ; AVX512BW-NEXT: vpunpckhdq {{.*#+}} zmm2 = zmm0[2],zmm1[2],zmm0[3],zmm1[3],zmm0[6],zmm1[6],zmm0[7],zmm1[7],zmm0[10],zmm1[10],zmm0[11],zmm1[11],zmm0[14],zmm1[14],zmm0[15],zmm1[15]
229 ; AVX512BW-NEXT: vpsadbw %zmm1, %zmm2, %zmm2
230 ; AVX512BW-NEXT: vpunpckldq {{.*#+}} zmm0 = zmm0[0],zmm1[0],zmm0[1],zmm1[1],zmm0[4],zmm1[4],zmm0[5],zmm1[5],zmm0[8],zmm1[8],zmm0[9],zmm1[9],zmm0[12],zmm1[12],zmm0[13],zmm1[13]
231 ; AVX512BW-NEXT: vpsadbw %zmm1, %zmm0, %zmm0
232 ; AVX512BW-NEXT: vpackuswb %zmm2, %zmm0, %zmm0
233 ; AVX512BW-NEXT: retq
235 ; AVX512VPOPCNTDQ-LABEL: testv16i32u:
236 ; AVX512VPOPCNTDQ: # %bb.0:
237 ; AVX512VPOPCNTDQ-NEXT: vpternlogd $255, %zmm1, %zmm1, %zmm1
238 ; AVX512VPOPCNTDQ-NEXT: vpaddd %zmm1, %zmm0, %zmm1
239 ; AVX512VPOPCNTDQ-NEXT: vpandnd %zmm1, %zmm0, %zmm0
240 ; AVX512VPOPCNTDQ-NEXT: vpopcntd %zmm0, %zmm0
241 ; AVX512VPOPCNTDQ-NEXT: retq
243 ; BITALG-LABEL: testv16i32u:
245 ; BITALG-NEXT: vpternlogd $255, %zmm1, %zmm1, %zmm1
246 ; BITALG-NEXT: vpaddd %zmm1, %zmm0, %zmm1
247 ; BITALG-NEXT: vpandnd %zmm1, %zmm0, %zmm0
248 ; BITALG-NEXT: vpopcntb %zmm0, %zmm0
249 ; BITALG-NEXT: vpxor %xmm1, %xmm1, %xmm1
250 ; BITALG-NEXT: vpunpckhdq {{.*#+}} zmm2 = zmm0[2],zmm1[2],zmm0[3],zmm1[3],zmm0[6],zmm1[6],zmm0[7],zmm1[7],zmm0[10],zmm1[10],zmm0[11],zmm1[11],zmm0[14],zmm1[14],zmm0[15],zmm1[15]
251 ; BITALG-NEXT: vpsadbw %zmm1, %zmm2, %zmm2
252 ; BITALG-NEXT: vpunpckldq {{.*#+}} zmm0 = zmm0[0],zmm1[0],zmm0[1],zmm1[1],zmm0[4],zmm1[4],zmm0[5],zmm1[5],zmm0[8],zmm1[8],zmm0[9],zmm1[9],zmm0[12],zmm1[12],zmm0[13],zmm1[13]
253 ; BITALG-NEXT: vpsadbw %zmm1, %zmm0, %zmm0
254 ; BITALG-NEXT: vpackuswb %zmm2, %zmm0, %zmm0
256 %out = call <16 x i32> @llvm.cttz.v16i32(<16 x i32> %in, i1 -1)
260 define <32 x i16> @testv32i16(<32 x i16> %in) nounwind {
261 ; AVX512CD-LABEL: testv32i16:
263 ; AVX512CD-NEXT: vpcmpeqd %ymm2, %ymm2, %ymm2
264 ; AVX512CD-NEXT: vpaddw %ymm2, %ymm0, %ymm3
265 ; AVX512CD-NEXT: vpandn %ymm3, %ymm0, %ymm0
266 ; AVX512CD-NEXT: vmovdqa {{.*#+}} ymm3 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
267 ; AVX512CD-NEXT: vpand %ymm3, %ymm0, %ymm4
268 ; AVX512CD-NEXT: vmovdqa {{.*#+}} ymm5 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
269 ; AVX512CD-NEXT: vpshufb %ymm4, %ymm5, %ymm4
270 ; AVX512CD-NEXT: vpsrlw $4, %ymm0, %ymm0
271 ; AVX512CD-NEXT: vpand %ymm3, %ymm0, %ymm0
272 ; AVX512CD-NEXT: vpshufb %ymm0, %ymm5, %ymm0
273 ; AVX512CD-NEXT: vpaddb %ymm4, %ymm0, %ymm0
274 ; AVX512CD-NEXT: vpsllw $8, %ymm0, %ymm4
275 ; AVX512CD-NEXT: vpaddb %ymm0, %ymm4, %ymm0
276 ; AVX512CD-NEXT: vpsrlw $8, %ymm0, %ymm0
277 ; AVX512CD-NEXT: vpaddw %ymm2, %ymm1, %ymm2
278 ; AVX512CD-NEXT: vpandn %ymm2, %ymm1, %ymm1
279 ; AVX512CD-NEXT: vpand %ymm3, %ymm1, %ymm2
280 ; AVX512CD-NEXT: vpshufb %ymm2, %ymm5, %ymm2
281 ; AVX512CD-NEXT: vpsrlw $4, %ymm1, %ymm1
282 ; AVX512CD-NEXT: vpand %ymm3, %ymm1, %ymm1
283 ; AVX512CD-NEXT: vpshufb %ymm1, %ymm5, %ymm1
284 ; AVX512CD-NEXT: vpaddb %ymm2, %ymm1, %ymm1
285 ; AVX512CD-NEXT: vpsllw $8, %ymm1, %ymm2
286 ; AVX512CD-NEXT: vpaddb %ymm1, %ymm2, %ymm1
287 ; AVX512CD-NEXT: vpsrlw $8, %ymm1, %ymm1
288 ; AVX512CD-NEXT: retq
290 ; AVX512CDBW-LABEL: testv32i16:
291 ; AVX512CDBW: # %bb.0:
292 ; AVX512CDBW-NEXT: vpternlogd $255, %zmm1, %zmm1, %zmm1
293 ; AVX512CDBW-NEXT: vpaddw %zmm1, %zmm0, %zmm1
294 ; AVX512CDBW-NEXT: vpandnq %zmm1, %zmm0, %zmm0
295 ; AVX512CDBW-NEXT: vmovdqa64 {{.*#+}} zmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
296 ; AVX512CDBW-NEXT: vpandq %zmm1, %zmm0, %zmm2
297 ; AVX512CDBW-NEXT: vmovdqa64 {{.*#+}} zmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
298 ; AVX512CDBW-NEXT: vpshufb %zmm2, %zmm3, %zmm2
299 ; AVX512CDBW-NEXT: vpsrlw $4, %zmm0, %zmm0
300 ; AVX512CDBW-NEXT: vpandq %zmm1, %zmm0, %zmm0
301 ; AVX512CDBW-NEXT: vpshufb %zmm0, %zmm3, %zmm0
302 ; AVX512CDBW-NEXT: vpaddb %zmm2, %zmm0, %zmm0
303 ; AVX512CDBW-NEXT: vpsllw $8, %zmm0, %zmm1
304 ; AVX512CDBW-NEXT: vpaddb %zmm0, %zmm1, %zmm0
305 ; AVX512CDBW-NEXT: vpsrlw $8, %zmm0, %zmm0
306 ; AVX512CDBW-NEXT: retq
308 ; AVX512BW-LABEL: testv32i16:
310 ; AVX512BW-NEXT: vpternlogd $255, %zmm1, %zmm1, %zmm1
311 ; AVX512BW-NEXT: vpaddw %zmm1, %zmm0, %zmm1
312 ; AVX512BW-NEXT: vpandnq %zmm1, %zmm0, %zmm0
313 ; AVX512BW-NEXT: vmovdqa64 {{.*#+}} zmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
314 ; AVX512BW-NEXT: vpandq %zmm1, %zmm0, %zmm2
315 ; AVX512BW-NEXT: vmovdqa64 {{.*#+}} zmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
316 ; AVX512BW-NEXT: vpshufb %zmm2, %zmm3, %zmm2
317 ; AVX512BW-NEXT: vpsrlw $4, %zmm0, %zmm0
318 ; AVX512BW-NEXT: vpandq %zmm1, %zmm0, %zmm0
319 ; AVX512BW-NEXT: vpshufb %zmm0, %zmm3, %zmm0
320 ; AVX512BW-NEXT: vpaddb %zmm2, %zmm0, %zmm0
321 ; AVX512BW-NEXT: vpsllw $8, %zmm0, %zmm1
322 ; AVX512BW-NEXT: vpaddb %zmm0, %zmm1, %zmm0
323 ; AVX512BW-NEXT: vpsrlw $8, %zmm0, %zmm0
324 ; AVX512BW-NEXT: retq
326 ; AVX512VPOPCNTDQ-LABEL: testv32i16:
327 ; AVX512VPOPCNTDQ: # %bb.0:
328 ; AVX512VPOPCNTDQ-NEXT: vpcmpeqd %ymm2, %ymm2, %ymm2
329 ; AVX512VPOPCNTDQ-NEXT: vpaddw %ymm2, %ymm0, %ymm3
330 ; AVX512VPOPCNTDQ-NEXT: vpandn %ymm3, %ymm0, %ymm0
331 ; AVX512VPOPCNTDQ-NEXT: vpmovzxwd {{.*#+}} zmm0 = ymm0[0],zero,ymm0[1],zero,ymm0[2],zero,ymm0[3],zero,ymm0[4],zero,ymm0[5],zero,ymm0[6],zero,ymm0[7],zero,ymm0[8],zero,ymm0[9],zero,ymm0[10],zero,ymm0[11],zero,ymm0[12],zero,ymm0[13],zero,ymm0[14],zero,ymm0[15],zero
332 ; AVX512VPOPCNTDQ-NEXT: vpopcntd %zmm0, %zmm0
333 ; AVX512VPOPCNTDQ-NEXT: vpmovdw %zmm0, %ymm0
334 ; AVX512VPOPCNTDQ-NEXT: vpaddw %ymm2, %ymm1, %ymm2
335 ; AVX512VPOPCNTDQ-NEXT: vpandn %ymm2, %ymm1, %ymm1
336 ; AVX512VPOPCNTDQ-NEXT: vpmovzxwd {{.*#+}} zmm1 = ymm1[0],zero,ymm1[1],zero,ymm1[2],zero,ymm1[3],zero,ymm1[4],zero,ymm1[5],zero,ymm1[6],zero,ymm1[7],zero,ymm1[8],zero,ymm1[9],zero,ymm1[10],zero,ymm1[11],zero,ymm1[12],zero,ymm1[13],zero,ymm1[14],zero,ymm1[15],zero
337 ; AVX512VPOPCNTDQ-NEXT: vpopcntd %zmm1, %zmm1
338 ; AVX512VPOPCNTDQ-NEXT: vpmovdw %zmm1, %ymm1
339 ; AVX512VPOPCNTDQ-NEXT: retq
341 ; BITALG-LABEL: testv32i16:
343 ; BITALG-NEXT: vpternlogd $255, %zmm1, %zmm1, %zmm1
344 ; BITALG-NEXT: vpaddw %zmm1, %zmm0, %zmm1
345 ; BITALG-NEXT: vpandnq %zmm1, %zmm0, %zmm0
346 ; BITALG-NEXT: vpopcntw %zmm0, %zmm0
348 %out = call <32 x i16> @llvm.cttz.v32i16(<32 x i16> %in, i1 0)
352 define <32 x i16> @testv32i16u(<32 x i16> %in) nounwind {
353 ; AVX512CD-LABEL: testv32i16u:
355 ; AVX512CD-NEXT: vpcmpeqd %ymm2, %ymm2, %ymm2
356 ; AVX512CD-NEXT: vpaddw %ymm2, %ymm0, %ymm3
357 ; AVX512CD-NEXT: vpandn %ymm3, %ymm0, %ymm0
358 ; AVX512CD-NEXT: vmovdqa {{.*#+}} ymm3 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
359 ; AVX512CD-NEXT: vpand %ymm3, %ymm0, %ymm4
360 ; AVX512CD-NEXT: vmovdqa {{.*#+}} ymm5 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
361 ; AVX512CD-NEXT: vpshufb %ymm4, %ymm5, %ymm4
362 ; AVX512CD-NEXT: vpsrlw $4, %ymm0, %ymm0
363 ; AVX512CD-NEXT: vpand %ymm3, %ymm0, %ymm0
364 ; AVX512CD-NEXT: vpshufb %ymm0, %ymm5, %ymm0
365 ; AVX512CD-NEXT: vpaddb %ymm4, %ymm0, %ymm0
366 ; AVX512CD-NEXT: vpsllw $8, %ymm0, %ymm4
367 ; AVX512CD-NEXT: vpaddb %ymm0, %ymm4, %ymm0
368 ; AVX512CD-NEXT: vpsrlw $8, %ymm0, %ymm0
369 ; AVX512CD-NEXT: vpaddw %ymm2, %ymm1, %ymm2
370 ; AVX512CD-NEXT: vpandn %ymm2, %ymm1, %ymm1
371 ; AVX512CD-NEXT: vpand %ymm3, %ymm1, %ymm2
372 ; AVX512CD-NEXT: vpshufb %ymm2, %ymm5, %ymm2
373 ; AVX512CD-NEXT: vpsrlw $4, %ymm1, %ymm1
374 ; AVX512CD-NEXT: vpand %ymm3, %ymm1, %ymm1
375 ; AVX512CD-NEXT: vpshufb %ymm1, %ymm5, %ymm1
376 ; AVX512CD-NEXT: vpaddb %ymm2, %ymm1, %ymm1
377 ; AVX512CD-NEXT: vpsllw $8, %ymm1, %ymm2
378 ; AVX512CD-NEXT: vpaddb %ymm1, %ymm2, %ymm1
379 ; AVX512CD-NEXT: vpsrlw $8, %ymm1, %ymm1
380 ; AVX512CD-NEXT: retq
382 ; AVX512CDBW-LABEL: testv32i16u:
383 ; AVX512CDBW: # %bb.0:
384 ; AVX512CDBW-NEXT: vpternlogd $255, %zmm1, %zmm1, %zmm1
385 ; AVX512CDBW-NEXT: vpaddw %zmm1, %zmm0, %zmm1
386 ; AVX512CDBW-NEXT: vpandnq %zmm1, %zmm0, %zmm0
387 ; AVX512CDBW-NEXT: vmovdqa64 {{.*#+}} zmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
388 ; AVX512CDBW-NEXT: vpandq %zmm1, %zmm0, %zmm2
389 ; AVX512CDBW-NEXT: vmovdqa64 {{.*#+}} zmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
390 ; AVX512CDBW-NEXT: vpshufb %zmm2, %zmm3, %zmm2
391 ; AVX512CDBW-NEXT: vpsrlw $4, %zmm0, %zmm0
392 ; AVX512CDBW-NEXT: vpandq %zmm1, %zmm0, %zmm0
393 ; AVX512CDBW-NEXT: vpshufb %zmm0, %zmm3, %zmm0
394 ; AVX512CDBW-NEXT: vpaddb %zmm2, %zmm0, %zmm0
395 ; AVX512CDBW-NEXT: vpsllw $8, %zmm0, %zmm1
396 ; AVX512CDBW-NEXT: vpaddb %zmm0, %zmm1, %zmm0
397 ; AVX512CDBW-NEXT: vpsrlw $8, %zmm0, %zmm0
398 ; AVX512CDBW-NEXT: retq
400 ; AVX512BW-LABEL: testv32i16u:
402 ; AVX512BW-NEXT: vpternlogd $255, %zmm1, %zmm1, %zmm1
403 ; AVX512BW-NEXT: vpaddw %zmm1, %zmm0, %zmm1
404 ; AVX512BW-NEXT: vpandnq %zmm1, %zmm0, %zmm0
405 ; AVX512BW-NEXT: vmovdqa64 {{.*#+}} zmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
406 ; AVX512BW-NEXT: vpandq %zmm1, %zmm0, %zmm2
407 ; AVX512BW-NEXT: vmovdqa64 {{.*#+}} zmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
408 ; AVX512BW-NEXT: vpshufb %zmm2, %zmm3, %zmm2
409 ; AVX512BW-NEXT: vpsrlw $4, %zmm0, %zmm0
410 ; AVX512BW-NEXT: vpandq %zmm1, %zmm0, %zmm0
411 ; AVX512BW-NEXT: vpshufb %zmm0, %zmm3, %zmm0
412 ; AVX512BW-NEXT: vpaddb %zmm2, %zmm0, %zmm0
413 ; AVX512BW-NEXT: vpsllw $8, %zmm0, %zmm1
414 ; AVX512BW-NEXT: vpaddb %zmm0, %zmm1, %zmm0
415 ; AVX512BW-NEXT: vpsrlw $8, %zmm0, %zmm0
416 ; AVX512BW-NEXT: retq
418 ; AVX512VPOPCNTDQ-LABEL: testv32i16u:
419 ; AVX512VPOPCNTDQ: # %bb.0:
420 ; AVX512VPOPCNTDQ-NEXT: vpcmpeqd %ymm2, %ymm2, %ymm2
421 ; AVX512VPOPCNTDQ-NEXT: vpaddw %ymm2, %ymm0, %ymm3
422 ; AVX512VPOPCNTDQ-NEXT: vpandn %ymm3, %ymm0, %ymm0
423 ; AVX512VPOPCNTDQ-NEXT: vpmovzxwd {{.*#+}} zmm0 = ymm0[0],zero,ymm0[1],zero,ymm0[2],zero,ymm0[3],zero,ymm0[4],zero,ymm0[5],zero,ymm0[6],zero,ymm0[7],zero,ymm0[8],zero,ymm0[9],zero,ymm0[10],zero,ymm0[11],zero,ymm0[12],zero,ymm0[13],zero,ymm0[14],zero,ymm0[15],zero
424 ; AVX512VPOPCNTDQ-NEXT: vpopcntd %zmm0, %zmm0
425 ; AVX512VPOPCNTDQ-NEXT: vpmovdw %zmm0, %ymm0
426 ; AVX512VPOPCNTDQ-NEXT: vpaddw %ymm2, %ymm1, %ymm2
427 ; AVX512VPOPCNTDQ-NEXT: vpandn %ymm2, %ymm1, %ymm1
428 ; AVX512VPOPCNTDQ-NEXT: vpmovzxwd {{.*#+}} zmm1 = ymm1[0],zero,ymm1[1],zero,ymm1[2],zero,ymm1[3],zero,ymm1[4],zero,ymm1[5],zero,ymm1[6],zero,ymm1[7],zero,ymm1[8],zero,ymm1[9],zero,ymm1[10],zero,ymm1[11],zero,ymm1[12],zero,ymm1[13],zero,ymm1[14],zero,ymm1[15],zero
429 ; AVX512VPOPCNTDQ-NEXT: vpopcntd %zmm1, %zmm1
430 ; AVX512VPOPCNTDQ-NEXT: vpmovdw %zmm1, %ymm1
431 ; AVX512VPOPCNTDQ-NEXT: retq
433 ; BITALG-LABEL: testv32i16u:
435 ; BITALG-NEXT: vpternlogd $255, %zmm1, %zmm1, %zmm1
436 ; BITALG-NEXT: vpaddw %zmm1, %zmm0, %zmm1
437 ; BITALG-NEXT: vpandnq %zmm1, %zmm0, %zmm0
438 ; BITALG-NEXT: vpopcntw %zmm0, %zmm0
440 %out = call <32 x i16> @llvm.cttz.v32i16(<32 x i16> %in, i1 -1)
444 define <64 x i8> @testv64i8(<64 x i8> %in) nounwind {
445 ; AVX512CD-LABEL: testv64i8:
447 ; AVX512CD-NEXT: vpcmpeqd %ymm2, %ymm2, %ymm2
448 ; AVX512CD-NEXT: vpaddb %ymm2, %ymm0, %ymm3
449 ; AVX512CD-NEXT: vpandn %ymm3, %ymm0, %ymm0
450 ; AVX512CD-NEXT: vmovdqa {{.*#+}} ymm3 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
451 ; AVX512CD-NEXT: vpand %ymm3, %ymm0, %ymm4
452 ; AVX512CD-NEXT: vmovdqa {{.*#+}} ymm5 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
453 ; AVX512CD-NEXT: vpshufb %ymm4, %ymm5, %ymm4
454 ; AVX512CD-NEXT: vpsrlw $4, %ymm0, %ymm0
455 ; AVX512CD-NEXT: vpand %ymm3, %ymm0, %ymm0
456 ; AVX512CD-NEXT: vpshufb %ymm0, %ymm5, %ymm0
457 ; AVX512CD-NEXT: vpaddb %ymm4, %ymm0, %ymm0
458 ; AVX512CD-NEXT: vpaddb %ymm2, %ymm1, %ymm2
459 ; AVX512CD-NEXT: vpandn %ymm2, %ymm1, %ymm1
460 ; AVX512CD-NEXT: vpand %ymm3, %ymm1, %ymm2
461 ; AVX512CD-NEXT: vpshufb %ymm2, %ymm5, %ymm2
462 ; AVX512CD-NEXT: vpsrlw $4, %ymm1, %ymm1
463 ; AVX512CD-NEXT: vpand %ymm3, %ymm1, %ymm1
464 ; AVX512CD-NEXT: vpshufb %ymm1, %ymm5, %ymm1
465 ; AVX512CD-NEXT: vpaddb %ymm2, %ymm1, %ymm1
466 ; AVX512CD-NEXT: retq
468 ; AVX512CDBW-LABEL: testv64i8:
469 ; AVX512CDBW: # %bb.0:
470 ; AVX512CDBW-NEXT: vpternlogd $255, %zmm1, %zmm1, %zmm1
471 ; AVX512CDBW-NEXT: vpaddb %zmm1, %zmm0, %zmm1
472 ; AVX512CDBW-NEXT: vpandnq %zmm1, %zmm0, %zmm0
473 ; AVX512CDBW-NEXT: vmovdqa64 {{.*#+}} zmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
474 ; AVX512CDBW-NEXT: vpandq %zmm1, %zmm0, %zmm2
475 ; AVX512CDBW-NEXT: vmovdqa64 {{.*#+}} zmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
476 ; AVX512CDBW-NEXT: vpshufb %zmm2, %zmm3, %zmm2
477 ; AVX512CDBW-NEXT: vpsrlw $4, %zmm0, %zmm0
478 ; AVX512CDBW-NEXT: vpandq %zmm1, %zmm0, %zmm0
479 ; AVX512CDBW-NEXT: vpshufb %zmm0, %zmm3, %zmm0
480 ; AVX512CDBW-NEXT: vpaddb %zmm2, %zmm0, %zmm0
481 ; AVX512CDBW-NEXT: retq
483 ; AVX512BW-LABEL: testv64i8:
485 ; AVX512BW-NEXT: vpternlogd $255, %zmm1, %zmm1, %zmm1
486 ; AVX512BW-NEXT: vpaddb %zmm1, %zmm0, %zmm1
487 ; AVX512BW-NEXT: vpandnq %zmm1, %zmm0, %zmm0
488 ; AVX512BW-NEXT: vmovdqa64 {{.*#+}} zmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
489 ; AVX512BW-NEXT: vpandq %zmm1, %zmm0, %zmm2
490 ; AVX512BW-NEXT: vmovdqa64 {{.*#+}} zmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
491 ; AVX512BW-NEXT: vpshufb %zmm2, %zmm3, %zmm2
492 ; AVX512BW-NEXT: vpsrlw $4, %zmm0, %zmm0
493 ; AVX512BW-NEXT: vpandq %zmm1, %zmm0, %zmm0
494 ; AVX512BW-NEXT: vpshufb %zmm0, %zmm3, %zmm0
495 ; AVX512BW-NEXT: vpaddb %zmm2, %zmm0, %zmm0
496 ; AVX512BW-NEXT: retq
498 ; AVX512VPOPCNTDQ-LABEL: testv64i8:
499 ; AVX512VPOPCNTDQ: # %bb.0:
500 ; AVX512VPOPCNTDQ-NEXT: vpcmpeqd %ymm2, %ymm2, %ymm2
501 ; AVX512VPOPCNTDQ-NEXT: vpaddb %ymm2, %ymm0, %ymm3
502 ; AVX512VPOPCNTDQ-NEXT: vpandn %ymm3, %ymm0, %ymm0
503 ; AVX512VPOPCNTDQ-NEXT: vmovdqa {{.*#+}} ymm3 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
504 ; AVX512VPOPCNTDQ-NEXT: vpand %ymm3, %ymm0, %ymm4
505 ; AVX512VPOPCNTDQ-NEXT: vmovdqa {{.*#+}} ymm5 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
506 ; AVX512VPOPCNTDQ-NEXT: vpshufb %ymm4, %ymm5, %ymm4
507 ; AVX512VPOPCNTDQ-NEXT: vpsrlw $4, %ymm0, %ymm0
508 ; AVX512VPOPCNTDQ-NEXT: vpand %ymm3, %ymm0, %ymm0
509 ; AVX512VPOPCNTDQ-NEXT: vpshufb %ymm0, %ymm5, %ymm0
510 ; AVX512VPOPCNTDQ-NEXT: vpaddb %ymm4, %ymm0, %ymm0
511 ; AVX512VPOPCNTDQ-NEXT: vpaddb %ymm2, %ymm1, %ymm2
512 ; AVX512VPOPCNTDQ-NEXT: vpandn %ymm2, %ymm1, %ymm1
513 ; AVX512VPOPCNTDQ-NEXT: vpand %ymm3, %ymm1, %ymm2
514 ; AVX512VPOPCNTDQ-NEXT: vpshufb %ymm2, %ymm5, %ymm2
515 ; AVX512VPOPCNTDQ-NEXT: vpsrlw $4, %ymm1, %ymm1
516 ; AVX512VPOPCNTDQ-NEXT: vpand %ymm3, %ymm1, %ymm1
517 ; AVX512VPOPCNTDQ-NEXT: vpshufb %ymm1, %ymm5, %ymm1
518 ; AVX512VPOPCNTDQ-NEXT: vpaddb %ymm2, %ymm1, %ymm1
519 ; AVX512VPOPCNTDQ-NEXT: retq
521 ; BITALG-LABEL: testv64i8:
523 ; BITALG-NEXT: vpternlogd $255, %zmm1, %zmm1, %zmm1
524 ; BITALG-NEXT: vpaddb %zmm1, %zmm0, %zmm1
525 ; BITALG-NEXT: vpandnq %zmm1, %zmm0, %zmm0
526 ; BITALG-NEXT: vpopcntb %zmm0, %zmm0
528 %out = call <64 x i8> @llvm.cttz.v64i8(<64 x i8> %in, i1 0)
532 define <64 x i8> @testv64i8u(<64 x i8> %in) nounwind {
533 ; AVX512CD-LABEL: testv64i8u:
535 ; AVX512CD-NEXT: vpcmpeqd %ymm2, %ymm2, %ymm2
536 ; AVX512CD-NEXT: vpaddb %ymm2, %ymm0, %ymm3
537 ; AVX512CD-NEXT: vpandn %ymm3, %ymm0, %ymm0
538 ; AVX512CD-NEXT: vmovdqa {{.*#+}} ymm3 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
539 ; AVX512CD-NEXT: vpand %ymm3, %ymm0, %ymm4
540 ; AVX512CD-NEXT: vmovdqa {{.*#+}} ymm5 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
541 ; AVX512CD-NEXT: vpshufb %ymm4, %ymm5, %ymm4
542 ; AVX512CD-NEXT: vpsrlw $4, %ymm0, %ymm0
543 ; AVX512CD-NEXT: vpand %ymm3, %ymm0, %ymm0
544 ; AVX512CD-NEXT: vpshufb %ymm0, %ymm5, %ymm0
545 ; AVX512CD-NEXT: vpaddb %ymm4, %ymm0, %ymm0
546 ; AVX512CD-NEXT: vpaddb %ymm2, %ymm1, %ymm2
547 ; AVX512CD-NEXT: vpandn %ymm2, %ymm1, %ymm1
548 ; AVX512CD-NEXT: vpand %ymm3, %ymm1, %ymm2
549 ; AVX512CD-NEXT: vpshufb %ymm2, %ymm5, %ymm2
550 ; AVX512CD-NEXT: vpsrlw $4, %ymm1, %ymm1
551 ; AVX512CD-NEXT: vpand %ymm3, %ymm1, %ymm1
552 ; AVX512CD-NEXT: vpshufb %ymm1, %ymm5, %ymm1
553 ; AVX512CD-NEXT: vpaddb %ymm2, %ymm1, %ymm1
554 ; AVX512CD-NEXT: retq
556 ; AVX512CDBW-LABEL: testv64i8u:
557 ; AVX512CDBW: # %bb.0:
558 ; AVX512CDBW-NEXT: vpternlogd $255, %zmm1, %zmm1, %zmm1
559 ; AVX512CDBW-NEXT: vpaddb %zmm1, %zmm0, %zmm1
560 ; AVX512CDBW-NEXT: vpandnq %zmm1, %zmm0, %zmm0
561 ; AVX512CDBW-NEXT: vmovdqa64 {{.*#+}} zmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
562 ; AVX512CDBW-NEXT: vpandq %zmm1, %zmm0, %zmm2
563 ; AVX512CDBW-NEXT: vmovdqa64 {{.*#+}} zmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
564 ; AVX512CDBW-NEXT: vpshufb %zmm2, %zmm3, %zmm2
565 ; AVX512CDBW-NEXT: vpsrlw $4, %zmm0, %zmm0
566 ; AVX512CDBW-NEXT: vpandq %zmm1, %zmm0, %zmm0
567 ; AVX512CDBW-NEXT: vpshufb %zmm0, %zmm3, %zmm0
568 ; AVX512CDBW-NEXT: vpaddb %zmm2, %zmm0, %zmm0
569 ; AVX512CDBW-NEXT: retq
571 ; AVX512BW-LABEL: testv64i8u:
573 ; AVX512BW-NEXT: vpternlogd $255, %zmm1, %zmm1, %zmm1
574 ; AVX512BW-NEXT: vpaddb %zmm1, %zmm0, %zmm1
575 ; AVX512BW-NEXT: vpandnq %zmm1, %zmm0, %zmm0
576 ; AVX512BW-NEXT: vmovdqa64 {{.*#+}} zmm1 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
577 ; AVX512BW-NEXT: vpandq %zmm1, %zmm0, %zmm2
578 ; AVX512BW-NEXT: vmovdqa64 {{.*#+}} zmm3 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
579 ; AVX512BW-NEXT: vpshufb %zmm2, %zmm3, %zmm2
580 ; AVX512BW-NEXT: vpsrlw $4, %zmm0, %zmm0
581 ; AVX512BW-NEXT: vpandq %zmm1, %zmm0, %zmm0
582 ; AVX512BW-NEXT: vpshufb %zmm0, %zmm3, %zmm0
583 ; AVX512BW-NEXT: vpaddb %zmm2, %zmm0, %zmm0
584 ; AVX512BW-NEXT: retq
586 ; AVX512VPOPCNTDQ-LABEL: testv64i8u:
587 ; AVX512VPOPCNTDQ: # %bb.0:
588 ; AVX512VPOPCNTDQ-NEXT: vpcmpeqd %ymm2, %ymm2, %ymm2
589 ; AVX512VPOPCNTDQ-NEXT: vpaddb %ymm2, %ymm0, %ymm3
590 ; AVX512VPOPCNTDQ-NEXT: vpandn %ymm3, %ymm0, %ymm0
591 ; AVX512VPOPCNTDQ-NEXT: vmovdqa {{.*#+}} ymm3 = [15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15,15]
592 ; AVX512VPOPCNTDQ-NEXT: vpand %ymm3, %ymm0, %ymm4
593 ; AVX512VPOPCNTDQ-NEXT: vmovdqa {{.*#+}} ymm5 = [0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4,0,1,1,2,1,2,2,3,1,2,2,3,2,3,3,4]
594 ; AVX512VPOPCNTDQ-NEXT: vpshufb %ymm4, %ymm5, %ymm4
595 ; AVX512VPOPCNTDQ-NEXT: vpsrlw $4, %ymm0, %ymm0
596 ; AVX512VPOPCNTDQ-NEXT: vpand %ymm3, %ymm0, %ymm0
597 ; AVX512VPOPCNTDQ-NEXT: vpshufb %ymm0, %ymm5, %ymm0
598 ; AVX512VPOPCNTDQ-NEXT: vpaddb %ymm4, %ymm0, %ymm0
599 ; AVX512VPOPCNTDQ-NEXT: vpaddb %ymm2, %ymm1, %ymm2
600 ; AVX512VPOPCNTDQ-NEXT: vpandn %ymm2, %ymm1, %ymm1
601 ; AVX512VPOPCNTDQ-NEXT: vpand %ymm3, %ymm1, %ymm2
602 ; AVX512VPOPCNTDQ-NEXT: vpshufb %ymm2, %ymm5, %ymm2
603 ; AVX512VPOPCNTDQ-NEXT: vpsrlw $4, %ymm1, %ymm1
604 ; AVX512VPOPCNTDQ-NEXT: vpand %ymm3, %ymm1, %ymm1
605 ; AVX512VPOPCNTDQ-NEXT: vpshufb %ymm1, %ymm5, %ymm1
606 ; AVX512VPOPCNTDQ-NEXT: vpaddb %ymm2, %ymm1, %ymm1
607 ; AVX512VPOPCNTDQ-NEXT: retq
609 ; BITALG-LABEL: testv64i8u:
611 ; BITALG-NEXT: vpternlogd $255, %zmm1, %zmm1, %zmm1
612 ; BITALG-NEXT: vpaddb %zmm1, %zmm0, %zmm1
613 ; BITALG-NEXT: vpandnq %zmm1, %zmm0, %zmm0
614 ; BITALG-NEXT: vpopcntb %zmm0, %zmm0
616 %out = call <64 x i8> @llvm.cttz.v64i8(<64 x i8> %in, i1 -1)
620 declare <8 x i64> @llvm.cttz.v8i64(<8 x i64>, i1)
621 declare <16 x i32> @llvm.cttz.v16i32(<16 x i32>, i1)
622 declare <32 x i16> @llvm.cttz.v32i16(<32 x i16>, i1)
623 declare <64 x i8> @llvm.cttz.v64i8(<64 x i8>, i1)