1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=i686-unknown-unknown -mattr=+sse2 | FileCheck %s --check-prefixes=SSE,SSE2,X86-SSE2
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse2 | FileCheck %s --check-prefixes=SSE,SSE2,X64-SSE,X64-SSE2
4 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+sse4.1 | FileCheck %s --check-prefixes=SSE,X64-SSE,SSE41
5 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx | FileCheck %s --check-prefixes=AVX,AVX1
6 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2 | FileCheck %s --check-prefixes=AVX,AVX2
7 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f | FileCheck %s --check-prefixes=AVX512,AVX512F
8 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f,+avx512bw | FileCheck %s --check-prefixes=AVX512,AVX512BW
9 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f,+avx512bw,+avx512vl | FileCheck %s --check-prefixes=AVX512,AVX512VL
15 define i1 @trunc_v2i64_v2i1(<2 x i64>) nounwind {
16 ; SSE-LABEL: trunc_v2i64_v2i1:
18 ; SSE-NEXT: psllq $63, %xmm0
19 ; SSE-NEXT: movmskpd %xmm0, %eax
20 ; SSE-NEXT: testb %al, %al
22 ; SSE-NEXT: ret{{[l|q]}}
24 ; AVX-LABEL: trunc_v2i64_v2i1:
26 ; AVX-NEXT: vpsllq $63, %xmm0, %xmm0
27 ; AVX-NEXT: vmovmskpd %xmm0, %eax
28 ; AVX-NEXT: testb %al, %al
32 ; AVX512F-LABEL: trunc_v2i64_v2i1:
34 ; AVX512F-NEXT: vpsllq $63, %xmm0, %xmm0
35 ; AVX512F-NEXT: vptestmq %zmm0, %zmm0, %k0
36 ; AVX512F-NEXT: kmovw %k0, %eax
37 ; AVX512F-NEXT: testb $3, %al
38 ; AVX512F-NEXT: setnp %al
39 ; AVX512F-NEXT: vzeroupper
42 ; AVX512BW-LABEL: trunc_v2i64_v2i1:
44 ; AVX512BW-NEXT: vpsllq $63, %xmm0, %xmm0
45 ; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k0
46 ; AVX512BW-NEXT: kmovd %k0, %eax
47 ; AVX512BW-NEXT: testb $3, %al
48 ; AVX512BW-NEXT: setnp %al
49 ; AVX512BW-NEXT: vzeroupper
52 ; AVX512VL-LABEL: trunc_v2i64_v2i1:
54 ; AVX512VL-NEXT: vpsllq $63, %xmm0, %xmm0
55 ; AVX512VL-NEXT: vptestmq %xmm0, %xmm0, %k0
56 ; AVX512VL-NEXT: kmovd %k0, %eax
57 ; AVX512VL-NEXT: testb %al, %al
58 ; AVX512VL-NEXT: setnp %al
60 %a = trunc <2 x i64> %0 to <2 x i1>
61 %b = call i1 @llvm.vector.reduce.xor.v2i1(<2 x i1> %a)
65 define i1 @trunc_v4i32_v4i1(<4 x i32>) nounwind {
66 ; SSE-LABEL: trunc_v4i32_v4i1:
68 ; SSE-NEXT: pslld $31, %xmm0
69 ; SSE-NEXT: movmskps %xmm0, %eax
70 ; SSE-NEXT: testb %al, %al
72 ; SSE-NEXT: ret{{[l|q]}}
74 ; AVX-LABEL: trunc_v4i32_v4i1:
76 ; AVX-NEXT: vpslld $31, %xmm0, %xmm0
77 ; AVX-NEXT: vmovmskps %xmm0, %eax
78 ; AVX-NEXT: testb %al, %al
82 ; AVX512F-LABEL: trunc_v4i32_v4i1:
84 ; AVX512F-NEXT: vpslld $31, %xmm0, %xmm0
85 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
86 ; AVX512F-NEXT: kmovw %k0, %eax
87 ; AVX512F-NEXT: testb $15, %al
88 ; AVX512F-NEXT: setnp %al
89 ; AVX512F-NEXT: vzeroupper
92 ; AVX512BW-LABEL: trunc_v4i32_v4i1:
94 ; AVX512BW-NEXT: vpslld $31, %xmm0, %xmm0
95 ; AVX512BW-NEXT: vptestmd %zmm0, %zmm0, %k0
96 ; AVX512BW-NEXT: kmovd %k0, %eax
97 ; AVX512BW-NEXT: testb $15, %al
98 ; AVX512BW-NEXT: setnp %al
99 ; AVX512BW-NEXT: vzeroupper
100 ; AVX512BW-NEXT: retq
102 ; AVX512VL-LABEL: trunc_v4i32_v4i1:
104 ; AVX512VL-NEXT: vpslld $31, %xmm0, %xmm0
105 ; AVX512VL-NEXT: vptestmd %xmm0, %xmm0, %k0
106 ; AVX512VL-NEXT: kmovd %k0, %eax
107 ; AVX512VL-NEXT: testb %al, %al
108 ; AVX512VL-NEXT: setnp %al
109 ; AVX512VL-NEXT: retq
110 %a = trunc <4 x i32> %0 to <4 x i1>
111 %b = call i1 @llvm.vector.reduce.xor.v4i1(<4 x i1> %a)
115 define i1 @trunc_v8i16_v8i1(<8 x i16>) nounwind {
116 ; SSE-LABEL: trunc_v8i16_v8i1:
118 ; SSE-NEXT: psllw $15, %xmm0
119 ; SSE-NEXT: packsswb %xmm0, %xmm0
120 ; SSE-NEXT: pmovmskb %xmm0, %eax
121 ; SSE-NEXT: testb %al, %al
122 ; SSE-NEXT: setnp %al
123 ; SSE-NEXT: ret{{[l|q]}}
125 ; AVX-LABEL: trunc_v8i16_v8i1:
127 ; AVX-NEXT: vpsllw $15, %xmm0, %xmm0
128 ; AVX-NEXT: vpacksswb %xmm0, %xmm0, %xmm0
129 ; AVX-NEXT: vpmovmskb %xmm0, %eax
130 ; AVX-NEXT: testb %al, %al
131 ; AVX-NEXT: setnp %al
134 ; AVX512F-LABEL: trunc_v8i16_v8i1:
136 ; AVX512F-NEXT: vpmovsxwq %xmm0, %zmm0
137 ; AVX512F-NEXT: vpsllq $63, %zmm0, %zmm0
138 ; AVX512F-NEXT: vptestmq %zmm0, %zmm0, %k0
139 ; AVX512F-NEXT: kmovw %k0, %eax
140 ; AVX512F-NEXT: testb %al, %al
141 ; AVX512F-NEXT: setnp %al
142 ; AVX512F-NEXT: vzeroupper
145 ; AVX512BW-LABEL: trunc_v8i16_v8i1:
147 ; AVX512BW-NEXT: vpsllw $15, %xmm0, %xmm0
148 ; AVX512BW-NEXT: vpmovw2m %zmm0, %k0
149 ; AVX512BW-NEXT: kmovd %k0, %eax
150 ; AVX512BW-NEXT: testb %al, %al
151 ; AVX512BW-NEXT: setnp %al
152 ; AVX512BW-NEXT: vzeroupper
153 ; AVX512BW-NEXT: retq
155 ; AVX512VL-LABEL: trunc_v8i16_v8i1:
157 ; AVX512VL-NEXT: vpsllw $15, %xmm0, %xmm0
158 ; AVX512VL-NEXT: vpmovw2m %xmm0, %k0
159 ; AVX512VL-NEXT: kmovd %k0, %eax
160 ; AVX512VL-NEXT: testb %al, %al
161 ; AVX512VL-NEXT: setnp %al
162 ; AVX512VL-NEXT: retq
163 %a = trunc <8 x i16> %0 to <8 x i1>
164 %b = call i1 @llvm.vector.reduce.xor.v8i1(<8 x i1> %a)
168 define i1 @trunc_v16i8_v16i1(<16 x i8>) nounwind {
169 ; SSE-LABEL: trunc_v16i8_v16i1:
171 ; SSE-NEXT: psllw $7, %xmm0
172 ; SSE-NEXT: pmovmskb %xmm0, %eax
173 ; SSE-NEXT: xorb %ah, %al
174 ; SSE-NEXT: setnp %al
175 ; SSE-NEXT: ret{{[l|q]}}
177 ; AVX-LABEL: trunc_v16i8_v16i1:
179 ; AVX-NEXT: vpsllw $7, %xmm0, %xmm0
180 ; AVX-NEXT: vpmovmskb %xmm0, %eax
181 ; AVX-NEXT: xorb %ah, %al
182 ; AVX-NEXT: setnp %al
185 ; AVX512-LABEL: trunc_v16i8_v16i1:
187 ; AVX512-NEXT: vpsllw $7, %xmm0, %xmm0
188 ; AVX512-NEXT: vpmovmskb %xmm0, %eax
189 ; AVX512-NEXT: xorb %ah, %al
190 ; AVX512-NEXT: setnp %al
192 %a = trunc <16 x i8> %0 to <16 x i1>
193 %b = call i1 @llvm.vector.reduce.xor.v16i1(<16 x i1> %a)
197 define i1 @trunc_v4i64_v4i1(<4 x i64>) nounwind {
198 ; SSE-LABEL: trunc_v4i64_v4i1:
200 ; SSE-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,2],xmm1[0,2]
201 ; SSE-NEXT: pslld $31, %xmm0
202 ; SSE-NEXT: movmskps %xmm0, %eax
203 ; SSE-NEXT: testb %al, %al
204 ; SSE-NEXT: setnp %al
205 ; SSE-NEXT: ret{{[l|q]}}
207 ; AVX1-LABEL: trunc_v4i64_v4i1:
209 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
210 ; AVX1-NEXT: vshufps {{.*#+}} xmm0 = xmm0[0,2],xmm1[0,2]
211 ; AVX1-NEXT: vpslld $31, %xmm0, %xmm0
212 ; AVX1-NEXT: vmovmskps %xmm0, %eax
213 ; AVX1-NEXT: testb %al, %al
214 ; AVX1-NEXT: setnp %al
215 ; AVX1-NEXT: vzeroupper
218 ; AVX2-LABEL: trunc_v4i64_v4i1:
220 ; AVX2-NEXT: vpsllq $63, %ymm0, %ymm0
221 ; AVX2-NEXT: vmovmskpd %ymm0, %eax
222 ; AVX2-NEXT: testb %al, %al
223 ; AVX2-NEXT: setnp %al
224 ; AVX2-NEXT: vzeroupper
227 ; AVX512F-LABEL: trunc_v4i64_v4i1:
229 ; AVX512F-NEXT: vpsllq $63, %ymm0, %ymm0
230 ; AVX512F-NEXT: vptestmq %zmm0, %zmm0, %k0
231 ; AVX512F-NEXT: kmovw %k0, %eax
232 ; AVX512F-NEXT: testb $15, %al
233 ; AVX512F-NEXT: setnp %al
234 ; AVX512F-NEXT: vzeroupper
237 ; AVX512BW-LABEL: trunc_v4i64_v4i1:
239 ; AVX512BW-NEXT: vpsllq $63, %ymm0, %ymm0
240 ; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k0
241 ; AVX512BW-NEXT: kmovd %k0, %eax
242 ; AVX512BW-NEXT: testb $15, %al
243 ; AVX512BW-NEXT: setnp %al
244 ; AVX512BW-NEXT: vzeroupper
245 ; AVX512BW-NEXT: retq
247 ; AVX512VL-LABEL: trunc_v4i64_v4i1:
249 ; AVX512VL-NEXT: vpsllq $63, %ymm0, %ymm0
250 ; AVX512VL-NEXT: vptestmq %ymm0, %ymm0, %k0
251 ; AVX512VL-NEXT: kmovd %k0, %eax
252 ; AVX512VL-NEXT: testb %al, %al
253 ; AVX512VL-NEXT: setnp %al
254 ; AVX512VL-NEXT: vzeroupper
255 ; AVX512VL-NEXT: retq
256 %a = trunc <4 x i64> %0 to <4 x i1>
257 %b = call i1 @llvm.vector.reduce.xor.v4i1(<4 x i1> %a)
261 define i1 @trunc_v8i32_v8i1(<8 x i32>) nounwind {
262 ; SSE2-LABEL: trunc_v8i32_v8i1:
264 ; SSE2-NEXT: pslld $16, %xmm1
265 ; SSE2-NEXT: psrad $16, %xmm1
266 ; SSE2-NEXT: pslld $16, %xmm0
267 ; SSE2-NEXT: psrad $16, %xmm0
268 ; SSE2-NEXT: packssdw %xmm1, %xmm0
269 ; SSE2-NEXT: psllw $15, %xmm0
270 ; SSE2-NEXT: packsswb %xmm0, %xmm0
271 ; SSE2-NEXT: pmovmskb %xmm0, %eax
272 ; SSE2-NEXT: testb %al, %al
273 ; SSE2-NEXT: setnp %al
274 ; SSE2-NEXT: ret{{[l|q]}}
276 ; SSE41-LABEL: trunc_v8i32_v8i1:
278 ; SSE41-NEXT: pxor %xmm2, %xmm2
279 ; SSE41-NEXT: pblendw {{.*#+}} xmm1 = xmm1[0],xmm2[1],xmm1[2],xmm2[3],xmm1[4],xmm2[5],xmm1[6],xmm2[7]
280 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm0[0],xmm2[1],xmm0[2],xmm2[3],xmm0[4],xmm2[5],xmm0[6],xmm2[7]
281 ; SSE41-NEXT: packusdw %xmm1, %xmm0
282 ; SSE41-NEXT: psllw $15, %xmm0
283 ; SSE41-NEXT: packsswb %xmm0, %xmm0
284 ; SSE41-NEXT: pmovmskb %xmm0, %eax
285 ; SSE41-NEXT: testb %al, %al
286 ; SSE41-NEXT: setnp %al
289 ; AVX1-LABEL: trunc_v8i32_v8i1:
291 ; AVX1-NEXT: vpslld $31, %xmm0, %xmm1
292 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm0
293 ; AVX1-NEXT: vpslld $31, %xmm0, %xmm0
294 ; AVX1-NEXT: vinsertf128 $1, %xmm0, %ymm1, %ymm0
295 ; AVX1-NEXT: vmovmskps %ymm0, %eax
296 ; AVX1-NEXT: testb %al, %al
297 ; AVX1-NEXT: setnp %al
298 ; AVX1-NEXT: vzeroupper
301 ; AVX2-LABEL: trunc_v8i32_v8i1:
303 ; AVX2-NEXT: vpslld $31, %ymm0, %ymm0
304 ; AVX2-NEXT: vmovmskps %ymm0, %eax
305 ; AVX2-NEXT: testb %al, %al
306 ; AVX2-NEXT: setnp %al
307 ; AVX2-NEXT: vzeroupper
310 ; AVX512F-LABEL: trunc_v8i32_v8i1:
312 ; AVX512F-NEXT: vpslld $31, %ymm0, %ymm0
313 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
314 ; AVX512F-NEXT: kmovw %k0, %eax
315 ; AVX512F-NEXT: testb %al, %al
316 ; AVX512F-NEXT: setnp %al
317 ; AVX512F-NEXT: vzeroupper
320 ; AVX512BW-LABEL: trunc_v8i32_v8i1:
322 ; AVX512BW-NEXT: vpslld $31, %ymm0, %ymm0
323 ; AVX512BW-NEXT: vptestmd %zmm0, %zmm0, %k0
324 ; AVX512BW-NEXT: kmovd %k0, %eax
325 ; AVX512BW-NEXT: testb %al, %al
326 ; AVX512BW-NEXT: setnp %al
327 ; AVX512BW-NEXT: vzeroupper
328 ; AVX512BW-NEXT: retq
330 ; AVX512VL-LABEL: trunc_v8i32_v8i1:
332 ; AVX512VL-NEXT: vpslld $31, %ymm0, %ymm0
333 ; AVX512VL-NEXT: vptestmd %ymm0, %ymm0, %k0
334 ; AVX512VL-NEXT: kmovd %k0, %eax
335 ; AVX512VL-NEXT: testb %al, %al
336 ; AVX512VL-NEXT: setnp %al
337 ; AVX512VL-NEXT: vzeroupper
338 ; AVX512VL-NEXT: retq
339 %a = trunc <8 x i32> %0 to <8 x i1>
340 %b = call i1 @llvm.vector.reduce.xor.v8i1(<8 x i1> %a)
344 define i1 @trunc_v16i16_v16i1(<16 x i16>) nounwind {
345 ; SSE-LABEL: trunc_v16i16_v16i1:
347 ; SSE-NEXT: movdqa {{.*#+}} xmm2 = [255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0]
348 ; SSE-NEXT: pand %xmm2, %xmm1
349 ; SSE-NEXT: pand %xmm2, %xmm0
350 ; SSE-NEXT: packuswb %xmm1, %xmm0
351 ; SSE-NEXT: psllw $7, %xmm0
352 ; SSE-NEXT: pmovmskb %xmm0, %eax
353 ; SSE-NEXT: xorb %ah, %al
354 ; SSE-NEXT: setnp %al
355 ; SSE-NEXT: ret{{[l|q]}}
357 ; AVX1-LABEL: trunc_v16i16_v16i1:
359 ; AVX1-NEXT: vandps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %ymm0, %ymm0
360 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
361 ; AVX1-NEXT: vpackuswb %xmm1, %xmm0, %xmm0
362 ; AVX1-NEXT: vpsllw $7, %xmm0, %xmm0
363 ; AVX1-NEXT: vpmovmskb %xmm0, %eax
364 ; AVX1-NEXT: xorb %ah, %al
365 ; AVX1-NEXT: setnp %al
366 ; AVX1-NEXT: vzeroupper
369 ; AVX2-LABEL: trunc_v16i16_v16i1:
371 ; AVX2-NEXT: vpand {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %ymm0, %ymm0
372 ; AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
373 ; AVX2-NEXT: vpackuswb %xmm1, %xmm0, %xmm0
374 ; AVX2-NEXT: vpsllw $7, %xmm0, %xmm0
375 ; AVX2-NEXT: vpmovmskb %xmm0, %eax
376 ; AVX2-NEXT: xorb %ah, %al
377 ; AVX2-NEXT: setnp %al
378 ; AVX2-NEXT: vzeroupper
381 ; AVX512F-LABEL: trunc_v16i16_v16i1:
383 ; AVX512F-NEXT: vpmovsxwd %ymm0, %zmm0
384 ; AVX512F-NEXT: vpslld $31, %zmm0, %zmm0
385 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
386 ; AVX512F-NEXT: kmovw %k0, %eax
387 ; AVX512F-NEXT: movl %eax, %ecx
388 ; AVX512F-NEXT: shrl $8, %ecx
389 ; AVX512F-NEXT: xorb %al, %cl
390 ; AVX512F-NEXT: setnp %al
391 ; AVX512F-NEXT: vzeroupper
394 ; AVX512BW-LABEL: trunc_v16i16_v16i1:
396 ; AVX512BW-NEXT: vpsllw $15, %ymm0, %ymm0
397 ; AVX512BW-NEXT: vpmovw2m %zmm0, %k0
398 ; AVX512BW-NEXT: kmovd %k0, %eax
399 ; AVX512BW-NEXT: movl %eax, %ecx
400 ; AVX512BW-NEXT: shrl $8, %ecx
401 ; AVX512BW-NEXT: xorb %al, %cl
402 ; AVX512BW-NEXT: setnp %al
403 ; AVX512BW-NEXT: vzeroupper
404 ; AVX512BW-NEXT: retq
406 ; AVX512VL-LABEL: trunc_v16i16_v16i1:
408 ; AVX512VL-NEXT: vpsllw $15, %ymm0, %ymm0
409 ; AVX512VL-NEXT: vpmovw2m %ymm0, %k0
410 ; AVX512VL-NEXT: kmovd %k0, %eax
411 ; AVX512VL-NEXT: movl %eax, %ecx
412 ; AVX512VL-NEXT: shrl $8, %ecx
413 ; AVX512VL-NEXT: xorb %al, %cl
414 ; AVX512VL-NEXT: setnp %al
415 ; AVX512VL-NEXT: vzeroupper
416 ; AVX512VL-NEXT: retq
417 %a = trunc <16 x i16> %0 to <16 x i1>
418 %b = call i1 @llvm.vector.reduce.xor.v16i1(<16 x i1> %a)
422 define i1 @trunc_v32i8_v32i1(<32 x i8>) nounwind {
423 ; SSE-LABEL: trunc_v32i8_v32i1:
425 ; SSE-NEXT: pxor %xmm1, %xmm0
426 ; SSE-NEXT: psllw $7, %xmm0
427 ; SSE-NEXT: pmovmskb %xmm0, %eax
428 ; SSE-NEXT: xorb %ah, %al
429 ; SSE-NEXT: setnp %al
430 ; SSE-NEXT: ret{{[l|q]}}
432 ; AVX1-LABEL: trunc_v32i8_v32i1:
434 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
435 ; AVX1-NEXT: vpxor %xmm1, %xmm0, %xmm0
436 ; AVX1-NEXT: vpsllw $7, %xmm0, %xmm0
437 ; AVX1-NEXT: vpmovmskb %xmm0, %eax
438 ; AVX1-NEXT: xorb %ah, %al
439 ; AVX1-NEXT: setnp %al
440 ; AVX1-NEXT: vzeroupper
443 ; AVX2-LABEL: trunc_v32i8_v32i1:
445 ; AVX2-NEXT: vpsllw $7, %ymm0, %ymm0
446 ; AVX2-NEXT: vpmovmskb %ymm0, %eax
447 ; AVX2-NEXT: movl %eax, %ecx
448 ; AVX2-NEXT: shrl $16, %ecx
449 ; AVX2-NEXT: xorl %eax, %ecx
450 ; AVX2-NEXT: xorb %ch, %cl
451 ; AVX2-NEXT: setnp %al
452 ; AVX2-NEXT: vzeroupper
455 ; AVX512F-LABEL: trunc_v32i8_v32i1:
457 ; AVX512F-NEXT: vextracti128 $1, %ymm0, %xmm1
458 ; AVX512F-NEXT: vpxor %xmm1, %xmm0, %xmm0
459 ; AVX512F-NEXT: vpmovsxbd %xmm0, %zmm0
460 ; AVX512F-NEXT: vpslld $31, %zmm0, %zmm0
461 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
462 ; AVX512F-NEXT: kshiftrw $8, %k0, %k1
463 ; AVX512F-NEXT: kxorw %k1, %k0, %k0
464 ; AVX512F-NEXT: kshiftrw $4, %k0, %k1
465 ; AVX512F-NEXT: kxorw %k1, %k0, %k0
466 ; AVX512F-NEXT: kshiftrw $2, %k0, %k1
467 ; AVX512F-NEXT: kxorw %k1, %k0, %k0
468 ; AVX512F-NEXT: kshiftrw $1, %k0, %k1
469 ; AVX512F-NEXT: kxorw %k1, %k0, %k0
470 ; AVX512F-NEXT: kmovw %k0, %eax
471 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
472 ; AVX512F-NEXT: vzeroupper
475 ; AVX512BW-LABEL: trunc_v32i8_v32i1:
477 ; AVX512BW-NEXT: vpsllw $7, %ymm0, %ymm0
478 ; AVX512BW-NEXT: vpmovmskb %ymm0, %eax
479 ; AVX512BW-NEXT: movl %eax, %ecx
480 ; AVX512BW-NEXT: shrl $16, %ecx
481 ; AVX512BW-NEXT: xorl %eax, %ecx
482 ; AVX512BW-NEXT: xorb %ch, %cl
483 ; AVX512BW-NEXT: setnp %al
484 ; AVX512BW-NEXT: vzeroupper
485 ; AVX512BW-NEXT: retq
487 ; AVX512VL-LABEL: trunc_v32i8_v32i1:
489 ; AVX512VL-NEXT: vpsllw $7, %ymm0, %ymm0
490 ; AVX512VL-NEXT: vpmovmskb %ymm0, %eax
491 ; AVX512VL-NEXT: movl %eax, %ecx
492 ; AVX512VL-NEXT: shrl $16, %ecx
493 ; AVX512VL-NEXT: xorl %eax, %ecx
494 ; AVX512VL-NEXT: xorb %ch, %cl
495 ; AVX512VL-NEXT: setnp %al
496 ; AVX512VL-NEXT: vzeroupper
497 ; AVX512VL-NEXT: retq
498 %a = trunc <32 x i8> %0 to <32 x i1>
499 %b = call i1 @llvm.vector.reduce.xor.v32i1(<32 x i1> %a)
503 define i1 @trunc_v8i64_v8i1(<8 x i64>) nounwind {
504 ; X86-SSE2-LABEL: trunc_v8i64_v8i1:
506 ; X86-SSE2-NEXT: pushl %ebp
507 ; X86-SSE2-NEXT: movl %esp, %ebp
508 ; X86-SSE2-NEXT: andl $-16, %esp
509 ; X86-SSE2-NEXT: subl $16, %esp
510 ; X86-SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,2],xmm1[0,2]
511 ; X86-SSE2-NEXT: pslld $16, %xmm0
512 ; X86-SSE2-NEXT: psrad $16, %xmm0
513 ; X86-SSE2-NEXT: shufps {{.*#+}} xmm2 = xmm2[0,2],mem[0,2]
514 ; X86-SSE2-NEXT: pslld $16, %xmm2
515 ; X86-SSE2-NEXT: psrad $16, %xmm2
516 ; X86-SSE2-NEXT: packssdw %xmm2, %xmm0
517 ; X86-SSE2-NEXT: psllw $15, %xmm0
518 ; X86-SSE2-NEXT: packsswb %xmm0, %xmm0
519 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
520 ; X86-SSE2-NEXT: testb %al, %al
521 ; X86-SSE2-NEXT: setnp %al
522 ; X86-SSE2-NEXT: movl %ebp, %esp
523 ; X86-SSE2-NEXT: popl %ebp
524 ; X86-SSE2-NEXT: retl
526 ; X64-SSE2-LABEL: trunc_v8i64_v8i1:
528 ; X64-SSE2-NEXT: shufps {{.*#+}} xmm2 = xmm2[0,2],xmm3[0,2]
529 ; X64-SSE2-NEXT: pslld $16, %xmm2
530 ; X64-SSE2-NEXT: psrad $16, %xmm2
531 ; X64-SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,2],xmm1[0,2]
532 ; X64-SSE2-NEXT: pslld $16, %xmm0
533 ; X64-SSE2-NEXT: psrad $16, %xmm0
534 ; X64-SSE2-NEXT: packssdw %xmm2, %xmm0
535 ; X64-SSE2-NEXT: psllw $15, %xmm0
536 ; X64-SSE2-NEXT: packsswb %xmm0, %xmm0
537 ; X64-SSE2-NEXT: pmovmskb %xmm0, %eax
538 ; X64-SSE2-NEXT: testb %al, %al
539 ; X64-SSE2-NEXT: setnp %al
540 ; X64-SSE2-NEXT: retq
542 ; SSE41-LABEL: trunc_v8i64_v8i1:
544 ; SSE41-NEXT: pxor %xmm4, %xmm4
545 ; SSE41-NEXT: pblendw {{.*#+}} xmm3 = xmm3[0],xmm4[1,2,3],xmm3[4],xmm4[5,6,7]
546 ; SSE41-NEXT: pblendw {{.*#+}} xmm2 = xmm2[0],xmm4[1,2,3],xmm2[4],xmm4[5,6,7]
547 ; SSE41-NEXT: packusdw %xmm3, %xmm2
548 ; SSE41-NEXT: pblendw {{.*#+}} xmm1 = xmm1[0],xmm4[1,2,3],xmm1[4],xmm4[5,6,7]
549 ; SSE41-NEXT: pblendw {{.*#+}} xmm0 = xmm0[0],xmm4[1,2,3],xmm0[4],xmm4[5,6,7]
550 ; SSE41-NEXT: packusdw %xmm1, %xmm0
551 ; SSE41-NEXT: packusdw %xmm2, %xmm0
552 ; SSE41-NEXT: psllw $15, %xmm0
553 ; SSE41-NEXT: packsswb %xmm0, %xmm0
554 ; SSE41-NEXT: pmovmskb %xmm0, %eax
555 ; SSE41-NEXT: testb %al, %al
556 ; SSE41-NEXT: setnp %al
559 ; AVX1-LABEL: trunc_v8i64_v8i1:
561 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
562 ; AVX1-NEXT: vshufps {{.*#+}} xmm1 = xmm1[0,2],xmm2[0,2]
563 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm2
564 ; AVX1-NEXT: vshufps {{.*#+}} xmm0 = xmm0[0,2],xmm2[0,2]
565 ; AVX1-NEXT: vpslld $31, %xmm0, %xmm0
566 ; AVX1-NEXT: vpslld $31, %xmm1, %xmm1
567 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
568 ; AVX1-NEXT: vmovmskps %ymm0, %eax
569 ; AVX1-NEXT: testb %al, %al
570 ; AVX1-NEXT: setnp %al
571 ; AVX1-NEXT: vzeroupper
574 ; AVX2-LABEL: trunc_v8i64_v8i1:
576 ; AVX2-NEXT: vperm2f128 {{.*#+}} ymm2 = ymm0[2,3],ymm1[2,3]
577 ; AVX2-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
578 ; AVX2-NEXT: vshufps {{.*#+}} ymm0 = ymm0[0,2],ymm2[0,2],ymm0[4,6],ymm2[4,6]
579 ; AVX2-NEXT: vpslld $31, %ymm0, %ymm0
580 ; AVX2-NEXT: vmovmskps %ymm0, %eax
581 ; AVX2-NEXT: testb %al, %al
582 ; AVX2-NEXT: setnp %al
583 ; AVX2-NEXT: vzeroupper
586 ; AVX512F-LABEL: trunc_v8i64_v8i1:
588 ; AVX512F-NEXT: vpsllq $63, %zmm0, %zmm0
589 ; AVX512F-NEXT: vptestmq %zmm0, %zmm0, %k0
590 ; AVX512F-NEXT: kmovw %k0, %eax
591 ; AVX512F-NEXT: testb %al, %al
592 ; AVX512F-NEXT: setnp %al
593 ; AVX512F-NEXT: vzeroupper
596 ; AVX512BW-LABEL: trunc_v8i64_v8i1:
598 ; AVX512BW-NEXT: vpsllq $63, %zmm0, %zmm0
599 ; AVX512BW-NEXT: vptestmq %zmm0, %zmm0, %k0
600 ; AVX512BW-NEXT: kmovd %k0, %eax
601 ; AVX512BW-NEXT: testb %al, %al
602 ; AVX512BW-NEXT: setnp %al
603 ; AVX512BW-NEXT: vzeroupper
604 ; AVX512BW-NEXT: retq
606 ; AVX512VL-LABEL: trunc_v8i64_v8i1:
608 ; AVX512VL-NEXT: vpsllq $63, %zmm0, %zmm0
609 ; AVX512VL-NEXT: vptestmq %zmm0, %zmm0, %k0
610 ; AVX512VL-NEXT: kmovd %k0, %eax
611 ; AVX512VL-NEXT: testb %al, %al
612 ; AVX512VL-NEXT: setnp %al
613 ; AVX512VL-NEXT: vzeroupper
614 ; AVX512VL-NEXT: retq
615 %a = trunc <8 x i64> %0 to <8 x i1>
616 %b = call i1 @llvm.vector.reduce.xor.v8i1(<8 x i1> %a)
620 define i1 @trunc_v16i32_v16i1(<16 x i32>) nounwind {
621 ; X86-SSE2-LABEL: trunc_v16i32_v16i1:
623 ; X86-SSE2-NEXT: pushl %ebp
624 ; X86-SSE2-NEXT: movl %esp, %ebp
625 ; X86-SSE2-NEXT: andl $-16, %esp
626 ; X86-SSE2-NEXT: subl $16, %esp
627 ; X86-SSE2-NEXT: movdqa {{.*#+}} xmm3 = [255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0]
628 ; X86-SSE2-NEXT: pand %xmm3, %xmm1
629 ; X86-SSE2-NEXT: pand %xmm3, %xmm0
630 ; X86-SSE2-NEXT: packuswb %xmm1, %xmm0
631 ; X86-SSE2-NEXT: pand %xmm3, %xmm2
632 ; X86-SSE2-NEXT: pand 8(%ebp), %xmm3
633 ; X86-SSE2-NEXT: packuswb %xmm3, %xmm2
634 ; X86-SSE2-NEXT: packuswb %xmm2, %xmm0
635 ; X86-SSE2-NEXT: psllw $7, %xmm0
636 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
637 ; X86-SSE2-NEXT: xorb %ah, %al
638 ; X86-SSE2-NEXT: setnp %al
639 ; X86-SSE2-NEXT: movl %ebp, %esp
640 ; X86-SSE2-NEXT: popl %ebp
641 ; X86-SSE2-NEXT: retl
643 ; X64-SSE2-LABEL: trunc_v16i32_v16i1:
645 ; X64-SSE2-NEXT: movdqa {{.*#+}} xmm4 = [255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0]
646 ; X64-SSE2-NEXT: pand %xmm4, %xmm3
647 ; X64-SSE2-NEXT: pand %xmm4, %xmm2
648 ; X64-SSE2-NEXT: packuswb %xmm3, %xmm2
649 ; X64-SSE2-NEXT: pand %xmm4, %xmm1
650 ; X64-SSE2-NEXT: pand %xmm4, %xmm0
651 ; X64-SSE2-NEXT: packuswb %xmm1, %xmm0
652 ; X64-SSE2-NEXT: packuswb %xmm2, %xmm0
653 ; X64-SSE2-NEXT: psllw $7, %xmm0
654 ; X64-SSE2-NEXT: pmovmskb %xmm0, %eax
655 ; X64-SSE2-NEXT: xorb %ah, %al
656 ; X64-SSE2-NEXT: setnp %al
657 ; X64-SSE2-NEXT: retq
659 ; SSE41-LABEL: trunc_v16i32_v16i1:
661 ; SSE41-NEXT: movdqa {{.*#+}} xmm4 = [255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0]
662 ; SSE41-NEXT: pand %xmm4, %xmm3
663 ; SSE41-NEXT: pand %xmm4, %xmm2
664 ; SSE41-NEXT: packusdw %xmm3, %xmm2
665 ; SSE41-NEXT: pand %xmm4, %xmm1
666 ; SSE41-NEXT: pand %xmm4, %xmm0
667 ; SSE41-NEXT: packusdw %xmm1, %xmm0
668 ; SSE41-NEXT: packuswb %xmm2, %xmm0
669 ; SSE41-NEXT: psllw $7, %xmm0
670 ; SSE41-NEXT: pmovmskb %xmm0, %eax
671 ; SSE41-NEXT: xorb %ah, %al
672 ; SSE41-NEXT: setnp %al
675 ; AVX1-LABEL: trunc_v16i32_v16i1:
677 ; AVX1-NEXT: vbroadcastss {{.*#+}} ymm2 = [255,255,255,255,255,255,255,255]
678 ; AVX1-NEXT: vandps %ymm2, %ymm1, %ymm1
679 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm3
680 ; AVX1-NEXT: vpackusdw %xmm3, %xmm1, %xmm1
681 ; AVX1-NEXT: vandps %ymm2, %ymm0, %ymm0
682 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm2
683 ; AVX1-NEXT: vpackusdw %xmm2, %xmm0, %xmm0
684 ; AVX1-NEXT: vpackuswb %xmm1, %xmm0, %xmm0
685 ; AVX1-NEXT: vpsllw $7, %xmm0, %xmm0
686 ; AVX1-NEXT: vpmovmskb %xmm0, %eax
687 ; AVX1-NEXT: xorb %ah, %al
688 ; AVX1-NEXT: setnp %al
689 ; AVX1-NEXT: vzeroupper
692 ; AVX2-LABEL: trunc_v16i32_v16i1:
694 ; AVX2-NEXT: vpbroadcastd {{.*#+}} ymm2 = [255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0,255,0,0,0]
695 ; AVX2-NEXT: vpand %ymm2, %ymm1, %ymm1
696 ; AVX2-NEXT: vpand %ymm2, %ymm0, %ymm0
697 ; AVX2-NEXT: vpackusdw %ymm1, %ymm0, %ymm0
698 ; AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
699 ; AVX2-NEXT: vpackuswb %xmm1, %xmm0, %xmm0
700 ; AVX2-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[0,2,1,3]
701 ; AVX2-NEXT: vpsllw $7, %xmm0, %xmm0
702 ; AVX2-NEXT: vpmovmskb %xmm0, %eax
703 ; AVX2-NEXT: xorb %ah, %al
704 ; AVX2-NEXT: setnp %al
705 ; AVX2-NEXT: vzeroupper
708 ; AVX512F-LABEL: trunc_v16i32_v16i1:
710 ; AVX512F-NEXT: vpslld $31, %zmm0, %zmm0
711 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
712 ; AVX512F-NEXT: kmovw %k0, %eax
713 ; AVX512F-NEXT: movl %eax, %ecx
714 ; AVX512F-NEXT: shrl $8, %ecx
715 ; AVX512F-NEXT: xorb %al, %cl
716 ; AVX512F-NEXT: setnp %al
717 ; AVX512F-NEXT: vzeroupper
720 ; AVX512BW-LABEL: trunc_v16i32_v16i1:
722 ; AVX512BW-NEXT: vpslld $31, %zmm0, %zmm0
723 ; AVX512BW-NEXT: vptestmd %zmm0, %zmm0, %k0
724 ; AVX512BW-NEXT: kmovd %k0, %eax
725 ; AVX512BW-NEXT: movl %eax, %ecx
726 ; AVX512BW-NEXT: shrl $8, %ecx
727 ; AVX512BW-NEXT: xorb %al, %cl
728 ; AVX512BW-NEXT: setnp %al
729 ; AVX512BW-NEXT: vzeroupper
730 ; AVX512BW-NEXT: retq
732 ; AVX512VL-LABEL: trunc_v16i32_v16i1:
734 ; AVX512VL-NEXT: vpslld $31, %zmm0, %zmm0
735 ; AVX512VL-NEXT: vptestmd %zmm0, %zmm0, %k0
736 ; AVX512VL-NEXT: kmovd %k0, %eax
737 ; AVX512VL-NEXT: movl %eax, %ecx
738 ; AVX512VL-NEXT: shrl $8, %ecx
739 ; AVX512VL-NEXT: xorb %al, %cl
740 ; AVX512VL-NEXT: setnp %al
741 ; AVX512VL-NEXT: vzeroupper
742 ; AVX512VL-NEXT: retq
743 %a = trunc <16 x i32> %0 to <16 x i1>
744 %b = call i1 @llvm.vector.reduce.xor.v16i1(<16 x i1> %a)
748 define i1 @trunc_v32i16_v32i1(<32 x i16>) nounwind {
749 ; X86-SSE2-LABEL: trunc_v32i16_v32i1:
751 ; X86-SSE2-NEXT: pushl %ebp
752 ; X86-SSE2-NEXT: movl %esp, %ebp
753 ; X86-SSE2-NEXT: andl $-16, %esp
754 ; X86-SSE2-NEXT: subl $16, %esp
755 ; X86-SSE2-NEXT: movdqa {{.*#+}} xmm3 = [255,255,255,255,255,255,255,255]
756 ; X86-SSE2-NEXT: pand %xmm3, %xmm1
757 ; X86-SSE2-NEXT: pand %xmm3, %xmm0
758 ; X86-SSE2-NEXT: packuswb %xmm1, %xmm0
759 ; X86-SSE2-NEXT: pand %xmm3, %xmm2
760 ; X86-SSE2-NEXT: pand 8(%ebp), %xmm3
761 ; X86-SSE2-NEXT: packuswb %xmm3, %xmm2
762 ; X86-SSE2-NEXT: pxor %xmm0, %xmm2
763 ; X86-SSE2-NEXT: psllw $7, %xmm2
764 ; X86-SSE2-NEXT: pmovmskb %xmm2, %eax
765 ; X86-SSE2-NEXT: xorb %ah, %al
766 ; X86-SSE2-NEXT: setnp %al
767 ; X86-SSE2-NEXT: movl %ebp, %esp
768 ; X86-SSE2-NEXT: popl %ebp
769 ; X86-SSE2-NEXT: retl
771 ; X64-SSE-LABEL: trunc_v32i16_v32i1:
773 ; X64-SSE-NEXT: movdqa {{.*#+}} xmm4 = [255,255,255,255,255,255,255,255]
774 ; X64-SSE-NEXT: pand %xmm4, %xmm3
775 ; X64-SSE-NEXT: pand %xmm4, %xmm2
776 ; X64-SSE-NEXT: packuswb %xmm3, %xmm2
777 ; X64-SSE-NEXT: pand %xmm4, %xmm1
778 ; X64-SSE-NEXT: pand %xmm4, %xmm0
779 ; X64-SSE-NEXT: packuswb %xmm1, %xmm0
780 ; X64-SSE-NEXT: pxor %xmm2, %xmm0
781 ; X64-SSE-NEXT: psllw $7, %xmm0
782 ; X64-SSE-NEXT: pmovmskb %xmm0, %eax
783 ; X64-SSE-NEXT: xorb %ah, %al
784 ; X64-SSE-NEXT: setnp %al
787 ; AVX1-LABEL: trunc_v32i16_v32i1:
789 ; AVX1-NEXT: vxorps %ymm1, %ymm0, %ymm0
790 ; AVX1-NEXT: vandps {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %ymm0, %ymm0
791 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
792 ; AVX1-NEXT: vpackuswb %xmm1, %xmm0, %xmm0
793 ; AVX1-NEXT: vpsllw $7, %xmm0, %xmm0
794 ; AVX1-NEXT: vpmovmskb %xmm0, %eax
795 ; AVX1-NEXT: xorb %ah, %al
796 ; AVX1-NEXT: setnp %al
797 ; AVX1-NEXT: vzeroupper
800 ; AVX2-LABEL: trunc_v32i16_v32i1:
802 ; AVX2-NEXT: vpbroadcastw {{.*#+}} ymm2 = [255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0,255,0]
803 ; AVX2-NEXT: vpand %ymm2, %ymm1, %ymm1
804 ; AVX2-NEXT: vpand %ymm2, %ymm0, %ymm0
805 ; AVX2-NEXT: vpackuswb %ymm1, %ymm0, %ymm0
806 ; AVX2-NEXT: vpermq {{.*#+}} ymm0 = ymm0[0,2,1,3]
807 ; AVX2-NEXT: vpsllw $7, %ymm0, %ymm0
808 ; AVX2-NEXT: vpmovmskb %ymm0, %eax
809 ; AVX2-NEXT: movl %eax, %ecx
810 ; AVX2-NEXT: shrl $16, %ecx
811 ; AVX2-NEXT: xorl %eax, %ecx
812 ; AVX2-NEXT: xorb %ch, %cl
813 ; AVX2-NEXT: setnp %al
814 ; AVX2-NEXT: vzeroupper
817 ; AVX512F-LABEL: trunc_v32i16_v32i1:
819 ; AVX512F-NEXT: vextracti64x4 $1, %zmm0, %ymm1
820 ; AVX512F-NEXT: vpxor %ymm1, %ymm0, %ymm0
821 ; AVX512F-NEXT: vpmovsxwd %ymm0, %zmm0
822 ; AVX512F-NEXT: vpslld $31, %zmm0, %zmm0
823 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
824 ; AVX512F-NEXT: kshiftrw $8, %k0, %k1
825 ; AVX512F-NEXT: kxorw %k1, %k0, %k0
826 ; AVX512F-NEXT: kshiftrw $4, %k0, %k1
827 ; AVX512F-NEXT: kxorw %k1, %k0, %k0
828 ; AVX512F-NEXT: kshiftrw $2, %k0, %k1
829 ; AVX512F-NEXT: kxorw %k1, %k0, %k0
830 ; AVX512F-NEXT: kshiftrw $1, %k0, %k1
831 ; AVX512F-NEXT: kxorw %k1, %k0, %k0
832 ; AVX512F-NEXT: kmovw %k0, %eax
833 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
834 ; AVX512F-NEXT: vzeroupper
837 ; AVX512BW-LABEL: trunc_v32i16_v32i1:
839 ; AVX512BW-NEXT: vpsllw $15, %zmm0, %zmm0
840 ; AVX512BW-NEXT: vpmovw2m %zmm0, %k0
841 ; AVX512BW-NEXT: kmovd %k0, %eax
842 ; AVX512BW-NEXT: movl %eax, %ecx
843 ; AVX512BW-NEXT: shrl $16, %ecx
844 ; AVX512BW-NEXT: xorl %eax, %ecx
845 ; AVX512BW-NEXT: xorb %ch, %cl
846 ; AVX512BW-NEXT: setnp %al
847 ; AVX512BW-NEXT: vzeroupper
848 ; AVX512BW-NEXT: retq
850 ; AVX512VL-LABEL: trunc_v32i16_v32i1:
852 ; AVX512VL-NEXT: vpsllw $15, %zmm0, %zmm0
853 ; AVX512VL-NEXT: vpmovw2m %zmm0, %k0
854 ; AVX512VL-NEXT: kmovd %k0, %eax
855 ; AVX512VL-NEXT: movl %eax, %ecx
856 ; AVX512VL-NEXT: shrl $16, %ecx
857 ; AVX512VL-NEXT: xorl %eax, %ecx
858 ; AVX512VL-NEXT: xorb %ch, %cl
859 ; AVX512VL-NEXT: setnp %al
860 ; AVX512VL-NEXT: vzeroupper
861 ; AVX512VL-NEXT: retq
862 %a = trunc <32 x i16> %0 to <32 x i1>
863 %b = call i1 @llvm.vector.reduce.xor.v32i1(<32 x i1> %a)
867 define i1 @trunc_v64i8_v64i1(<64 x i8>) nounwind {
868 ; X86-SSE2-LABEL: trunc_v64i8_v64i1:
870 ; X86-SSE2-NEXT: pushl %ebp
871 ; X86-SSE2-NEXT: movl %esp, %ebp
872 ; X86-SSE2-NEXT: andl $-16, %esp
873 ; X86-SSE2-NEXT: subl $16, %esp
874 ; X86-SSE2-NEXT: pxor %xmm2, %xmm0
875 ; X86-SSE2-NEXT: pxor 8(%ebp), %xmm1
876 ; X86-SSE2-NEXT: pxor %xmm0, %xmm1
877 ; X86-SSE2-NEXT: psllw $7, %xmm1
878 ; X86-SSE2-NEXT: pmovmskb %xmm1, %eax
879 ; X86-SSE2-NEXT: xorb %ah, %al
880 ; X86-SSE2-NEXT: setnp %al
881 ; X86-SSE2-NEXT: movl %ebp, %esp
882 ; X86-SSE2-NEXT: popl %ebp
883 ; X86-SSE2-NEXT: retl
885 ; X64-SSE-LABEL: trunc_v64i8_v64i1:
887 ; X64-SSE-NEXT: pxor %xmm3, %xmm1
888 ; X64-SSE-NEXT: pxor %xmm2, %xmm0
889 ; X64-SSE-NEXT: pxor %xmm1, %xmm0
890 ; X64-SSE-NEXT: psllw $7, %xmm0
891 ; X64-SSE-NEXT: pmovmskb %xmm0, %eax
892 ; X64-SSE-NEXT: xorb %ah, %al
893 ; X64-SSE-NEXT: setnp %al
896 ; AVX1-LABEL: trunc_v64i8_v64i1:
898 ; AVX1-NEXT: vxorps %ymm1, %ymm0, %ymm0
899 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
900 ; AVX1-NEXT: vxorps %xmm1, %xmm0, %xmm0
901 ; AVX1-NEXT: vpsllw $7, %xmm0, %xmm0
902 ; AVX1-NEXT: vpmovmskb %xmm0, %eax
903 ; AVX1-NEXT: xorb %ah, %al
904 ; AVX1-NEXT: setnp %al
905 ; AVX1-NEXT: vzeroupper
908 ; AVX2-LABEL: trunc_v64i8_v64i1:
910 ; AVX2-NEXT: vpxor %ymm1, %ymm0, %ymm0
911 ; AVX2-NEXT: vpsllw $7, %ymm0, %ymm0
912 ; AVX2-NEXT: vpmovmskb %ymm0, %eax
913 ; AVX2-NEXT: movl %eax, %ecx
914 ; AVX2-NEXT: shrl $16, %ecx
915 ; AVX2-NEXT: xorl %eax, %ecx
916 ; AVX2-NEXT: xorb %ch, %cl
917 ; AVX2-NEXT: setnp %al
918 ; AVX2-NEXT: vzeroupper
921 ; AVX512F-LABEL: trunc_v64i8_v64i1:
923 ; AVX512F-NEXT: vextracti64x4 $1, %zmm0, %ymm1
924 ; AVX512F-NEXT: vextracti128 $1, %ymm1, %xmm2
925 ; AVX512F-NEXT: vextracti128 $1, %ymm0, %xmm3
926 ; AVX512F-NEXT: vpxor %xmm2, %xmm3, %xmm2
927 ; AVX512F-NEXT: vpxor %xmm1, %xmm0, %xmm0
928 ; AVX512F-NEXT: vpxor %xmm2, %xmm0, %xmm0
929 ; AVX512F-NEXT: vpmovsxbd %xmm0, %zmm0
930 ; AVX512F-NEXT: vpslld $31, %zmm0, %zmm0
931 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
932 ; AVX512F-NEXT: kshiftrw $8, %k0, %k1
933 ; AVX512F-NEXT: kxorw %k1, %k0, %k0
934 ; AVX512F-NEXT: kshiftrw $4, %k0, %k1
935 ; AVX512F-NEXT: kxorw %k1, %k0, %k0
936 ; AVX512F-NEXT: kshiftrw $2, %k0, %k1
937 ; AVX512F-NEXT: kxorw %k1, %k0, %k0
938 ; AVX512F-NEXT: kshiftrw $1, %k0, %k1
939 ; AVX512F-NEXT: kxorw %k1, %k0, %k0
940 ; AVX512F-NEXT: kmovw %k0, %eax
941 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
942 ; AVX512F-NEXT: vzeroupper
945 ; AVX512BW-LABEL: trunc_v64i8_v64i1:
947 ; AVX512BW-NEXT: vpsllw $7, %zmm0, %zmm0
948 ; AVX512BW-NEXT: vpmovb2m %zmm0, %k0
949 ; AVX512BW-NEXT: kmovq %k0, %rax
950 ; AVX512BW-NEXT: movq %rax, %rcx
951 ; AVX512BW-NEXT: shrq $32, %rcx
952 ; AVX512BW-NEXT: xorl %eax, %ecx
953 ; AVX512BW-NEXT: movl %ecx, %eax
954 ; AVX512BW-NEXT: shrl $16, %eax
955 ; AVX512BW-NEXT: xorl %ecx, %eax
956 ; AVX512BW-NEXT: xorb %ah, %al
957 ; AVX512BW-NEXT: setnp %al
958 ; AVX512BW-NEXT: vzeroupper
959 ; AVX512BW-NEXT: retq
961 ; AVX512VL-LABEL: trunc_v64i8_v64i1:
963 ; AVX512VL-NEXT: vpsllw $7, %zmm0, %zmm0
964 ; AVX512VL-NEXT: vpmovb2m %zmm0, %k0
965 ; AVX512VL-NEXT: kmovq %k0, %rax
966 ; AVX512VL-NEXT: movq %rax, %rcx
967 ; AVX512VL-NEXT: shrq $32, %rcx
968 ; AVX512VL-NEXT: xorl %eax, %ecx
969 ; AVX512VL-NEXT: movl %ecx, %eax
970 ; AVX512VL-NEXT: shrl $16, %eax
971 ; AVX512VL-NEXT: xorl %ecx, %eax
972 ; AVX512VL-NEXT: xorb %ah, %al
973 ; AVX512VL-NEXT: setnp %al
974 ; AVX512VL-NEXT: vzeroupper
975 ; AVX512VL-NEXT: retq
976 %a = trunc <64 x i8> %0 to <64 x i1>
977 %b = call i1 @llvm.vector.reduce.xor.v64i1(<64 x i1> %a)
982 ; Comparison With Zero
985 define i1 @icmp0_v2i64_v2i1(<2 x i64>) nounwind {
986 ; SSE2-LABEL: icmp0_v2i64_v2i1:
988 ; SSE2-NEXT: pxor %xmm1, %xmm1
989 ; SSE2-NEXT: pcmpeqd %xmm0, %xmm1
990 ; SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,0,3,2]
991 ; SSE2-NEXT: pand %xmm1, %xmm0
992 ; SSE2-NEXT: movmskpd %xmm0, %eax
993 ; SSE2-NEXT: testb %al, %al
994 ; SSE2-NEXT: setnp %al
995 ; SSE2-NEXT: ret{{[l|q]}}
997 ; SSE41-LABEL: icmp0_v2i64_v2i1:
999 ; SSE41-NEXT: pxor %xmm1, %xmm1
1000 ; SSE41-NEXT: pcmpeqq %xmm0, %xmm1
1001 ; SSE41-NEXT: movmskpd %xmm1, %eax
1002 ; SSE41-NEXT: testb %al, %al
1003 ; SSE41-NEXT: setnp %al
1006 ; AVX-LABEL: icmp0_v2i64_v2i1:
1008 ; AVX-NEXT: vpxor %xmm1, %xmm1, %xmm1
1009 ; AVX-NEXT: vpcmpeqq %xmm1, %xmm0, %xmm0
1010 ; AVX-NEXT: vmovmskpd %xmm0, %eax
1011 ; AVX-NEXT: testb %al, %al
1012 ; AVX-NEXT: setnp %al
1015 ; AVX512F-LABEL: icmp0_v2i64_v2i1:
1017 ; AVX512F-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
1018 ; AVX512F-NEXT: vptestnmq %zmm0, %zmm0, %k0
1019 ; AVX512F-NEXT: kmovw %k0, %eax
1020 ; AVX512F-NEXT: testb $3, %al
1021 ; AVX512F-NEXT: setnp %al
1022 ; AVX512F-NEXT: vzeroupper
1023 ; AVX512F-NEXT: retq
1025 ; AVX512BW-LABEL: icmp0_v2i64_v2i1:
1026 ; AVX512BW: # %bb.0:
1027 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
1028 ; AVX512BW-NEXT: vptestnmq %zmm0, %zmm0, %k0
1029 ; AVX512BW-NEXT: kmovd %k0, %eax
1030 ; AVX512BW-NEXT: testb $3, %al
1031 ; AVX512BW-NEXT: setnp %al
1032 ; AVX512BW-NEXT: vzeroupper
1033 ; AVX512BW-NEXT: retq
1035 ; AVX512VL-LABEL: icmp0_v2i64_v2i1:
1036 ; AVX512VL: # %bb.0:
1037 ; AVX512VL-NEXT: vptestnmq %xmm0, %xmm0, %k0
1038 ; AVX512VL-NEXT: kmovd %k0, %eax
1039 ; AVX512VL-NEXT: testb %al, %al
1040 ; AVX512VL-NEXT: setnp %al
1041 ; AVX512VL-NEXT: retq
1042 %a = icmp eq <2 x i64> %0, zeroinitializer
1043 %b = call i1 @llvm.vector.reduce.xor.v2i1(<2 x i1> %a)
1047 define i1 @icmp0_v4i32_v4i1(<4 x i32>) nounwind {
1048 ; SSE-LABEL: icmp0_v4i32_v4i1:
1050 ; SSE-NEXT: pxor %xmm1, %xmm1
1051 ; SSE-NEXT: pcmpeqd %xmm0, %xmm1
1052 ; SSE-NEXT: movmskps %xmm1, %eax
1053 ; SSE-NEXT: testb %al, %al
1054 ; SSE-NEXT: setnp %al
1055 ; SSE-NEXT: ret{{[l|q]}}
1057 ; AVX-LABEL: icmp0_v4i32_v4i1:
1059 ; AVX-NEXT: vpxor %xmm1, %xmm1, %xmm1
1060 ; AVX-NEXT: vpcmpeqd %xmm1, %xmm0, %xmm0
1061 ; AVX-NEXT: vmovmskps %xmm0, %eax
1062 ; AVX-NEXT: testb %al, %al
1063 ; AVX-NEXT: setnp %al
1066 ; AVX512F-LABEL: icmp0_v4i32_v4i1:
1068 ; AVX512F-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
1069 ; AVX512F-NEXT: vptestnmd %zmm0, %zmm0, %k0
1070 ; AVX512F-NEXT: kmovw %k0, %eax
1071 ; AVX512F-NEXT: testb $15, %al
1072 ; AVX512F-NEXT: setnp %al
1073 ; AVX512F-NEXT: vzeroupper
1074 ; AVX512F-NEXT: retq
1076 ; AVX512BW-LABEL: icmp0_v4i32_v4i1:
1077 ; AVX512BW: # %bb.0:
1078 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
1079 ; AVX512BW-NEXT: vptestnmd %zmm0, %zmm0, %k0
1080 ; AVX512BW-NEXT: kmovd %k0, %eax
1081 ; AVX512BW-NEXT: testb $15, %al
1082 ; AVX512BW-NEXT: setnp %al
1083 ; AVX512BW-NEXT: vzeroupper
1084 ; AVX512BW-NEXT: retq
1086 ; AVX512VL-LABEL: icmp0_v4i32_v4i1:
1087 ; AVX512VL: # %bb.0:
1088 ; AVX512VL-NEXT: vptestnmd %xmm0, %xmm0, %k0
1089 ; AVX512VL-NEXT: kmovd %k0, %eax
1090 ; AVX512VL-NEXT: testb %al, %al
1091 ; AVX512VL-NEXT: setnp %al
1092 ; AVX512VL-NEXT: retq
1093 %a = icmp eq <4 x i32> %0, zeroinitializer
1094 %b = call i1 @llvm.vector.reduce.xor.v4i1(<4 x i1> %a)
1098 define i1 @icmp0_v8i16_v8i1(<8 x i16>) nounwind {
1099 ; SSE-LABEL: icmp0_v8i16_v8i1:
1101 ; SSE-NEXT: pxor %xmm1, %xmm1
1102 ; SSE-NEXT: pcmpeqw %xmm0, %xmm1
1103 ; SSE-NEXT: packsswb %xmm1, %xmm1
1104 ; SSE-NEXT: pmovmskb %xmm1, %eax
1105 ; SSE-NEXT: testb %al, %al
1106 ; SSE-NEXT: setnp %al
1107 ; SSE-NEXT: ret{{[l|q]}}
1109 ; AVX-LABEL: icmp0_v8i16_v8i1:
1111 ; AVX-NEXT: vpxor %xmm1, %xmm1, %xmm1
1112 ; AVX-NEXT: vpcmpeqw %xmm1, %xmm0, %xmm0
1113 ; AVX-NEXT: vpacksswb %xmm0, %xmm0, %xmm0
1114 ; AVX-NEXT: vpmovmskb %xmm0, %eax
1115 ; AVX-NEXT: testb %al, %al
1116 ; AVX-NEXT: setnp %al
1119 ; AVX512F-LABEL: icmp0_v8i16_v8i1:
1121 ; AVX512F-NEXT: vpxor %xmm1, %xmm1, %xmm1
1122 ; AVX512F-NEXT: vpcmpeqw %xmm1, %xmm0, %xmm0
1123 ; AVX512F-NEXT: vpmovsxwq %xmm0, %zmm0
1124 ; AVX512F-NEXT: vptestmq %zmm0, %zmm0, %k0
1125 ; AVX512F-NEXT: kmovw %k0, %eax
1126 ; AVX512F-NEXT: testb %al, %al
1127 ; AVX512F-NEXT: setnp %al
1128 ; AVX512F-NEXT: vzeroupper
1129 ; AVX512F-NEXT: retq
1131 ; AVX512BW-LABEL: icmp0_v8i16_v8i1:
1132 ; AVX512BW: # %bb.0:
1133 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
1134 ; AVX512BW-NEXT: vptestnmw %zmm0, %zmm0, %k0
1135 ; AVX512BW-NEXT: kmovd %k0, %eax
1136 ; AVX512BW-NEXT: testb %al, %al
1137 ; AVX512BW-NEXT: setnp %al
1138 ; AVX512BW-NEXT: vzeroupper
1139 ; AVX512BW-NEXT: retq
1141 ; AVX512VL-LABEL: icmp0_v8i16_v8i1:
1142 ; AVX512VL: # %bb.0:
1143 ; AVX512VL-NEXT: vptestnmw %xmm0, %xmm0, %k0
1144 ; AVX512VL-NEXT: kmovd %k0, %eax
1145 ; AVX512VL-NEXT: testb %al, %al
1146 ; AVX512VL-NEXT: setnp %al
1147 ; AVX512VL-NEXT: retq
1148 %a = icmp eq <8 x i16> %0, zeroinitializer
1149 %b = call i1 @llvm.vector.reduce.xor.v8i1(<8 x i1> %a)
1153 define i1 @icmp0_v16i8_v16i1(<16 x i8>) nounwind {
1154 ; SSE-LABEL: icmp0_v16i8_v16i1:
1156 ; SSE-NEXT: pxor %xmm1, %xmm1
1157 ; SSE-NEXT: pcmpeqb %xmm0, %xmm1
1158 ; SSE-NEXT: pmovmskb %xmm1, %eax
1159 ; SSE-NEXT: xorb %ah, %al
1160 ; SSE-NEXT: setnp %al
1161 ; SSE-NEXT: ret{{[l|q]}}
1163 ; AVX-LABEL: icmp0_v16i8_v16i1:
1165 ; AVX-NEXT: vpxor %xmm1, %xmm1, %xmm1
1166 ; AVX-NEXT: vpcmpeqb %xmm1, %xmm0, %xmm0
1167 ; AVX-NEXT: vpmovmskb %xmm0, %eax
1168 ; AVX-NEXT: xorb %ah, %al
1169 ; AVX-NEXT: setnp %al
1172 ; AVX512F-LABEL: icmp0_v16i8_v16i1:
1174 ; AVX512F-NEXT: vpxor %xmm1, %xmm1, %xmm1
1175 ; AVX512F-NEXT: vpcmpeqb %xmm1, %xmm0, %xmm0
1176 ; AVX512F-NEXT: vpmovmskb %xmm0, %eax
1177 ; AVX512F-NEXT: xorb %ah, %al
1178 ; AVX512F-NEXT: setnp %al
1179 ; AVX512F-NEXT: retq
1181 ; AVX512BW-LABEL: icmp0_v16i8_v16i1:
1182 ; AVX512BW: # %bb.0:
1183 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
1184 ; AVX512BW-NEXT: vptestnmb %zmm0, %zmm0, %k0
1185 ; AVX512BW-NEXT: kmovd %k0, %eax
1186 ; AVX512BW-NEXT: movl %eax, %ecx
1187 ; AVX512BW-NEXT: shrl $8, %ecx
1188 ; AVX512BW-NEXT: xorb %al, %cl
1189 ; AVX512BW-NEXT: setnp %al
1190 ; AVX512BW-NEXT: vzeroupper
1191 ; AVX512BW-NEXT: retq
1193 ; AVX512VL-LABEL: icmp0_v16i8_v16i1:
1194 ; AVX512VL: # %bb.0:
1195 ; AVX512VL-NEXT: vptestnmb %xmm0, %xmm0, %k0
1196 ; AVX512VL-NEXT: kmovd %k0, %eax
1197 ; AVX512VL-NEXT: movl %eax, %ecx
1198 ; AVX512VL-NEXT: shrl $8, %ecx
1199 ; AVX512VL-NEXT: xorb %al, %cl
1200 ; AVX512VL-NEXT: setnp %al
1201 ; AVX512VL-NEXT: retq
1202 %a = icmp eq <16 x i8> %0, zeroinitializer
1203 %b = call i1 @llvm.vector.reduce.xor.v16i1(<16 x i1> %a)
1207 define i1 @icmp0_v4i64_v4i1(<4 x i64>) nounwind {
1208 ; SSE2-LABEL: icmp0_v4i64_v4i1:
1210 ; SSE2-NEXT: pxor %xmm2, %xmm2
1211 ; SSE2-NEXT: pcmpeqd %xmm2, %xmm1
1212 ; SSE2-NEXT: pcmpeqd %xmm2, %xmm0
1213 ; SSE2-NEXT: movdqa %xmm0, %xmm2
1214 ; SSE2-NEXT: shufps {{.*#+}} xmm2 = xmm2[1,3],xmm1[1,3]
1215 ; SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,2],xmm1[0,2]
1216 ; SSE2-NEXT: andps %xmm2, %xmm0
1217 ; SSE2-NEXT: movmskps %xmm0, %eax
1218 ; SSE2-NEXT: testb %al, %al
1219 ; SSE2-NEXT: setnp %al
1220 ; SSE2-NEXT: ret{{[l|q]}}
1222 ; SSE41-LABEL: icmp0_v4i64_v4i1:
1224 ; SSE41-NEXT: pxor %xmm2, %xmm2
1225 ; SSE41-NEXT: pcmpeqq %xmm2, %xmm1
1226 ; SSE41-NEXT: pcmpeqq %xmm2, %xmm0
1227 ; SSE41-NEXT: packssdw %xmm1, %xmm0
1228 ; SSE41-NEXT: movmskps %xmm0, %eax
1229 ; SSE41-NEXT: testb %al, %al
1230 ; SSE41-NEXT: setnp %al
1233 ; AVX1-LABEL: icmp0_v4i64_v4i1:
1235 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
1236 ; AVX1-NEXT: vpxor %xmm2, %xmm2, %xmm2
1237 ; AVX1-NEXT: vpcmpeqq %xmm2, %xmm1, %xmm1
1238 ; AVX1-NEXT: vpcmpeqq %xmm2, %xmm0, %xmm0
1239 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
1240 ; AVX1-NEXT: vmovmskpd %ymm0, %eax
1241 ; AVX1-NEXT: testb %al, %al
1242 ; AVX1-NEXT: setnp %al
1243 ; AVX1-NEXT: vzeroupper
1246 ; AVX2-LABEL: icmp0_v4i64_v4i1:
1248 ; AVX2-NEXT: vpxor %xmm1, %xmm1, %xmm1
1249 ; AVX2-NEXT: vpcmpeqq %ymm1, %ymm0, %ymm0
1250 ; AVX2-NEXT: vmovmskpd %ymm0, %eax
1251 ; AVX2-NEXT: testb %al, %al
1252 ; AVX2-NEXT: setnp %al
1253 ; AVX2-NEXT: vzeroupper
1256 ; AVX512F-LABEL: icmp0_v4i64_v4i1:
1258 ; AVX512F-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
1259 ; AVX512F-NEXT: vptestnmq %zmm0, %zmm0, %k0
1260 ; AVX512F-NEXT: kmovw %k0, %eax
1261 ; AVX512F-NEXT: testb $15, %al
1262 ; AVX512F-NEXT: setnp %al
1263 ; AVX512F-NEXT: vzeroupper
1264 ; AVX512F-NEXT: retq
1266 ; AVX512BW-LABEL: icmp0_v4i64_v4i1:
1267 ; AVX512BW: # %bb.0:
1268 ; AVX512BW-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
1269 ; AVX512BW-NEXT: vptestnmq %zmm0, %zmm0, %k0
1270 ; AVX512BW-NEXT: kmovd %k0, %eax
1271 ; AVX512BW-NEXT: testb $15, %al
1272 ; AVX512BW-NEXT: setnp %al
1273 ; AVX512BW-NEXT: vzeroupper
1274 ; AVX512BW-NEXT: retq
1276 ; AVX512VL-LABEL: icmp0_v4i64_v4i1:
1277 ; AVX512VL: # %bb.0:
1278 ; AVX512VL-NEXT: vptestnmq %ymm0, %ymm0, %k0
1279 ; AVX512VL-NEXT: kmovd %k0, %eax
1280 ; AVX512VL-NEXT: testb %al, %al
1281 ; AVX512VL-NEXT: setnp %al
1282 ; AVX512VL-NEXT: vzeroupper
1283 ; AVX512VL-NEXT: retq
1284 %a = icmp eq <4 x i64> %0, zeroinitializer
1285 %b = call i1 @llvm.vector.reduce.xor.v4i1(<4 x i1> %a)
1289 define i1 @icmp0_v8i32_v8i1(<8 x i32>) nounwind {
1290 ; SSE-LABEL: icmp0_v8i32_v8i1:
1292 ; SSE-NEXT: pxor %xmm2, %xmm2
1293 ; SSE-NEXT: pcmpeqd %xmm2, %xmm1
1294 ; SSE-NEXT: pcmpeqd %xmm2, %xmm0
1295 ; SSE-NEXT: packssdw %xmm1, %xmm0
1296 ; SSE-NEXT: packsswb %xmm0, %xmm0
1297 ; SSE-NEXT: pmovmskb %xmm0, %eax
1298 ; SSE-NEXT: testb %al, %al
1299 ; SSE-NEXT: setnp %al
1300 ; SSE-NEXT: ret{{[l|q]}}
1302 ; AVX1-LABEL: icmp0_v8i32_v8i1:
1304 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
1305 ; AVX1-NEXT: vpxor %xmm2, %xmm2, %xmm2
1306 ; AVX1-NEXT: vpcmpeqd %xmm2, %xmm1, %xmm1
1307 ; AVX1-NEXT: vpcmpeqd %xmm2, %xmm0, %xmm0
1308 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
1309 ; AVX1-NEXT: vmovmskps %ymm0, %eax
1310 ; AVX1-NEXT: testb %al, %al
1311 ; AVX1-NEXT: setnp %al
1312 ; AVX1-NEXT: vzeroupper
1315 ; AVX2-LABEL: icmp0_v8i32_v8i1:
1317 ; AVX2-NEXT: vpxor %xmm1, %xmm1, %xmm1
1318 ; AVX2-NEXT: vpcmpeqd %ymm1, %ymm0, %ymm0
1319 ; AVX2-NEXT: vmovmskps %ymm0, %eax
1320 ; AVX2-NEXT: testb %al, %al
1321 ; AVX2-NEXT: setnp %al
1322 ; AVX2-NEXT: vzeroupper
1325 ; AVX512F-LABEL: icmp0_v8i32_v8i1:
1327 ; AVX512F-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
1328 ; AVX512F-NEXT: vptestnmd %zmm0, %zmm0, %k0
1329 ; AVX512F-NEXT: kmovw %k0, %eax
1330 ; AVX512F-NEXT: testb %al, %al
1331 ; AVX512F-NEXT: setnp %al
1332 ; AVX512F-NEXT: vzeroupper
1333 ; AVX512F-NEXT: retq
1335 ; AVX512BW-LABEL: icmp0_v8i32_v8i1:
1336 ; AVX512BW: # %bb.0:
1337 ; AVX512BW-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
1338 ; AVX512BW-NEXT: vptestnmd %zmm0, %zmm0, %k0
1339 ; AVX512BW-NEXT: kmovd %k0, %eax
1340 ; AVX512BW-NEXT: testb %al, %al
1341 ; AVX512BW-NEXT: setnp %al
1342 ; AVX512BW-NEXT: vzeroupper
1343 ; AVX512BW-NEXT: retq
1345 ; AVX512VL-LABEL: icmp0_v8i32_v8i1:
1346 ; AVX512VL: # %bb.0:
1347 ; AVX512VL-NEXT: vptestnmd %ymm0, %ymm0, %k0
1348 ; AVX512VL-NEXT: kmovd %k0, %eax
1349 ; AVX512VL-NEXT: testb %al, %al
1350 ; AVX512VL-NEXT: setnp %al
1351 ; AVX512VL-NEXT: vzeroupper
1352 ; AVX512VL-NEXT: retq
1353 %a = icmp eq <8 x i32> %0, zeroinitializer
1354 %b = call i1 @llvm.vector.reduce.xor.v8i1(<8 x i1> %a)
1358 define i1 @icmp0_v16i16_v16i1(<16 x i16>) nounwind {
1359 ; SSE-LABEL: icmp0_v16i16_v16i1:
1361 ; SSE-NEXT: pxor %xmm2, %xmm2
1362 ; SSE-NEXT: pcmpeqw %xmm2, %xmm1
1363 ; SSE-NEXT: pcmpeqw %xmm2, %xmm0
1364 ; SSE-NEXT: packsswb %xmm1, %xmm0
1365 ; SSE-NEXT: pmovmskb %xmm0, %eax
1366 ; SSE-NEXT: xorb %ah, %al
1367 ; SSE-NEXT: setnp %al
1368 ; SSE-NEXT: ret{{[l|q]}}
1370 ; AVX1-LABEL: icmp0_v16i16_v16i1:
1372 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
1373 ; AVX1-NEXT: vpxor %xmm2, %xmm2, %xmm2
1374 ; AVX1-NEXT: vpcmpeqw %xmm2, %xmm1, %xmm1
1375 ; AVX1-NEXT: vpcmpeqw %xmm2, %xmm0, %xmm0
1376 ; AVX1-NEXT: vpacksswb %xmm1, %xmm0, %xmm0
1377 ; AVX1-NEXT: vpmovmskb %xmm0, %eax
1378 ; AVX1-NEXT: xorb %ah, %al
1379 ; AVX1-NEXT: setnp %al
1380 ; AVX1-NEXT: vzeroupper
1383 ; AVX2-LABEL: icmp0_v16i16_v16i1:
1385 ; AVX2-NEXT: vpxor %xmm1, %xmm1, %xmm1
1386 ; AVX2-NEXT: vpcmpeqw %ymm1, %ymm0, %ymm0
1387 ; AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
1388 ; AVX2-NEXT: vpacksswb %xmm1, %xmm0, %xmm0
1389 ; AVX2-NEXT: vpmovmskb %xmm0, %eax
1390 ; AVX2-NEXT: xorb %ah, %al
1391 ; AVX2-NEXT: setnp %al
1392 ; AVX2-NEXT: vzeroupper
1395 ; AVX512F-LABEL: icmp0_v16i16_v16i1:
1397 ; AVX512F-NEXT: vpxor %xmm1, %xmm1, %xmm1
1398 ; AVX512F-NEXT: vpcmpeqw %ymm1, %ymm0, %ymm0
1399 ; AVX512F-NEXT: vpmovsxwd %ymm0, %zmm0
1400 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
1401 ; AVX512F-NEXT: kmovw %k0, %eax
1402 ; AVX512F-NEXT: movl %eax, %ecx
1403 ; AVX512F-NEXT: shrl $8, %ecx
1404 ; AVX512F-NEXT: xorb %al, %cl
1405 ; AVX512F-NEXT: setnp %al
1406 ; AVX512F-NEXT: vzeroupper
1407 ; AVX512F-NEXT: retq
1409 ; AVX512BW-LABEL: icmp0_v16i16_v16i1:
1410 ; AVX512BW: # %bb.0:
1411 ; AVX512BW-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
1412 ; AVX512BW-NEXT: vptestnmw %zmm0, %zmm0, %k0
1413 ; AVX512BW-NEXT: kmovd %k0, %eax
1414 ; AVX512BW-NEXT: movl %eax, %ecx
1415 ; AVX512BW-NEXT: shrl $8, %ecx
1416 ; AVX512BW-NEXT: xorb %al, %cl
1417 ; AVX512BW-NEXT: setnp %al
1418 ; AVX512BW-NEXT: vzeroupper
1419 ; AVX512BW-NEXT: retq
1421 ; AVX512VL-LABEL: icmp0_v16i16_v16i1:
1422 ; AVX512VL: # %bb.0:
1423 ; AVX512VL-NEXT: vptestnmw %ymm0, %ymm0, %k0
1424 ; AVX512VL-NEXT: kmovd %k0, %eax
1425 ; AVX512VL-NEXT: movl %eax, %ecx
1426 ; AVX512VL-NEXT: shrl $8, %ecx
1427 ; AVX512VL-NEXT: xorb %al, %cl
1428 ; AVX512VL-NEXT: setnp %al
1429 ; AVX512VL-NEXT: vzeroupper
1430 ; AVX512VL-NEXT: retq
1431 %a = icmp eq <16 x i16> %0, zeroinitializer
1432 %b = call i1 @llvm.vector.reduce.xor.v16i1(<16 x i1> %a)
1436 define i1 @icmp0_v32i8_v32i1(<32 x i8>) nounwind {
1437 ; SSE-LABEL: icmp0_v32i8_v32i1:
1439 ; SSE-NEXT: pxor %xmm2, %xmm2
1440 ; SSE-NEXT: pcmpeqb %xmm2, %xmm1
1441 ; SSE-NEXT: pcmpeqb %xmm2, %xmm0
1442 ; SSE-NEXT: pxor %xmm1, %xmm0
1443 ; SSE-NEXT: pmovmskb %xmm0, %eax
1444 ; SSE-NEXT: xorb %ah, %al
1445 ; SSE-NEXT: setnp %al
1446 ; SSE-NEXT: ret{{[l|q]}}
1448 ; AVX1-LABEL: icmp0_v32i8_v32i1:
1450 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
1451 ; AVX1-NEXT: vpxor %xmm2, %xmm2, %xmm2
1452 ; AVX1-NEXT: vpcmpeqb %xmm2, %xmm1, %xmm1
1453 ; AVX1-NEXT: vpcmpeqb %xmm2, %xmm0, %xmm0
1454 ; AVX1-NEXT: vpxor %xmm1, %xmm0, %xmm0
1455 ; AVX1-NEXT: vpmovmskb %xmm0, %eax
1456 ; AVX1-NEXT: xorb %ah, %al
1457 ; AVX1-NEXT: setnp %al
1458 ; AVX1-NEXT: vzeroupper
1461 ; AVX2-LABEL: icmp0_v32i8_v32i1:
1463 ; AVX2-NEXT: vpxor %xmm1, %xmm1, %xmm1
1464 ; AVX2-NEXT: vpcmpeqb %ymm1, %ymm0, %ymm0
1465 ; AVX2-NEXT: vpmovmskb %ymm0, %eax
1466 ; AVX2-NEXT: movl %eax, %ecx
1467 ; AVX2-NEXT: shrl $16, %ecx
1468 ; AVX2-NEXT: xorl %eax, %ecx
1469 ; AVX2-NEXT: xorb %ch, %cl
1470 ; AVX2-NEXT: setnp %al
1471 ; AVX2-NEXT: vzeroupper
1474 ; AVX512F-LABEL: icmp0_v32i8_v32i1:
1476 ; AVX512F-NEXT: vpxor %xmm1, %xmm1, %xmm1
1477 ; AVX512F-NEXT: vpcmpeqb %ymm1, %ymm0, %ymm0
1478 ; AVX512F-NEXT: vextracti128 $1, %ymm0, %xmm1
1479 ; AVX512F-NEXT: vpxor %xmm1, %xmm0, %xmm0
1480 ; AVX512F-NEXT: vpmovsxbd %xmm0, %zmm0
1481 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
1482 ; AVX512F-NEXT: kshiftrw $8, %k0, %k1
1483 ; AVX512F-NEXT: kxorw %k1, %k0, %k0
1484 ; AVX512F-NEXT: kshiftrw $4, %k0, %k1
1485 ; AVX512F-NEXT: kxorw %k1, %k0, %k0
1486 ; AVX512F-NEXT: kshiftrw $2, %k0, %k1
1487 ; AVX512F-NEXT: kxorw %k1, %k0, %k0
1488 ; AVX512F-NEXT: kshiftrw $1, %k0, %k1
1489 ; AVX512F-NEXT: kxorw %k1, %k0, %k0
1490 ; AVX512F-NEXT: kmovw %k0, %eax
1491 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
1492 ; AVX512F-NEXT: vzeroupper
1493 ; AVX512F-NEXT: retq
1495 ; AVX512BW-LABEL: icmp0_v32i8_v32i1:
1496 ; AVX512BW: # %bb.0:
1497 ; AVX512BW-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
1498 ; AVX512BW-NEXT: vptestnmb %zmm0, %zmm0, %k0
1499 ; AVX512BW-NEXT: kmovd %k0, %eax
1500 ; AVX512BW-NEXT: movl %eax, %ecx
1501 ; AVX512BW-NEXT: shrl $16, %ecx
1502 ; AVX512BW-NEXT: xorl %eax, %ecx
1503 ; AVX512BW-NEXT: xorb %ch, %cl
1504 ; AVX512BW-NEXT: setnp %al
1505 ; AVX512BW-NEXT: vzeroupper
1506 ; AVX512BW-NEXT: retq
1508 ; AVX512VL-LABEL: icmp0_v32i8_v32i1:
1509 ; AVX512VL: # %bb.0:
1510 ; AVX512VL-NEXT: vptestnmb %ymm0, %ymm0, %k0
1511 ; AVX512VL-NEXT: kmovd %k0, %eax
1512 ; AVX512VL-NEXT: movl %eax, %ecx
1513 ; AVX512VL-NEXT: shrl $16, %ecx
1514 ; AVX512VL-NEXT: xorl %eax, %ecx
1515 ; AVX512VL-NEXT: xorb %ch, %cl
1516 ; AVX512VL-NEXT: setnp %al
1517 ; AVX512VL-NEXT: vzeroupper
1518 ; AVX512VL-NEXT: retq
1519 %a = icmp eq <32 x i8> %0, zeroinitializer
1520 %b = call i1 @llvm.vector.reduce.xor.v32i1(<32 x i1> %a)
1524 define i1 @icmp0_v8i64_v8i1(<8 x i64>) nounwind {
1525 ; X86-SSE2-LABEL: icmp0_v8i64_v8i1:
1526 ; X86-SSE2: # %bb.0:
1527 ; X86-SSE2-NEXT: pushl %ebp
1528 ; X86-SSE2-NEXT: movl %esp, %ebp
1529 ; X86-SSE2-NEXT: andl $-16, %esp
1530 ; X86-SSE2-NEXT: subl $16, %esp
1531 ; X86-SSE2-NEXT: pxor %xmm3, %xmm3
1532 ; X86-SSE2-NEXT: pcmpeqd %xmm3, %xmm1
1533 ; X86-SSE2-NEXT: pshufd {{.*#+}} xmm4 = xmm1[1,0,3,2]
1534 ; X86-SSE2-NEXT: pand %xmm1, %xmm4
1535 ; X86-SSE2-NEXT: pcmpeqd %xmm3, %xmm0
1536 ; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,0,3,2]
1537 ; X86-SSE2-NEXT: pand %xmm0, %xmm1
1538 ; X86-SSE2-NEXT: packssdw %xmm4, %xmm1
1539 ; X86-SSE2-NEXT: pcmpeqd %xmm3, %xmm2
1540 ; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[1,0,3,2]
1541 ; X86-SSE2-NEXT: pand %xmm2, %xmm0
1542 ; X86-SSE2-NEXT: pcmpeqd 8(%ebp), %xmm3
1543 ; X86-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm3[1,0,3,2]
1544 ; X86-SSE2-NEXT: pand %xmm3, %xmm2
1545 ; X86-SSE2-NEXT: packssdw %xmm2, %xmm0
1546 ; X86-SSE2-NEXT: packssdw %xmm0, %xmm1
1547 ; X86-SSE2-NEXT: packsswb %xmm1, %xmm1
1548 ; X86-SSE2-NEXT: pmovmskb %xmm1, %eax
1549 ; X86-SSE2-NEXT: testb %al, %al
1550 ; X86-SSE2-NEXT: setnp %al
1551 ; X86-SSE2-NEXT: movl %ebp, %esp
1552 ; X86-SSE2-NEXT: popl %ebp
1553 ; X86-SSE2-NEXT: retl
1555 ; X64-SSE2-LABEL: icmp0_v8i64_v8i1:
1556 ; X64-SSE2: # %bb.0:
1557 ; X64-SSE2-NEXT: pxor %xmm4, %xmm4
1558 ; X64-SSE2-NEXT: pcmpeqd %xmm4, %xmm3
1559 ; X64-SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm3[1,0,3,2]
1560 ; X64-SSE2-NEXT: pand %xmm3, %xmm5
1561 ; X64-SSE2-NEXT: pcmpeqd %xmm4, %xmm2
1562 ; X64-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm2[1,0,3,2]
1563 ; X64-SSE2-NEXT: pand %xmm2, %xmm3
1564 ; X64-SSE2-NEXT: packssdw %xmm5, %xmm3
1565 ; X64-SSE2-NEXT: pcmpeqd %xmm4, %xmm1
1566 ; X64-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm1[1,0,3,2]
1567 ; X64-SSE2-NEXT: pand %xmm1, %xmm2
1568 ; X64-SSE2-NEXT: pcmpeqd %xmm4, %xmm0
1569 ; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,0,3,2]
1570 ; X64-SSE2-NEXT: pand %xmm0, %xmm1
1571 ; X64-SSE2-NEXT: packssdw %xmm2, %xmm1
1572 ; X64-SSE2-NEXT: packssdw %xmm3, %xmm1
1573 ; X64-SSE2-NEXT: packsswb %xmm1, %xmm1
1574 ; X64-SSE2-NEXT: pmovmskb %xmm1, %eax
1575 ; X64-SSE2-NEXT: testb %al, %al
1576 ; X64-SSE2-NEXT: setnp %al
1577 ; X64-SSE2-NEXT: retq
1579 ; SSE41-LABEL: icmp0_v8i64_v8i1:
1581 ; SSE41-NEXT: pxor %xmm4, %xmm4
1582 ; SSE41-NEXT: pcmpeqq %xmm4, %xmm3
1583 ; SSE41-NEXT: pcmpeqq %xmm4, %xmm2
1584 ; SSE41-NEXT: packssdw %xmm3, %xmm2
1585 ; SSE41-NEXT: pcmpeqq %xmm4, %xmm1
1586 ; SSE41-NEXT: pcmpeqq %xmm4, %xmm0
1587 ; SSE41-NEXT: packssdw %xmm1, %xmm0
1588 ; SSE41-NEXT: packssdw %xmm2, %xmm0
1589 ; SSE41-NEXT: packsswb %xmm0, %xmm0
1590 ; SSE41-NEXT: pmovmskb %xmm0, %eax
1591 ; SSE41-NEXT: testb %al, %al
1592 ; SSE41-NEXT: setnp %al
1595 ; AVX1-LABEL: icmp0_v8i64_v8i1:
1597 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
1598 ; AVX1-NEXT: vpxor %xmm3, %xmm3, %xmm3
1599 ; AVX1-NEXT: vpcmpeqq %xmm3, %xmm2, %xmm2
1600 ; AVX1-NEXT: vpcmpeqq %xmm3, %xmm1, %xmm1
1601 ; AVX1-NEXT: vpackssdw %xmm2, %xmm1, %xmm1
1602 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm2
1603 ; AVX1-NEXT: vpcmpeqq %xmm3, %xmm2, %xmm2
1604 ; AVX1-NEXT: vpcmpeqq %xmm3, %xmm0, %xmm0
1605 ; AVX1-NEXT: vpackssdw %xmm2, %xmm0, %xmm0
1606 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
1607 ; AVX1-NEXT: vmovmskps %ymm0, %eax
1608 ; AVX1-NEXT: testb %al, %al
1609 ; AVX1-NEXT: setnp %al
1610 ; AVX1-NEXT: vzeroupper
1613 ; AVX2-LABEL: icmp0_v8i64_v8i1:
1615 ; AVX2-NEXT: vpxor %xmm2, %xmm2, %xmm2
1616 ; AVX2-NEXT: vpcmpeqq %ymm2, %ymm1, %ymm1
1617 ; AVX2-NEXT: vpcmpeqq %ymm2, %ymm0, %ymm0
1618 ; AVX2-NEXT: vpackssdw %ymm1, %ymm0, %ymm0
1619 ; AVX2-NEXT: vpermq {{.*#+}} ymm0 = ymm0[0,2,1,3]
1620 ; AVX2-NEXT: vmovmskps %ymm0, %eax
1621 ; AVX2-NEXT: testb %al, %al
1622 ; AVX2-NEXT: setnp %al
1623 ; AVX2-NEXT: vzeroupper
1626 ; AVX512F-LABEL: icmp0_v8i64_v8i1:
1628 ; AVX512F-NEXT: vptestnmq %zmm0, %zmm0, %k0
1629 ; AVX512F-NEXT: kmovw %k0, %eax
1630 ; AVX512F-NEXT: testb %al, %al
1631 ; AVX512F-NEXT: setnp %al
1632 ; AVX512F-NEXT: vzeroupper
1633 ; AVX512F-NEXT: retq
1635 ; AVX512BW-LABEL: icmp0_v8i64_v8i1:
1636 ; AVX512BW: # %bb.0:
1637 ; AVX512BW-NEXT: vptestnmq %zmm0, %zmm0, %k0
1638 ; AVX512BW-NEXT: kmovd %k0, %eax
1639 ; AVX512BW-NEXT: testb %al, %al
1640 ; AVX512BW-NEXT: setnp %al
1641 ; AVX512BW-NEXT: vzeroupper
1642 ; AVX512BW-NEXT: retq
1644 ; AVX512VL-LABEL: icmp0_v8i64_v8i1:
1645 ; AVX512VL: # %bb.0:
1646 ; AVX512VL-NEXT: vptestnmq %zmm0, %zmm0, %k0
1647 ; AVX512VL-NEXT: kmovd %k0, %eax
1648 ; AVX512VL-NEXT: testb %al, %al
1649 ; AVX512VL-NEXT: setnp %al
1650 ; AVX512VL-NEXT: vzeroupper
1651 ; AVX512VL-NEXT: retq
1652 %a = icmp eq <8 x i64> %0, zeroinitializer
1653 %b = call i1 @llvm.vector.reduce.xor.v8i1(<8 x i1> %a)
1657 define i1 @icmp0_v16i32_v16i1(<16 x i32>) nounwind {
1658 ; X86-SSE2-LABEL: icmp0_v16i32_v16i1:
1659 ; X86-SSE2: # %bb.0:
1660 ; X86-SSE2-NEXT: pushl %ebp
1661 ; X86-SSE2-NEXT: movl %esp, %ebp
1662 ; X86-SSE2-NEXT: andl $-16, %esp
1663 ; X86-SSE2-NEXT: subl $16, %esp
1664 ; X86-SSE2-NEXT: pxor %xmm3, %xmm3
1665 ; X86-SSE2-NEXT: pcmpeqd %xmm3, %xmm1
1666 ; X86-SSE2-NEXT: pcmpeqd %xmm3, %xmm0
1667 ; X86-SSE2-NEXT: packssdw %xmm1, %xmm0
1668 ; X86-SSE2-NEXT: pcmpeqd %xmm3, %xmm2
1669 ; X86-SSE2-NEXT: pcmpeqd 8(%ebp), %xmm3
1670 ; X86-SSE2-NEXT: packssdw %xmm3, %xmm2
1671 ; X86-SSE2-NEXT: packsswb %xmm2, %xmm0
1672 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
1673 ; X86-SSE2-NEXT: xorb %ah, %al
1674 ; X86-SSE2-NEXT: setnp %al
1675 ; X86-SSE2-NEXT: movl %ebp, %esp
1676 ; X86-SSE2-NEXT: popl %ebp
1677 ; X86-SSE2-NEXT: retl
1679 ; X64-SSE-LABEL: icmp0_v16i32_v16i1:
1681 ; X64-SSE-NEXT: pxor %xmm4, %xmm4
1682 ; X64-SSE-NEXT: pcmpeqd %xmm4, %xmm3
1683 ; X64-SSE-NEXT: pcmpeqd %xmm4, %xmm2
1684 ; X64-SSE-NEXT: packssdw %xmm3, %xmm2
1685 ; X64-SSE-NEXT: pcmpeqd %xmm4, %xmm1
1686 ; X64-SSE-NEXT: pcmpeqd %xmm4, %xmm0
1687 ; X64-SSE-NEXT: packssdw %xmm1, %xmm0
1688 ; X64-SSE-NEXT: packsswb %xmm2, %xmm0
1689 ; X64-SSE-NEXT: pmovmskb %xmm0, %eax
1690 ; X64-SSE-NEXT: xorb %ah, %al
1691 ; X64-SSE-NEXT: setnp %al
1692 ; X64-SSE-NEXT: retq
1694 ; AVX1-LABEL: icmp0_v16i32_v16i1:
1696 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
1697 ; AVX1-NEXT: vpxor %xmm3, %xmm3, %xmm3
1698 ; AVX1-NEXT: vpcmpeqd %xmm3, %xmm2, %xmm2
1699 ; AVX1-NEXT: vpcmpeqd %xmm3, %xmm1, %xmm1
1700 ; AVX1-NEXT: vpackssdw %xmm2, %xmm1, %xmm1
1701 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm2
1702 ; AVX1-NEXT: vpcmpeqd %xmm3, %xmm2, %xmm2
1703 ; AVX1-NEXT: vpcmpeqd %xmm3, %xmm0, %xmm0
1704 ; AVX1-NEXT: vpackssdw %xmm2, %xmm0, %xmm0
1705 ; AVX1-NEXT: vpacksswb %xmm1, %xmm0, %xmm0
1706 ; AVX1-NEXT: vpmovmskb %xmm0, %eax
1707 ; AVX1-NEXT: xorb %ah, %al
1708 ; AVX1-NEXT: setnp %al
1709 ; AVX1-NEXT: vzeroupper
1712 ; AVX2-LABEL: icmp0_v16i32_v16i1:
1714 ; AVX2-NEXT: vpxor %xmm2, %xmm2, %xmm2
1715 ; AVX2-NEXT: vpcmpeqd %ymm2, %ymm1, %ymm1
1716 ; AVX2-NEXT: vpcmpeqd %ymm2, %ymm0, %ymm0
1717 ; AVX2-NEXT: vpackssdw %ymm1, %ymm0, %ymm0
1718 ; AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
1719 ; AVX2-NEXT: vpacksswb %xmm1, %xmm0, %xmm0
1720 ; AVX2-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[0,2,1,3]
1721 ; AVX2-NEXT: vpmovmskb %xmm0, %eax
1722 ; AVX2-NEXT: xorb %ah, %al
1723 ; AVX2-NEXT: setnp %al
1724 ; AVX2-NEXT: vzeroupper
1727 ; AVX512F-LABEL: icmp0_v16i32_v16i1:
1729 ; AVX512F-NEXT: vptestnmd %zmm0, %zmm0, %k0
1730 ; AVX512F-NEXT: kmovw %k0, %eax
1731 ; AVX512F-NEXT: movl %eax, %ecx
1732 ; AVX512F-NEXT: shrl $8, %ecx
1733 ; AVX512F-NEXT: xorb %al, %cl
1734 ; AVX512F-NEXT: setnp %al
1735 ; AVX512F-NEXT: vzeroupper
1736 ; AVX512F-NEXT: retq
1738 ; AVX512BW-LABEL: icmp0_v16i32_v16i1:
1739 ; AVX512BW: # %bb.0:
1740 ; AVX512BW-NEXT: vptestnmd %zmm0, %zmm0, %k0
1741 ; AVX512BW-NEXT: kmovd %k0, %eax
1742 ; AVX512BW-NEXT: movl %eax, %ecx
1743 ; AVX512BW-NEXT: shrl $8, %ecx
1744 ; AVX512BW-NEXT: xorb %al, %cl
1745 ; AVX512BW-NEXT: setnp %al
1746 ; AVX512BW-NEXT: vzeroupper
1747 ; AVX512BW-NEXT: retq
1749 ; AVX512VL-LABEL: icmp0_v16i32_v16i1:
1750 ; AVX512VL: # %bb.0:
1751 ; AVX512VL-NEXT: vptestnmd %zmm0, %zmm0, %k0
1752 ; AVX512VL-NEXT: kmovd %k0, %eax
1753 ; AVX512VL-NEXT: movl %eax, %ecx
1754 ; AVX512VL-NEXT: shrl $8, %ecx
1755 ; AVX512VL-NEXT: xorb %al, %cl
1756 ; AVX512VL-NEXT: setnp %al
1757 ; AVX512VL-NEXT: vzeroupper
1758 ; AVX512VL-NEXT: retq
1759 %a = icmp eq <16 x i32> %0, zeroinitializer
1760 %b = call i1 @llvm.vector.reduce.xor.v16i1(<16 x i1> %a)
1764 define i1 @icmp0_v32i16_v32i1(<32 x i16>) nounwind {
1765 ; X86-SSE2-LABEL: icmp0_v32i16_v32i1:
1766 ; X86-SSE2: # %bb.0:
1767 ; X86-SSE2-NEXT: pushl %ebp
1768 ; X86-SSE2-NEXT: movl %esp, %ebp
1769 ; X86-SSE2-NEXT: andl $-16, %esp
1770 ; X86-SSE2-NEXT: subl $16, %esp
1771 ; X86-SSE2-NEXT: pxor %xmm3, %xmm3
1772 ; X86-SSE2-NEXT: pcmpeqw %xmm3, %xmm1
1773 ; X86-SSE2-NEXT: pcmpeqw %xmm3, %xmm2
1774 ; X86-SSE2-NEXT: pcmpeqw %xmm3, %xmm0
1775 ; X86-SSE2-NEXT: pxor %xmm2, %xmm0
1776 ; X86-SSE2-NEXT: pcmpeqw 8(%ebp), %xmm3
1777 ; X86-SSE2-NEXT: pxor %xmm1, %xmm3
1778 ; X86-SSE2-NEXT: packsswb %xmm3, %xmm0
1779 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
1780 ; X86-SSE2-NEXT: xorb %ah, %al
1781 ; X86-SSE2-NEXT: setnp %al
1782 ; X86-SSE2-NEXT: movl %ebp, %esp
1783 ; X86-SSE2-NEXT: popl %ebp
1784 ; X86-SSE2-NEXT: retl
1786 ; X64-SSE-LABEL: icmp0_v32i16_v32i1:
1788 ; X64-SSE-NEXT: pxor %xmm4, %xmm4
1789 ; X64-SSE-NEXT: pcmpeqw %xmm4, %xmm2
1790 ; X64-SSE-NEXT: pcmpeqw %xmm4, %xmm0
1791 ; X64-SSE-NEXT: pxor %xmm2, %xmm0
1792 ; X64-SSE-NEXT: pcmpeqw %xmm4, %xmm3
1793 ; X64-SSE-NEXT: pcmpeqw %xmm4, %xmm1
1794 ; X64-SSE-NEXT: pxor %xmm3, %xmm1
1795 ; X64-SSE-NEXT: packsswb %xmm1, %xmm0
1796 ; X64-SSE-NEXT: pmovmskb %xmm0, %eax
1797 ; X64-SSE-NEXT: xorb %ah, %al
1798 ; X64-SSE-NEXT: setnp %al
1799 ; X64-SSE-NEXT: retq
1801 ; AVX1-LABEL: icmp0_v32i16_v32i1:
1803 ; AVX1-NEXT: vpxor %xmm2, %xmm2, %xmm2
1804 ; AVX1-NEXT: vpcmpeqw %xmm2, %xmm1, %xmm3
1805 ; AVX1-NEXT: vpcmpeqw %xmm2, %xmm0, %xmm4
1806 ; AVX1-NEXT: vpxor %xmm3, %xmm4, %xmm3
1807 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm1
1808 ; AVX1-NEXT: vpcmpeqw %xmm2, %xmm1, %xmm1
1809 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm0
1810 ; AVX1-NEXT: vpcmpeqw %xmm2, %xmm0, %xmm0
1811 ; AVX1-NEXT: vpxor %xmm1, %xmm0, %xmm0
1812 ; AVX1-NEXT: vpacksswb %xmm0, %xmm3, %xmm0
1813 ; AVX1-NEXT: vpmovmskb %xmm0, %eax
1814 ; AVX1-NEXT: xorb %ah, %al
1815 ; AVX1-NEXT: setnp %al
1816 ; AVX1-NEXT: vzeroupper
1819 ; AVX2-LABEL: icmp0_v32i16_v32i1:
1821 ; AVX2-NEXT: vpxor %xmm2, %xmm2, %xmm2
1822 ; AVX2-NEXT: vpcmpeqw %ymm2, %ymm1, %ymm1
1823 ; AVX2-NEXT: vpcmpeqw %ymm2, %ymm0, %ymm0
1824 ; AVX2-NEXT: vpacksswb %ymm1, %ymm0, %ymm0
1825 ; AVX2-NEXT: vpermq {{.*#+}} ymm0 = ymm0[0,2,1,3]
1826 ; AVX2-NEXT: vpmovmskb %ymm0, %eax
1827 ; AVX2-NEXT: movl %eax, %ecx
1828 ; AVX2-NEXT: shrl $16, %ecx
1829 ; AVX2-NEXT: xorl %eax, %ecx
1830 ; AVX2-NEXT: xorb %ch, %cl
1831 ; AVX2-NEXT: setnp %al
1832 ; AVX2-NEXT: vzeroupper
1835 ; AVX512F-LABEL: icmp0_v32i16_v32i1:
1837 ; AVX512F-NEXT: vextracti64x4 $1, %zmm0, %ymm1
1838 ; AVX512F-NEXT: vpxor %xmm2, %xmm2, %xmm2
1839 ; AVX512F-NEXT: vpcmpeqw %ymm2, %ymm1, %ymm1
1840 ; AVX512F-NEXT: vpcmpeqw %ymm2, %ymm0, %ymm0
1841 ; AVX512F-NEXT: vpxor %ymm1, %ymm0, %ymm0
1842 ; AVX512F-NEXT: vpmovsxwd %ymm0, %zmm0
1843 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
1844 ; AVX512F-NEXT: kshiftrw $8, %k0, %k1
1845 ; AVX512F-NEXT: kxorw %k1, %k0, %k0
1846 ; AVX512F-NEXT: kshiftrw $4, %k0, %k1
1847 ; AVX512F-NEXT: kxorw %k1, %k0, %k0
1848 ; AVX512F-NEXT: kshiftrw $2, %k0, %k1
1849 ; AVX512F-NEXT: kxorw %k1, %k0, %k0
1850 ; AVX512F-NEXT: kshiftrw $1, %k0, %k1
1851 ; AVX512F-NEXT: kxorw %k1, %k0, %k0
1852 ; AVX512F-NEXT: kmovw %k0, %eax
1853 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
1854 ; AVX512F-NEXT: vzeroupper
1855 ; AVX512F-NEXT: retq
1857 ; AVX512BW-LABEL: icmp0_v32i16_v32i1:
1858 ; AVX512BW: # %bb.0:
1859 ; AVX512BW-NEXT: vptestnmw %zmm0, %zmm0, %k0
1860 ; AVX512BW-NEXT: kmovd %k0, %eax
1861 ; AVX512BW-NEXT: movl %eax, %ecx
1862 ; AVX512BW-NEXT: shrl $16, %ecx
1863 ; AVX512BW-NEXT: xorl %eax, %ecx
1864 ; AVX512BW-NEXT: xorb %ch, %cl
1865 ; AVX512BW-NEXT: setnp %al
1866 ; AVX512BW-NEXT: vzeroupper
1867 ; AVX512BW-NEXT: retq
1869 ; AVX512VL-LABEL: icmp0_v32i16_v32i1:
1870 ; AVX512VL: # %bb.0:
1871 ; AVX512VL-NEXT: vptestnmw %zmm0, %zmm0, %k0
1872 ; AVX512VL-NEXT: kmovd %k0, %eax
1873 ; AVX512VL-NEXT: movl %eax, %ecx
1874 ; AVX512VL-NEXT: shrl $16, %ecx
1875 ; AVX512VL-NEXT: xorl %eax, %ecx
1876 ; AVX512VL-NEXT: xorb %ch, %cl
1877 ; AVX512VL-NEXT: setnp %al
1878 ; AVX512VL-NEXT: vzeroupper
1879 ; AVX512VL-NEXT: retq
1880 %a = icmp eq <32 x i16> %0, zeroinitializer
1881 %b = call i1 @llvm.vector.reduce.xor.v32i1(<32 x i1> %a)
1885 define i1 @icmp0_v64i8_v64i1(<64 x i8>) nounwind {
1886 ; X86-SSE2-LABEL: icmp0_v64i8_v64i1:
1887 ; X86-SSE2: # %bb.0:
1888 ; X86-SSE2-NEXT: pushl %ebp
1889 ; X86-SSE2-NEXT: movl %esp, %ebp
1890 ; X86-SSE2-NEXT: andl $-16, %esp
1891 ; X86-SSE2-NEXT: subl $16, %esp
1892 ; X86-SSE2-NEXT: pxor %xmm3, %xmm3
1893 ; X86-SSE2-NEXT: pcmpeqb %xmm3, %xmm1
1894 ; X86-SSE2-NEXT: pcmpeqb %xmm3, %xmm2
1895 ; X86-SSE2-NEXT: pcmpeqb %xmm3, %xmm0
1896 ; X86-SSE2-NEXT: pxor %xmm2, %xmm0
1897 ; X86-SSE2-NEXT: pcmpeqb 8(%ebp), %xmm3
1898 ; X86-SSE2-NEXT: pxor %xmm1, %xmm3
1899 ; X86-SSE2-NEXT: pxor %xmm0, %xmm3
1900 ; X86-SSE2-NEXT: pmovmskb %xmm3, %eax
1901 ; X86-SSE2-NEXT: xorb %ah, %al
1902 ; X86-SSE2-NEXT: setnp %al
1903 ; X86-SSE2-NEXT: movl %ebp, %esp
1904 ; X86-SSE2-NEXT: popl %ebp
1905 ; X86-SSE2-NEXT: retl
1907 ; X64-SSE-LABEL: icmp0_v64i8_v64i1:
1909 ; X64-SSE-NEXT: pxor %xmm4, %xmm4
1910 ; X64-SSE-NEXT: pcmpeqb %xmm4, %xmm2
1911 ; X64-SSE-NEXT: pcmpeqb %xmm4, %xmm0
1912 ; X64-SSE-NEXT: pxor %xmm2, %xmm0
1913 ; X64-SSE-NEXT: pcmpeqb %xmm4, %xmm3
1914 ; X64-SSE-NEXT: pcmpeqb %xmm4, %xmm1
1915 ; X64-SSE-NEXT: pxor %xmm3, %xmm1
1916 ; X64-SSE-NEXT: pxor %xmm0, %xmm1
1917 ; X64-SSE-NEXT: pmovmskb %xmm1, %eax
1918 ; X64-SSE-NEXT: xorb %ah, %al
1919 ; X64-SSE-NEXT: setnp %al
1920 ; X64-SSE-NEXT: retq
1922 ; AVX1-LABEL: icmp0_v64i8_v64i1:
1924 ; AVX1-NEXT: vpxor %xmm2, %xmm2, %xmm2
1925 ; AVX1-NEXT: vpcmpeqb %xmm2, %xmm1, %xmm3
1926 ; AVX1-NEXT: vpcmpeqb %xmm2, %xmm0, %xmm4
1927 ; AVX1-NEXT: vpxor %xmm3, %xmm4, %xmm3
1928 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm1
1929 ; AVX1-NEXT: vpcmpeqb %xmm2, %xmm1, %xmm1
1930 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm0
1931 ; AVX1-NEXT: vpcmpeqb %xmm2, %xmm0, %xmm0
1932 ; AVX1-NEXT: vpxor %xmm1, %xmm0, %xmm0
1933 ; AVX1-NEXT: vpxor %xmm0, %xmm3, %xmm0
1934 ; AVX1-NEXT: vpmovmskb %xmm0, %eax
1935 ; AVX1-NEXT: xorb %ah, %al
1936 ; AVX1-NEXT: setnp %al
1937 ; AVX1-NEXT: vzeroupper
1940 ; AVX2-LABEL: icmp0_v64i8_v64i1:
1942 ; AVX2-NEXT: vpxor %xmm2, %xmm2, %xmm2
1943 ; AVX2-NEXT: vpcmpeqb %ymm2, %ymm1, %ymm1
1944 ; AVX2-NEXT: vpcmpeqb %ymm2, %ymm0, %ymm0
1945 ; AVX2-NEXT: vpxor %ymm1, %ymm0, %ymm0
1946 ; AVX2-NEXT: vpmovmskb %ymm0, %eax
1947 ; AVX2-NEXT: movl %eax, %ecx
1948 ; AVX2-NEXT: shrl $16, %ecx
1949 ; AVX2-NEXT: xorl %eax, %ecx
1950 ; AVX2-NEXT: xorb %ch, %cl
1951 ; AVX2-NEXT: setnp %al
1952 ; AVX2-NEXT: vzeroupper
1955 ; AVX512F-LABEL: icmp0_v64i8_v64i1:
1957 ; AVX512F-NEXT: vextracti64x4 $1, %zmm0, %ymm1
1958 ; AVX512F-NEXT: vpxor %xmm2, %xmm2, %xmm2
1959 ; AVX512F-NEXT: vpcmpeqb %ymm2, %ymm1, %ymm1
1960 ; AVX512F-NEXT: vpcmpeqb %ymm2, %ymm0, %ymm0
1961 ; AVX512F-NEXT: vextracti128 $1, %ymm1, %xmm2
1962 ; AVX512F-NEXT: vextracti128 $1, %ymm0, %xmm3
1963 ; AVX512F-NEXT: vpxor %xmm2, %xmm3, %xmm2
1964 ; AVX512F-NEXT: vpxor %xmm1, %xmm0, %xmm0
1965 ; AVX512F-NEXT: vpxor %xmm2, %xmm0, %xmm0
1966 ; AVX512F-NEXT: vpmovsxbd %xmm0, %zmm0
1967 ; AVX512F-NEXT: vpslld $31, %zmm0, %zmm0
1968 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
1969 ; AVX512F-NEXT: kshiftrw $8, %k0, %k1
1970 ; AVX512F-NEXT: kxorw %k1, %k0, %k0
1971 ; AVX512F-NEXT: kshiftrw $4, %k0, %k1
1972 ; AVX512F-NEXT: kxorw %k1, %k0, %k0
1973 ; AVX512F-NEXT: kshiftrw $2, %k0, %k1
1974 ; AVX512F-NEXT: kxorw %k1, %k0, %k0
1975 ; AVX512F-NEXT: kshiftrw $1, %k0, %k1
1976 ; AVX512F-NEXT: kxorw %k1, %k0, %k0
1977 ; AVX512F-NEXT: kmovw %k0, %eax
1978 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
1979 ; AVX512F-NEXT: vzeroupper
1980 ; AVX512F-NEXT: retq
1982 ; AVX512BW-LABEL: icmp0_v64i8_v64i1:
1983 ; AVX512BW: # %bb.0:
1984 ; AVX512BW-NEXT: vptestnmb %zmm0, %zmm0, %k0
1985 ; AVX512BW-NEXT: kmovq %k0, %rax
1986 ; AVX512BW-NEXT: movq %rax, %rcx
1987 ; AVX512BW-NEXT: shrq $32, %rcx
1988 ; AVX512BW-NEXT: xorl %eax, %ecx
1989 ; AVX512BW-NEXT: movl %ecx, %eax
1990 ; AVX512BW-NEXT: shrl $16, %eax
1991 ; AVX512BW-NEXT: xorl %ecx, %eax
1992 ; AVX512BW-NEXT: xorb %ah, %al
1993 ; AVX512BW-NEXT: setnp %al
1994 ; AVX512BW-NEXT: vzeroupper
1995 ; AVX512BW-NEXT: retq
1997 ; AVX512VL-LABEL: icmp0_v64i8_v64i1:
1998 ; AVX512VL: # %bb.0:
1999 ; AVX512VL-NEXT: vptestnmb %zmm0, %zmm0, %k0
2000 ; AVX512VL-NEXT: kmovq %k0, %rax
2001 ; AVX512VL-NEXT: movq %rax, %rcx
2002 ; AVX512VL-NEXT: shrq $32, %rcx
2003 ; AVX512VL-NEXT: xorl %eax, %ecx
2004 ; AVX512VL-NEXT: movl %ecx, %eax
2005 ; AVX512VL-NEXT: shrl $16, %eax
2006 ; AVX512VL-NEXT: xorl %ecx, %eax
2007 ; AVX512VL-NEXT: xorb %ah, %al
2008 ; AVX512VL-NEXT: setnp %al
2009 ; AVX512VL-NEXT: vzeroupper
2010 ; AVX512VL-NEXT: retq
2011 %a = icmp eq <64 x i8> %0, zeroinitializer
2012 %b = call i1 @llvm.vector.reduce.xor.v64i1(<64 x i1> %a)
2019 define i1 @icmp_v2i64_v2i1(<2 x i64>, <2 x i64>) nounwind {
2020 ; SSE2-LABEL: icmp_v2i64_v2i1:
2022 ; SSE2-NEXT: pcmpeqd %xmm1, %xmm0
2023 ; SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,0,3,2]
2024 ; SSE2-NEXT: pand %xmm0, %xmm1
2025 ; SSE2-NEXT: movmskpd %xmm1, %eax
2026 ; SSE2-NEXT: testb %al, %al
2027 ; SSE2-NEXT: setnp %al
2028 ; SSE2-NEXT: ret{{[l|q]}}
2030 ; SSE41-LABEL: icmp_v2i64_v2i1:
2032 ; SSE41-NEXT: pcmpeqq %xmm1, %xmm0
2033 ; SSE41-NEXT: movmskpd %xmm0, %eax
2034 ; SSE41-NEXT: testb %al, %al
2035 ; SSE41-NEXT: setnp %al
2038 ; AVX-LABEL: icmp_v2i64_v2i1:
2040 ; AVX-NEXT: vpcmpeqq %xmm1, %xmm0, %xmm0
2041 ; AVX-NEXT: vmovmskpd %xmm0, %eax
2042 ; AVX-NEXT: testb %al, %al
2043 ; AVX-NEXT: setnp %al
2046 ; AVX512F-LABEL: icmp_v2i64_v2i1:
2048 ; AVX512F-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
2049 ; AVX512F-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
2050 ; AVX512F-NEXT: vpcmpeqq %zmm1, %zmm0, %k0
2051 ; AVX512F-NEXT: kmovw %k0, %eax
2052 ; AVX512F-NEXT: testb $3, %al
2053 ; AVX512F-NEXT: setnp %al
2054 ; AVX512F-NEXT: vzeroupper
2055 ; AVX512F-NEXT: retq
2057 ; AVX512BW-LABEL: icmp_v2i64_v2i1:
2058 ; AVX512BW: # %bb.0:
2059 ; AVX512BW-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
2060 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
2061 ; AVX512BW-NEXT: vpcmpeqq %zmm1, %zmm0, %k0
2062 ; AVX512BW-NEXT: kmovd %k0, %eax
2063 ; AVX512BW-NEXT: testb $3, %al
2064 ; AVX512BW-NEXT: setnp %al
2065 ; AVX512BW-NEXT: vzeroupper
2066 ; AVX512BW-NEXT: retq
2068 ; AVX512VL-LABEL: icmp_v2i64_v2i1:
2069 ; AVX512VL: # %bb.0:
2070 ; AVX512VL-NEXT: vpcmpeqq %xmm1, %xmm0, %k0
2071 ; AVX512VL-NEXT: kmovd %k0, %eax
2072 ; AVX512VL-NEXT: testb %al, %al
2073 ; AVX512VL-NEXT: setnp %al
2074 ; AVX512VL-NEXT: retq
2075 %a = icmp eq <2 x i64> %0, %1
2076 %b = call i1 @llvm.vector.reduce.xor.v2i1(<2 x i1> %a)
2080 define i1 @icmp_v4i32_v4i1(<4 x i32>, <4 x i32>) nounwind {
2081 ; SSE-LABEL: icmp_v4i32_v4i1:
2083 ; SSE-NEXT: pcmpeqd %xmm1, %xmm0
2084 ; SSE-NEXT: movmskps %xmm0, %eax
2085 ; SSE-NEXT: testb %al, %al
2086 ; SSE-NEXT: setnp %al
2087 ; SSE-NEXT: ret{{[l|q]}}
2089 ; AVX-LABEL: icmp_v4i32_v4i1:
2091 ; AVX-NEXT: vpcmpeqd %xmm1, %xmm0, %xmm0
2092 ; AVX-NEXT: vmovmskps %xmm0, %eax
2093 ; AVX-NEXT: testb %al, %al
2094 ; AVX-NEXT: setnp %al
2097 ; AVX512F-LABEL: icmp_v4i32_v4i1:
2099 ; AVX512F-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
2100 ; AVX512F-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
2101 ; AVX512F-NEXT: vpcmpeqd %zmm1, %zmm0, %k0
2102 ; AVX512F-NEXT: kmovw %k0, %eax
2103 ; AVX512F-NEXT: testb $15, %al
2104 ; AVX512F-NEXT: setnp %al
2105 ; AVX512F-NEXT: vzeroupper
2106 ; AVX512F-NEXT: retq
2108 ; AVX512BW-LABEL: icmp_v4i32_v4i1:
2109 ; AVX512BW: # %bb.0:
2110 ; AVX512BW-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
2111 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
2112 ; AVX512BW-NEXT: vpcmpeqd %zmm1, %zmm0, %k0
2113 ; AVX512BW-NEXT: kmovd %k0, %eax
2114 ; AVX512BW-NEXT: testb $15, %al
2115 ; AVX512BW-NEXT: setnp %al
2116 ; AVX512BW-NEXT: vzeroupper
2117 ; AVX512BW-NEXT: retq
2119 ; AVX512VL-LABEL: icmp_v4i32_v4i1:
2120 ; AVX512VL: # %bb.0:
2121 ; AVX512VL-NEXT: vpcmpeqd %xmm1, %xmm0, %k0
2122 ; AVX512VL-NEXT: kmovd %k0, %eax
2123 ; AVX512VL-NEXT: testb %al, %al
2124 ; AVX512VL-NEXT: setnp %al
2125 ; AVX512VL-NEXT: retq
2126 %a = icmp eq <4 x i32> %0, %1
2127 %b = call i1 @llvm.vector.reduce.xor.v4i1(<4 x i1> %a)
2131 define i1 @icmp_v8i16_v8i1(<8 x i16>, <8 x i16>) nounwind {
2132 ; SSE-LABEL: icmp_v8i16_v8i1:
2134 ; SSE-NEXT: pcmpeqw %xmm1, %xmm0
2135 ; SSE-NEXT: packsswb %xmm0, %xmm0
2136 ; SSE-NEXT: pmovmskb %xmm0, %eax
2137 ; SSE-NEXT: testb %al, %al
2138 ; SSE-NEXT: setnp %al
2139 ; SSE-NEXT: ret{{[l|q]}}
2141 ; AVX-LABEL: icmp_v8i16_v8i1:
2143 ; AVX-NEXT: vpcmpeqw %xmm1, %xmm0, %xmm0
2144 ; AVX-NEXT: vpacksswb %xmm0, %xmm0, %xmm0
2145 ; AVX-NEXT: vpmovmskb %xmm0, %eax
2146 ; AVX-NEXT: testb %al, %al
2147 ; AVX-NEXT: setnp %al
2150 ; AVX512F-LABEL: icmp_v8i16_v8i1:
2152 ; AVX512F-NEXT: vpcmpeqw %xmm1, %xmm0, %xmm0
2153 ; AVX512F-NEXT: vpmovsxwq %xmm0, %zmm0
2154 ; AVX512F-NEXT: vptestmq %zmm0, %zmm0, %k0
2155 ; AVX512F-NEXT: kmovw %k0, %eax
2156 ; AVX512F-NEXT: testb %al, %al
2157 ; AVX512F-NEXT: setnp %al
2158 ; AVX512F-NEXT: vzeroupper
2159 ; AVX512F-NEXT: retq
2161 ; AVX512BW-LABEL: icmp_v8i16_v8i1:
2162 ; AVX512BW: # %bb.0:
2163 ; AVX512BW-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
2164 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
2165 ; AVX512BW-NEXT: vpcmpeqw %zmm1, %zmm0, %k0
2166 ; AVX512BW-NEXT: kmovd %k0, %eax
2167 ; AVX512BW-NEXT: testb %al, %al
2168 ; AVX512BW-NEXT: setnp %al
2169 ; AVX512BW-NEXT: vzeroupper
2170 ; AVX512BW-NEXT: retq
2172 ; AVX512VL-LABEL: icmp_v8i16_v8i1:
2173 ; AVX512VL: # %bb.0:
2174 ; AVX512VL-NEXT: vpcmpeqw %xmm1, %xmm0, %k0
2175 ; AVX512VL-NEXT: kmovd %k0, %eax
2176 ; AVX512VL-NEXT: testb %al, %al
2177 ; AVX512VL-NEXT: setnp %al
2178 ; AVX512VL-NEXT: retq
2179 %a = icmp eq <8 x i16> %0, %1
2180 %b = call i1 @llvm.vector.reduce.xor.v8i1(<8 x i1> %a)
2184 define i1 @icmp_v16i8_v16i1(<16 x i8>, <16 x i8>) nounwind {
2185 ; SSE-LABEL: icmp_v16i8_v16i1:
2187 ; SSE-NEXT: pcmpeqb %xmm1, %xmm0
2188 ; SSE-NEXT: pmovmskb %xmm0, %eax
2189 ; SSE-NEXT: xorb %ah, %al
2190 ; SSE-NEXT: setnp %al
2191 ; SSE-NEXT: ret{{[l|q]}}
2193 ; AVX-LABEL: icmp_v16i8_v16i1:
2195 ; AVX-NEXT: vpcmpeqb %xmm1, %xmm0, %xmm0
2196 ; AVX-NEXT: vpmovmskb %xmm0, %eax
2197 ; AVX-NEXT: xorb %ah, %al
2198 ; AVX-NEXT: setnp %al
2201 ; AVX512F-LABEL: icmp_v16i8_v16i1:
2203 ; AVX512F-NEXT: vpcmpeqb %xmm1, %xmm0, %xmm0
2204 ; AVX512F-NEXT: vpmovmskb %xmm0, %eax
2205 ; AVX512F-NEXT: xorb %ah, %al
2206 ; AVX512F-NEXT: setnp %al
2207 ; AVX512F-NEXT: retq
2209 ; AVX512BW-LABEL: icmp_v16i8_v16i1:
2210 ; AVX512BW: # %bb.0:
2211 ; AVX512BW-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
2212 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
2213 ; AVX512BW-NEXT: vpcmpeqb %zmm1, %zmm0, %k0
2214 ; AVX512BW-NEXT: kmovd %k0, %eax
2215 ; AVX512BW-NEXT: movl %eax, %ecx
2216 ; AVX512BW-NEXT: shrl $8, %ecx
2217 ; AVX512BW-NEXT: xorb %al, %cl
2218 ; AVX512BW-NEXT: setnp %al
2219 ; AVX512BW-NEXT: vzeroupper
2220 ; AVX512BW-NEXT: retq
2222 ; AVX512VL-LABEL: icmp_v16i8_v16i1:
2223 ; AVX512VL: # %bb.0:
2224 ; AVX512VL-NEXT: vpcmpeqb %xmm1, %xmm0, %k0
2225 ; AVX512VL-NEXT: kmovd %k0, %eax
2226 ; AVX512VL-NEXT: movl %eax, %ecx
2227 ; AVX512VL-NEXT: shrl $8, %ecx
2228 ; AVX512VL-NEXT: xorb %al, %cl
2229 ; AVX512VL-NEXT: setnp %al
2230 ; AVX512VL-NEXT: retq
2231 %a = icmp eq <16 x i8> %0, %1
2232 %b = call i1 @llvm.vector.reduce.xor.v16i1(<16 x i1> %a)
2236 define i1 @icmp_v4i64_v4i1(<4 x i64>, <4 x i64>) nounwind {
2237 ; X86-SSE2-LABEL: icmp_v4i64_v4i1:
2238 ; X86-SSE2: # %bb.0:
2239 ; X86-SSE2-NEXT: pushl %ebp
2240 ; X86-SSE2-NEXT: movl %esp, %ebp
2241 ; X86-SSE2-NEXT: andl $-16, %esp
2242 ; X86-SSE2-NEXT: subl $16, %esp
2243 ; X86-SSE2-NEXT: pcmpeqd %xmm2, %xmm0
2244 ; X86-SSE2-NEXT: pcmpeqd 8(%ebp), %xmm1
2245 ; X86-SSE2-NEXT: movdqa %xmm0, %xmm2
2246 ; X86-SSE2-NEXT: shufps {{.*#+}} xmm2 = xmm2[1,3],xmm1[1,3]
2247 ; X86-SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,2],xmm1[0,2]
2248 ; X86-SSE2-NEXT: andps %xmm2, %xmm0
2249 ; X86-SSE2-NEXT: movmskps %xmm0, %eax
2250 ; X86-SSE2-NEXT: testb %al, %al
2251 ; X86-SSE2-NEXT: setnp %al
2252 ; X86-SSE2-NEXT: movl %ebp, %esp
2253 ; X86-SSE2-NEXT: popl %ebp
2254 ; X86-SSE2-NEXT: retl
2256 ; X64-SSE2-LABEL: icmp_v4i64_v4i1:
2257 ; X64-SSE2: # %bb.0:
2258 ; X64-SSE2-NEXT: pcmpeqd %xmm3, %xmm1
2259 ; X64-SSE2-NEXT: pcmpeqd %xmm2, %xmm0
2260 ; X64-SSE2-NEXT: movdqa %xmm0, %xmm2
2261 ; X64-SSE2-NEXT: shufps {{.*#+}} xmm2 = xmm2[1,3],xmm1[1,3]
2262 ; X64-SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,2],xmm1[0,2]
2263 ; X64-SSE2-NEXT: andps %xmm2, %xmm0
2264 ; X64-SSE2-NEXT: movmskps %xmm0, %eax
2265 ; X64-SSE2-NEXT: testb %al, %al
2266 ; X64-SSE2-NEXT: setnp %al
2267 ; X64-SSE2-NEXT: retq
2269 ; SSE41-LABEL: icmp_v4i64_v4i1:
2271 ; SSE41-NEXT: pcmpeqq %xmm3, %xmm1
2272 ; SSE41-NEXT: pcmpeqq %xmm2, %xmm0
2273 ; SSE41-NEXT: packssdw %xmm1, %xmm0
2274 ; SSE41-NEXT: movmskps %xmm0, %eax
2275 ; SSE41-NEXT: testb %al, %al
2276 ; SSE41-NEXT: setnp %al
2279 ; AVX1-LABEL: icmp_v4i64_v4i1:
2281 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
2282 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
2283 ; AVX1-NEXT: vpcmpeqq %xmm2, %xmm3, %xmm2
2284 ; AVX1-NEXT: vpcmpeqq %xmm1, %xmm0, %xmm0
2285 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
2286 ; AVX1-NEXT: vmovmskpd %ymm0, %eax
2287 ; AVX1-NEXT: testb %al, %al
2288 ; AVX1-NEXT: setnp %al
2289 ; AVX1-NEXT: vzeroupper
2292 ; AVX2-LABEL: icmp_v4i64_v4i1:
2294 ; AVX2-NEXT: vpcmpeqq %ymm1, %ymm0, %ymm0
2295 ; AVX2-NEXT: vmovmskpd %ymm0, %eax
2296 ; AVX2-NEXT: testb %al, %al
2297 ; AVX2-NEXT: setnp %al
2298 ; AVX2-NEXT: vzeroupper
2301 ; AVX512F-LABEL: icmp_v4i64_v4i1:
2303 ; AVX512F-NEXT: # kill: def $ymm1 killed $ymm1 def $zmm1
2304 ; AVX512F-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
2305 ; AVX512F-NEXT: vpcmpeqq %zmm1, %zmm0, %k0
2306 ; AVX512F-NEXT: kmovw %k0, %eax
2307 ; AVX512F-NEXT: testb $15, %al
2308 ; AVX512F-NEXT: setnp %al
2309 ; AVX512F-NEXT: vzeroupper
2310 ; AVX512F-NEXT: retq
2312 ; AVX512BW-LABEL: icmp_v4i64_v4i1:
2313 ; AVX512BW: # %bb.0:
2314 ; AVX512BW-NEXT: # kill: def $ymm1 killed $ymm1 def $zmm1
2315 ; AVX512BW-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
2316 ; AVX512BW-NEXT: vpcmpeqq %zmm1, %zmm0, %k0
2317 ; AVX512BW-NEXT: kmovd %k0, %eax
2318 ; AVX512BW-NEXT: testb $15, %al
2319 ; AVX512BW-NEXT: setnp %al
2320 ; AVX512BW-NEXT: vzeroupper
2321 ; AVX512BW-NEXT: retq
2323 ; AVX512VL-LABEL: icmp_v4i64_v4i1:
2324 ; AVX512VL: # %bb.0:
2325 ; AVX512VL-NEXT: vpcmpeqq %ymm1, %ymm0, %k0
2326 ; AVX512VL-NEXT: kmovd %k0, %eax
2327 ; AVX512VL-NEXT: testb %al, %al
2328 ; AVX512VL-NEXT: setnp %al
2329 ; AVX512VL-NEXT: vzeroupper
2330 ; AVX512VL-NEXT: retq
2331 %a = icmp eq <4 x i64> %0, %1
2332 %b = call i1 @llvm.vector.reduce.xor.v4i1(<4 x i1> %a)
2336 define i1 @icmp_v8i32_v8i1(<8 x i32>, <8 x i32>) nounwind {
2337 ; X86-SSE2-LABEL: icmp_v8i32_v8i1:
2338 ; X86-SSE2: # %bb.0:
2339 ; X86-SSE2-NEXT: pushl %ebp
2340 ; X86-SSE2-NEXT: movl %esp, %ebp
2341 ; X86-SSE2-NEXT: andl $-16, %esp
2342 ; X86-SSE2-NEXT: subl $16, %esp
2343 ; X86-SSE2-NEXT: pcmpeqd %xmm2, %xmm0
2344 ; X86-SSE2-NEXT: pcmpeqd 8(%ebp), %xmm1
2345 ; X86-SSE2-NEXT: packssdw %xmm1, %xmm0
2346 ; X86-SSE2-NEXT: packsswb %xmm0, %xmm0
2347 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
2348 ; X86-SSE2-NEXT: testb %al, %al
2349 ; X86-SSE2-NEXT: setnp %al
2350 ; X86-SSE2-NEXT: movl %ebp, %esp
2351 ; X86-SSE2-NEXT: popl %ebp
2352 ; X86-SSE2-NEXT: retl
2354 ; X64-SSE-LABEL: icmp_v8i32_v8i1:
2356 ; X64-SSE-NEXT: pcmpeqd %xmm3, %xmm1
2357 ; X64-SSE-NEXT: pcmpeqd %xmm2, %xmm0
2358 ; X64-SSE-NEXT: packssdw %xmm1, %xmm0
2359 ; X64-SSE-NEXT: packsswb %xmm0, %xmm0
2360 ; X64-SSE-NEXT: pmovmskb %xmm0, %eax
2361 ; X64-SSE-NEXT: testb %al, %al
2362 ; X64-SSE-NEXT: setnp %al
2363 ; X64-SSE-NEXT: retq
2365 ; AVX1-LABEL: icmp_v8i32_v8i1:
2367 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
2368 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
2369 ; AVX1-NEXT: vpcmpeqd %xmm2, %xmm3, %xmm2
2370 ; AVX1-NEXT: vpcmpeqd %xmm1, %xmm0, %xmm0
2371 ; AVX1-NEXT: vinsertf128 $1, %xmm2, %ymm0, %ymm0
2372 ; AVX1-NEXT: vmovmskps %ymm0, %eax
2373 ; AVX1-NEXT: testb %al, %al
2374 ; AVX1-NEXT: setnp %al
2375 ; AVX1-NEXT: vzeroupper
2378 ; AVX2-LABEL: icmp_v8i32_v8i1:
2380 ; AVX2-NEXT: vpcmpeqd %ymm1, %ymm0, %ymm0
2381 ; AVX2-NEXT: vmovmskps %ymm0, %eax
2382 ; AVX2-NEXT: testb %al, %al
2383 ; AVX2-NEXT: setnp %al
2384 ; AVX2-NEXT: vzeroupper
2387 ; AVX512F-LABEL: icmp_v8i32_v8i1:
2389 ; AVX512F-NEXT: # kill: def $ymm1 killed $ymm1 def $zmm1
2390 ; AVX512F-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
2391 ; AVX512F-NEXT: vpcmpeqd %zmm1, %zmm0, %k0
2392 ; AVX512F-NEXT: kmovw %k0, %eax
2393 ; AVX512F-NEXT: testb %al, %al
2394 ; AVX512F-NEXT: setnp %al
2395 ; AVX512F-NEXT: vzeroupper
2396 ; AVX512F-NEXT: retq
2398 ; AVX512BW-LABEL: icmp_v8i32_v8i1:
2399 ; AVX512BW: # %bb.0:
2400 ; AVX512BW-NEXT: # kill: def $ymm1 killed $ymm1 def $zmm1
2401 ; AVX512BW-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
2402 ; AVX512BW-NEXT: vpcmpeqd %zmm1, %zmm0, %k0
2403 ; AVX512BW-NEXT: kmovd %k0, %eax
2404 ; AVX512BW-NEXT: testb %al, %al
2405 ; AVX512BW-NEXT: setnp %al
2406 ; AVX512BW-NEXT: vzeroupper
2407 ; AVX512BW-NEXT: retq
2409 ; AVX512VL-LABEL: icmp_v8i32_v8i1:
2410 ; AVX512VL: # %bb.0:
2411 ; AVX512VL-NEXT: vpcmpeqd %ymm1, %ymm0, %k0
2412 ; AVX512VL-NEXT: kmovd %k0, %eax
2413 ; AVX512VL-NEXT: testb %al, %al
2414 ; AVX512VL-NEXT: setnp %al
2415 ; AVX512VL-NEXT: vzeroupper
2416 ; AVX512VL-NEXT: retq
2417 %a = icmp eq <8 x i32> %0, %1
2418 %b = call i1 @llvm.vector.reduce.xor.v8i1(<8 x i1> %a)
2422 define i1 @icmp_v16i16_v16i1(<16 x i16>, <16 x i16>) nounwind {
2423 ; X86-SSE2-LABEL: icmp_v16i16_v16i1:
2424 ; X86-SSE2: # %bb.0:
2425 ; X86-SSE2-NEXT: pushl %ebp
2426 ; X86-SSE2-NEXT: movl %esp, %ebp
2427 ; X86-SSE2-NEXT: andl $-16, %esp
2428 ; X86-SSE2-NEXT: subl $16, %esp
2429 ; X86-SSE2-NEXT: pcmpeqw %xmm2, %xmm0
2430 ; X86-SSE2-NEXT: pcmpeqw 8(%ebp), %xmm1
2431 ; X86-SSE2-NEXT: packsswb %xmm1, %xmm0
2432 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
2433 ; X86-SSE2-NEXT: xorb %ah, %al
2434 ; X86-SSE2-NEXT: setnp %al
2435 ; X86-SSE2-NEXT: movl %ebp, %esp
2436 ; X86-SSE2-NEXT: popl %ebp
2437 ; X86-SSE2-NEXT: retl
2439 ; X64-SSE-LABEL: icmp_v16i16_v16i1:
2441 ; X64-SSE-NEXT: pcmpeqw %xmm3, %xmm1
2442 ; X64-SSE-NEXT: pcmpeqw %xmm2, %xmm0
2443 ; X64-SSE-NEXT: packsswb %xmm1, %xmm0
2444 ; X64-SSE-NEXT: pmovmskb %xmm0, %eax
2445 ; X64-SSE-NEXT: xorb %ah, %al
2446 ; X64-SSE-NEXT: setnp %al
2447 ; X64-SSE-NEXT: retq
2449 ; AVX1-LABEL: icmp_v16i16_v16i1:
2451 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
2452 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
2453 ; AVX1-NEXT: vpcmpeqw %xmm2, %xmm3, %xmm2
2454 ; AVX1-NEXT: vpcmpeqw %xmm1, %xmm0, %xmm0
2455 ; AVX1-NEXT: vpacksswb %xmm2, %xmm0, %xmm0
2456 ; AVX1-NEXT: vpmovmskb %xmm0, %eax
2457 ; AVX1-NEXT: xorb %ah, %al
2458 ; AVX1-NEXT: setnp %al
2459 ; AVX1-NEXT: vzeroupper
2462 ; AVX2-LABEL: icmp_v16i16_v16i1:
2464 ; AVX2-NEXT: vpcmpeqw %ymm1, %ymm0, %ymm0
2465 ; AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
2466 ; AVX2-NEXT: vpacksswb %xmm1, %xmm0, %xmm0
2467 ; AVX2-NEXT: vpmovmskb %xmm0, %eax
2468 ; AVX2-NEXT: xorb %ah, %al
2469 ; AVX2-NEXT: setnp %al
2470 ; AVX2-NEXT: vzeroupper
2473 ; AVX512F-LABEL: icmp_v16i16_v16i1:
2475 ; AVX512F-NEXT: vpcmpeqw %ymm1, %ymm0, %ymm0
2476 ; AVX512F-NEXT: vpmovsxwd %ymm0, %zmm0
2477 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
2478 ; AVX512F-NEXT: kmovw %k0, %eax
2479 ; AVX512F-NEXT: movl %eax, %ecx
2480 ; AVX512F-NEXT: shrl $8, %ecx
2481 ; AVX512F-NEXT: xorb %al, %cl
2482 ; AVX512F-NEXT: setnp %al
2483 ; AVX512F-NEXT: vzeroupper
2484 ; AVX512F-NEXT: retq
2486 ; AVX512BW-LABEL: icmp_v16i16_v16i1:
2487 ; AVX512BW: # %bb.0:
2488 ; AVX512BW-NEXT: # kill: def $ymm1 killed $ymm1 def $zmm1
2489 ; AVX512BW-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
2490 ; AVX512BW-NEXT: vpcmpeqw %zmm1, %zmm0, %k0
2491 ; AVX512BW-NEXT: kmovd %k0, %eax
2492 ; AVX512BW-NEXT: movl %eax, %ecx
2493 ; AVX512BW-NEXT: shrl $8, %ecx
2494 ; AVX512BW-NEXT: xorb %al, %cl
2495 ; AVX512BW-NEXT: setnp %al
2496 ; AVX512BW-NEXT: vzeroupper
2497 ; AVX512BW-NEXT: retq
2499 ; AVX512VL-LABEL: icmp_v16i16_v16i1:
2500 ; AVX512VL: # %bb.0:
2501 ; AVX512VL-NEXT: vpcmpeqw %ymm1, %ymm0, %k0
2502 ; AVX512VL-NEXT: kmovd %k0, %eax
2503 ; AVX512VL-NEXT: movl %eax, %ecx
2504 ; AVX512VL-NEXT: shrl $8, %ecx
2505 ; AVX512VL-NEXT: xorb %al, %cl
2506 ; AVX512VL-NEXT: setnp %al
2507 ; AVX512VL-NEXT: vzeroupper
2508 ; AVX512VL-NEXT: retq
2509 %a = icmp eq <16 x i16> %0, %1
2510 %b = call i1 @llvm.vector.reduce.xor.v16i1(<16 x i1> %a)
2514 define i1 @icmp_v32i8_v32i1(<32 x i8>, <32 x i8>) nounwind {
2515 ; X86-SSE2-LABEL: icmp_v32i8_v32i1:
2516 ; X86-SSE2: # %bb.0:
2517 ; X86-SSE2-NEXT: pushl %ebp
2518 ; X86-SSE2-NEXT: movl %esp, %ebp
2519 ; X86-SSE2-NEXT: andl $-16, %esp
2520 ; X86-SSE2-NEXT: subl $16, %esp
2521 ; X86-SSE2-NEXT: pcmpeqb %xmm2, %xmm0
2522 ; X86-SSE2-NEXT: pcmpeqb 8(%ebp), %xmm1
2523 ; X86-SSE2-NEXT: pxor %xmm0, %xmm1
2524 ; X86-SSE2-NEXT: pmovmskb %xmm1, %eax
2525 ; X86-SSE2-NEXT: xorb %ah, %al
2526 ; X86-SSE2-NEXT: setnp %al
2527 ; X86-SSE2-NEXT: movl %ebp, %esp
2528 ; X86-SSE2-NEXT: popl %ebp
2529 ; X86-SSE2-NEXT: retl
2531 ; X64-SSE-LABEL: icmp_v32i8_v32i1:
2533 ; X64-SSE-NEXT: pcmpeqb %xmm3, %xmm1
2534 ; X64-SSE-NEXT: pcmpeqb %xmm2, %xmm0
2535 ; X64-SSE-NEXT: pxor %xmm1, %xmm0
2536 ; X64-SSE-NEXT: pmovmskb %xmm0, %eax
2537 ; X64-SSE-NEXT: xorb %ah, %al
2538 ; X64-SSE-NEXT: setnp %al
2539 ; X64-SSE-NEXT: retq
2541 ; AVX1-LABEL: icmp_v32i8_v32i1:
2543 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
2544 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
2545 ; AVX1-NEXT: vpcmpeqb %xmm2, %xmm3, %xmm2
2546 ; AVX1-NEXT: vpcmpeqb %xmm1, %xmm0, %xmm0
2547 ; AVX1-NEXT: vpxor %xmm2, %xmm0, %xmm0
2548 ; AVX1-NEXT: vpmovmskb %xmm0, %eax
2549 ; AVX1-NEXT: xorb %ah, %al
2550 ; AVX1-NEXT: setnp %al
2551 ; AVX1-NEXT: vzeroupper
2554 ; AVX2-LABEL: icmp_v32i8_v32i1:
2556 ; AVX2-NEXT: vpcmpeqb %ymm1, %ymm0, %ymm0
2557 ; AVX2-NEXT: vpmovmskb %ymm0, %eax
2558 ; AVX2-NEXT: movl %eax, %ecx
2559 ; AVX2-NEXT: shrl $16, %ecx
2560 ; AVX2-NEXT: xorl %eax, %ecx
2561 ; AVX2-NEXT: xorb %ch, %cl
2562 ; AVX2-NEXT: setnp %al
2563 ; AVX2-NEXT: vzeroupper
2566 ; AVX512F-LABEL: icmp_v32i8_v32i1:
2568 ; AVX512F-NEXT: vpcmpeqb %ymm1, %ymm0, %ymm0
2569 ; AVX512F-NEXT: vextracti128 $1, %ymm0, %xmm1
2570 ; AVX512F-NEXT: vpxor %xmm1, %xmm0, %xmm0
2571 ; AVX512F-NEXT: vpmovsxbd %xmm0, %zmm0
2572 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
2573 ; AVX512F-NEXT: kshiftrw $8, %k0, %k1
2574 ; AVX512F-NEXT: kxorw %k1, %k0, %k0
2575 ; AVX512F-NEXT: kshiftrw $4, %k0, %k1
2576 ; AVX512F-NEXT: kxorw %k1, %k0, %k0
2577 ; AVX512F-NEXT: kshiftrw $2, %k0, %k1
2578 ; AVX512F-NEXT: kxorw %k1, %k0, %k0
2579 ; AVX512F-NEXT: kshiftrw $1, %k0, %k1
2580 ; AVX512F-NEXT: kxorw %k1, %k0, %k0
2581 ; AVX512F-NEXT: kmovw %k0, %eax
2582 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
2583 ; AVX512F-NEXT: vzeroupper
2584 ; AVX512F-NEXT: retq
2586 ; AVX512BW-LABEL: icmp_v32i8_v32i1:
2587 ; AVX512BW: # %bb.0:
2588 ; AVX512BW-NEXT: # kill: def $ymm1 killed $ymm1 def $zmm1
2589 ; AVX512BW-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
2590 ; AVX512BW-NEXT: vpcmpeqb %zmm1, %zmm0, %k0
2591 ; AVX512BW-NEXT: kmovd %k0, %eax
2592 ; AVX512BW-NEXT: movl %eax, %ecx
2593 ; AVX512BW-NEXT: shrl $16, %ecx
2594 ; AVX512BW-NEXT: xorl %eax, %ecx
2595 ; AVX512BW-NEXT: xorb %ch, %cl
2596 ; AVX512BW-NEXT: setnp %al
2597 ; AVX512BW-NEXT: vzeroupper
2598 ; AVX512BW-NEXT: retq
2600 ; AVX512VL-LABEL: icmp_v32i8_v32i1:
2601 ; AVX512VL: # %bb.0:
2602 ; AVX512VL-NEXT: vpcmpeqb %ymm1, %ymm0, %k0
2603 ; AVX512VL-NEXT: kmovd %k0, %eax
2604 ; AVX512VL-NEXT: movl %eax, %ecx
2605 ; AVX512VL-NEXT: shrl $16, %ecx
2606 ; AVX512VL-NEXT: xorl %eax, %ecx
2607 ; AVX512VL-NEXT: xorb %ch, %cl
2608 ; AVX512VL-NEXT: setnp %al
2609 ; AVX512VL-NEXT: vzeroupper
2610 ; AVX512VL-NEXT: retq
2611 %a = icmp eq <32 x i8> %0, %1
2612 %b = call i1 @llvm.vector.reduce.xor.v32i1(<32 x i1> %a)
2616 define i1 @icmp_v8i64_v8i1(<8 x i64>, <8 x i64>) nounwind {
2617 ; X86-SSE2-LABEL: icmp_v8i64_v8i1:
2618 ; X86-SSE2: # %bb.0:
2619 ; X86-SSE2-NEXT: pushl %ebp
2620 ; X86-SSE2-NEXT: movl %esp, %ebp
2621 ; X86-SSE2-NEXT: andl $-16, %esp
2622 ; X86-SSE2-NEXT: subl $16, %esp
2623 ; X86-SSE2-NEXT: movdqa 8(%ebp), %xmm3
2624 ; X86-SSE2-NEXT: pcmpeqd 72(%ebp), %xmm3
2625 ; X86-SSE2-NEXT: pshufd {{.*#+}} xmm4 = xmm3[1,0,3,2]
2626 ; X86-SSE2-NEXT: pand %xmm3, %xmm4
2627 ; X86-SSE2-NEXT: pcmpeqd 56(%ebp), %xmm2
2628 ; X86-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm2[1,0,3,2]
2629 ; X86-SSE2-NEXT: pand %xmm2, %xmm3
2630 ; X86-SSE2-NEXT: packssdw %xmm4, %xmm3
2631 ; X86-SSE2-NEXT: pcmpeqd 40(%ebp), %xmm1
2632 ; X86-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm1[1,0,3,2]
2633 ; X86-SSE2-NEXT: pand %xmm1, %xmm2
2634 ; X86-SSE2-NEXT: pcmpeqd 24(%ebp), %xmm0
2635 ; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,0,3,2]
2636 ; X86-SSE2-NEXT: pand %xmm0, %xmm1
2637 ; X86-SSE2-NEXT: packssdw %xmm2, %xmm1
2638 ; X86-SSE2-NEXT: packssdw %xmm3, %xmm1
2639 ; X86-SSE2-NEXT: packsswb %xmm1, %xmm1
2640 ; X86-SSE2-NEXT: pmovmskb %xmm1, %eax
2641 ; X86-SSE2-NEXT: testb %al, %al
2642 ; X86-SSE2-NEXT: setnp %al
2643 ; X86-SSE2-NEXT: movl %ebp, %esp
2644 ; X86-SSE2-NEXT: popl %ebp
2645 ; X86-SSE2-NEXT: retl
2647 ; X64-SSE2-LABEL: icmp_v8i64_v8i1:
2648 ; X64-SSE2: # %bb.0:
2649 ; X64-SSE2-NEXT: pcmpeqd %xmm7, %xmm3
2650 ; X64-SSE2-NEXT: pshufd {{.*#+}} xmm7 = xmm3[1,0,3,2]
2651 ; X64-SSE2-NEXT: pand %xmm3, %xmm7
2652 ; X64-SSE2-NEXT: pcmpeqd %xmm6, %xmm2
2653 ; X64-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm2[1,0,3,2]
2654 ; X64-SSE2-NEXT: pand %xmm2, %xmm3
2655 ; X64-SSE2-NEXT: packssdw %xmm7, %xmm3
2656 ; X64-SSE2-NEXT: pcmpeqd %xmm5, %xmm1
2657 ; X64-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm1[1,0,3,2]
2658 ; X64-SSE2-NEXT: pand %xmm1, %xmm2
2659 ; X64-SSE2-NEXT: pcmpeqd %xmm4, %xmm0
2660 ; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,0,3,2]
2661 ; X64-SSE2-NEXT: pand %xmm0, %xmm1
2662 ; X64-SSE2-NEXT: packssdw %xmm2, %xmm1
2663 ; X64-SSE2-NEXT: packssdw %xmm3, %xmm1
2664 ; X64-SSE2-NEXT: packsswb %xmm1, %xmm1
2665 ; X64-SSE2-NEXT: pmovmskb %xmm1, %eax
2666 ; X64-SSE2-NEXT: testb %al, %al
2667 ; X64-SSE2-NEXT: setnp %al
2668 ; X64-SSE2-NEXT: retq
2670 ; SSE41-LABEL: icmp_v8i64_v8i1:
2672 ; SSE41-NEXT: pcmpeqq %xmm7, %xmm3
2673 ; SSE41-NEXT: pcmpeqq %xmm6, %xmm2
2674 ; SSE41-NEXT: packssdw %xmm3, %xmm2
2675 ; SSE41-NEXT: pcmpeqq %xmm5, %xmm1
2676 ; SSE41-NEXT: pcmpeqq %xmm4, %xmm0
2677 ; SSE41-NEXT: packssdw %xmm1, %xmm0
2678 ; SSE41-NEXT: packssdw %xmm2, %xmm0
2679 ; SSE41-NEXT: packsswb %xmm0, %xmm0
2680 ; SSE41-NEXT: pmovmskb %xmm0, %eax
2681 ; SSE41-NEXT: testb %al, %al
2682 ; SSE41-NEXT: setnp %al
2685 ; AVX1-LABEL: icmp_v8i64_v8i1:
2687 ; AVX1-NEXT: vextractf128 $1, %ymm3, %xmm4
2688 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm5
2689 ; AVX1-NEXT: vpcmpeqq %xmm4, %xmm5, %xmm4
2690 ; AVX1-NEXT: vpcmpeqq %xmm3, %xmm1, %xmm1
2691 ; AVX1-NEXT: vpackssdw %xmm4, %xmm1, %xmm1
2692 ; AVX1-NEXT: vextractf128 $1, %ymm2, %xmm3
2693 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm4
2694 ; AVX1-NEXT: vpcmpeqq %xmm3, %xmm4, %xmm3
2695 ; AVX1-NEXT: vpcmpeqq %xmm2, %xmm0, %xmm0
2696 ; AVX1-NEXT: vpackssdw %xmm3, %xmm0, %xmm0
2697 ; AVX1-NEXT: vinsertf128 $1, %xmm1, %ymm0, %ymm0
2698 ; AVX1-NEXT: vmovmskps %ymm0, %eax
2699 ; AVX1-NEXT: testb %al, %al
2700 ; AVX1-NEXT: setnp %al
2701 ; AVX1-NEXT: vzeroupper
2704 ; AVX2-LABEL: icmp_v8i64_v8i1:
2706 ; AVX2-NEXT: vpcmpeqq %ymm3, %ymm1, %ymm1
2707 ; AVX2-NEXT: vpcmpeqq %ymm2, %ymm0, %ymm0
2708 ; AVX2-NEXT: vpackssdw %ymm1, %ymm0, %ymm0
2709 ; AVX2-NEXT: vpermq {{.*#+}} ymm0 = ymm0[0,2,1,3]
2710 ; AVX2-NEXT: vmovmskps %ymm0, %eax
2711 ; AVX2-NEXT: testb %al, %al
2712 ; AVX2-NEXT: setnp %al
2713 ; AVX2-NEXT: vzeroupper
2716 ; AVX512F-LABEL: icmp_v8i64_v8i1:
2718 ; AVX512F-NEXT: vpcmpeqq %zmm1, %zmm0, %k0
2719 ; AVX512F-NEXT: kmovw %k0, %eax
2720 ; AVX512F-NEXT: testb %al, %al
2721 ; AVX512F-NEXT: setnp %al
2722 ; AVX512F-NEXT: vzeroupper
2723 ; AVX512F-NEXT: retq
2725 ; AVX512BW-LABEL: icmp_v8i64_v8i1:
2726 ; AVX512BW: # %bb.0:
2727 ; AVX512BW-NEXT: vpcmpeqq %zmm1, %zmm0, %k0
2728 ; AVX512BW-NEXT: kmovd %k0, %eax
2729 ; AVX512BW-NEXT: testb %al, %al
2730 ; AVX512BW-NEXT: setnp %al
2731 ; AVX512BW-NEXT: vzeroupper
2732 ; AVX512BW-NEXT: retq
2734 ; AVX512VL-LABEL: icmp_v8i64_v8i1:
2735 ; AVX512VL: # %bb.0:
2736 ; AVX512VL-NEXT: vpcmpeqq %zmm1, %zmm0, %k0
2737 ; AVX512VL-NEXT: kmovd %k0, %eax
2738 ; AVX512VL-NEXT: testb %al, %al
2739 ; AVX512VL-NEXT: setnp %al
2740 ; AVX512VL-NEXT: vzeroupper
2741 ; AVX512VL-NEXT: retq
2742 %a = icmp eq <8 x i64> %0, %1
2743 %b = call i1 @llvm.vector.reduce.xor.v8i1(<8 x i1> %a)
2747 define i1 @icmp_v16i32_v16i1(<16 x i32>, <16 x i32>) nounwind {
2748 ; X86-SSE2-LABEL: icmp_v16i32_v16i1:
2749 ; X86-SSE2: # %bb.0:
2750 ; X86-SSE2-NEXT: pushl %ebp
2751 ; X86-SSE2-NEXT: movl %esp, %ebp
2752 ; X86-SSE2-NEXT: andl $-16, %esp
2753 ; X86-SSE2-NEXT: subl $16, %esp
2754 ; X86-SSE2-NEXT: movdqa 8(%ebp), %xmm3
2755 ; X86-SSE2-NEXT: pcmpeqd 72(%ebp), %xmm3
2756 ; X86-SSE2-NEXT: pcmpeqd 56(%ebp), %xmm2
2757 ; X86-SSE2-NEXT: packssdw %xmm3, %xmm2
2758 ; X86-SSE2-NEXT: pcmpeqd 40(%ebp), %xmm1
2759 ; X86-SSE2-NEXT: pcmpeqd 24(%ebp), %xmm0
2760 ; X86-SSE2-NEXT: packssdw %xmm1, %xmm0
2761 ; X86-SSE2-NEXT: packsswb %xmm2, %xmm0
2762 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
2763 ; X86-SSE2-NEXT: xorb %ah, %al
2764 ; X86-SSE2-NEXT: setnp %al
2765 ; X86-SSE2-NEXT: movl %ebp, %esp
2766 ; X86-SSE2-NEXT: popl %ebp
2767 ; X86-SSE2-NEXT: retl
2769 ; X64-SSE-LABEL: icmp_v16i32_v16i1:
2771 ; X64-SSE-NEXT: pcmpeqd %xmm7, %xmm3
2772 ; X64-SSE-NEXT: pcmpeqd %xmm6, %xmm2
2773 ; X64-SSE-NEXT: packssdw %xmm3, %xmm2
2774 ; X64-SSE-NEXT: pcmpeqd %xmm5, %xmm1
2775 ; X64-SSE-NEXT: pcmpeqd %xmm4, %xmm0
2776 ; X64-SSE-NEXT: packssdw %xmm1, %xmm0
2777 ; X64-SSE-NEXT: packsswb %xmm2, %xmm0
2778 ; X64-SSE-NEXT: pmovmskb %xmm0, %eax
2779 ; X64-SSE-NEXT: xorb %ah, %al
2780 ; X64-SSE-NEXT: setnp %al
2781 ; X64-SSE-NEXT: retq
2783 ; AVX1-LABEL: icmp_v16i32_v16i1:
2785 ; AVX1-NEXT: vextractf128 $1, %ymm3, %xmm4
2786 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm5
2787 ; AVX1-NEXT: vpcmpeqd %xmm4, %xmm5, %xmm4
2788 ; AVX1-NEXT: vpcmpeqd %xmm3, %xmm1, %xmm1
2789 ; AVX1-NEXT: vpackssdw %xmm4, %xmm1, %xmm1
2790 ; AVX1-NEXT: vextractf128 $1, %ymm2, %xmm3
2791 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm4
2792 ; AVX1-NEXT: vpcmpeqd %xmm3, %xmm4, %xmm3
2793 ; AVX1-NEXT: vpcmpeqd %xmm2, %xmm0, %xmm0
2794 ; AVX1-NEXT: vpackssdw %xmm3, %xmm0, %xmm0
2795 ; AVX1-NEXT: vpacksswb %xmm1, %xmm0, %xmm0
2796 ; AVX1-NEXT: vpmovmskb %xmm0, %eax
2797 ; AVX1-NEXT: xorb %ah, %al
2798 ; AVX1-NEXT: setnp %al
2799 ; AVX1-NEXT: vzeroupper
2802 ; AVX2-LABEL: icmp_v16i32_v16i1:
2804 ; AVX2-NEXT: vpcmpeqd %ymm3, %ymm1, %ymm1
2805 ; AVX2-NEXT: vpcmpeqd %ymm2, %ymm0, %ymm0
2806 ; AVX2-NEXT: vpackssdw %ymm1, %ymm0, %ymm0
2807 ; AVX2-NEXT: vextracti128 $1, %ymm0, %xmm1
2808 ; AVX2-NEXT: vpacksswb %xmm1, %xmm0, %xmm0
2809 ; AVX2-NEXT: vpshufd {{.*#+}} xmm0 = xmm0[0,2,1,3]
2810 ; AVX2-NEXT: vpmovmskb %xmm0, %eax
2811 ; AVX2-NEXT: xorb %ah, %al
2812 ; AVX2-NEXT: setnp %al
2813 ; AVX2-NEXT: vzeroupper
2816 ; AVX512F-LABEL: icmp_v16i32_v16i1:
2818 ; AVX512F-NEXT: vpcmpeqd %zmm1, %zmm0, %k0
2819 ; AVX512F-NEXT: kmovw %k0, %eax
2820 ; AVX512F-NEXT: movl %eax, %ecx
2821 ; AVX512F-NEXT: shrl $8, %ecx
2822 ; AVX512F-NEXT: xorb %al, %cl
2823 ; AVX512F-NEXT: setnp %al
2824 ; AVX512F-NEXT: vzeroupper
2825 ; AVX512F-NEXT: retq
2827 ; AVX512BW-LABEL: icmp_v16i32_v16i1:
2828 ; AVX512BW: # %bb.0:
2829 ; AVX512BW-NEXT: vpcmpeqd %zmm1, %zmm0, %k0
2830 ; AVX512BW-NEXT: kmovd %k0, %eax
2831 ; AVX512BW-NEXT: movl %eax, %ecx
2832 ; AVX512BW-NEXT: shrl $8, %ecx
2833 ; AVX512BW-NEXT: xorb %al, %cl
2834 ; AVX512BW-NEXT: setnp %al
2835 ; AVX512BW-NEXT: vzeroupper
2836 ; AVX512BW-NEXT: retq
2838 ; AVX512VL-LABEL: icmp_v16i32_v16i1:
2839 ; AVX512VL: # %bb.0:
2840 ; AVX512VL-NEXT: vpcmpeqd %zmm1, %zmm0, %k0
2841 ; AVX512VL-NEXT: kmovd %k0, %eax
2842 ; AVX512VL-NEXT: movl %eax, %ecx
2843 ; AVX512VL-NEXT: shrl $8, %ecx
2844 ; AVX512VL-NEXT: xorb %al, %cl
2845 ; AVX512VL-NEXT: setnp %al
2846 ; AVX512VL-NEXT: vzeroupper
2847 ; AVX512VL-NEXT: retq
2848 %a = icmp eq <16 x i32> %0, %1
2849 %b = call i1 @llvm.vector.reduce.xor.v16i1(<16 x i1> %a)
2853 define i1 @icmp_v32i16_v32i1(<32 x i16>, <32 x i16>) nounwind {
2854 ; X86-SSE2-LABEL: icmp_v32i16_v32i1:
2855 ; X86-SSE2: # %bb.0:
2856 ; X86-SSE2-NEXT: pushl %ebp
2857 ; X86-SSE2-NEXT: movl %esp, %ebp
2858 ; X86-SSE2-NEXT: andl $-16, %esp
2859 ; X86-SSE2-NEXT: subl $16, %esp
2860 ; X86-SSE2-NEXT: movdqa 8(%ebp), %xmm3
2861 ; X86-SSE2-NEXT: pcmpeqw 56(%ebp), %xmm2
2862 ; X86-SSE2-NEXT: pcmpeqw 24(%ebp), %xmm0
2863 ; X86-SSE2-NEXT: pxor %xmm2, %xmm0
2864 ; X86-SSE2-NEXT: pcmpeqw 72(%ebp), %xmm3
2865 ; X86-SSE2-NEXT: pcmpeqw 40(%ebp), %xmm1
2866 ; X86-SSE2-NEXT: pxor %xmm3, %xmm1
2867 ; X86-SSE2-NEXT: packsswb %xmm1, %xmm0
2868 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
2869 ; X86-SSE2-NEXT: xorb %ah, %al
2870 ; X86-SSE2-NEXT: setnp %al
2871 ; X86-SSE2-NEXT: movl %ebp, %esp
2872 ; X86-SSE2-NEXT: popl %ebp
2873 ; X86-SSE2-NEXT: retl
2875 ; X64-SSE-LABEL: icmp_v32i16_v32i1:
2877 ; X64-SSE-NEXT: pcmpeqw %xmm6, %xmm2
2878 ; X64-SSE-NEXT: pcmpeqw %xmm4, %xmm0
2879 ; X64-SSE-NEXT: pxor %xmm2, %xmm0
2880 ; X64-SSE-NEXT: pcmpeqw %xmm7, %xmm3
2881 ; X64-SSE-NEXT: pcmpeqw %xmm5, %xmm1
2882 ; X64-SSE-NEXT: pxor %xmm3, %xmm1
2883 ; X64-SSE-NEXT: packsswb %xmm1, %xmm0
2884 ; X64-SSE-NEXT: pmovmskb %xmm0, %eax
2885 ; X64-SSE-NEXT: xorb %ah, %al
2886 ; X64-SSE-NEXT: setnp %al
2887 ; X64-SSE-NEXT: retq
2889 ; AVX1-LABEL: icmp_v32i16_v32i1:
2891 ; AVX1-NEXT: vpcmpeqw %xmm3, %xmm1, %xmm4
2892 ; AVX1-NEXT: vpcmpeqw %xmm2, %xmm0, %xmm5
2893 ; AVX1-NEXT: vpxor %xmm4, %xmm5, %xmm4
2894 ; AVX1-NEXT: vextractf128 $1, %ymm3, %xmm3
2895 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm1
2896 ; AVX1-NEXT: vpcmpeqw %xmm3, %xmm1, %xmm1
2897 ; AVX1-NEXT: vextractf128 $1, %ymm2, %xmm2
2898 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm0
2899 ; AVX1-NEXT: vpcmpeqw %xmm2, %xmm0, %xmm0
2900 ; AVX1-NEXT: vpxor %xmm1, %xmm0, %xmm0
2901 ; AVX1-NEXT: vpacksswb %xmm0, %xmm4, %xmm0
2902 ; AVX1-NEXT: vpmovmskb %xmm0, %eax
2903 ; AVX1-NEXT: xorb %ah, %al
2904 ; AVX1-NEXT: setnp %al
2905 ; AVX1-NEXT: vzeroupper
2908 ; AVX2-LABEL: icmp_v32i16_v32i1:
2910 ; AVX2-NEXT: vpcmpeqw %ymm3, %ymm1, %ymm1
2911 ; AVX2-NEXT: vpcmpeqw %ymm2, %ymm0, %ymm0
2912 ; AVX2-NEXT: vpacksswb %ymm1, %ymm0, %ymm0
2913 ; AVX2-NEXT: vpermq {{.*#+}} ymm0 = ymm0[0,2,1,3]
2914 ; AVX2-NEXT: vpmovmskb %ymm0, %eax
2915 ; AVX2-NEXT: movl %eax, %ecx
2916 ; AVX2-NEXT: shrl $16, %ecx
2917 ; AVX2-NEXT: xorl %eax, %ecx
2918 ; AVX2-NEXT: xorb %ch, %cl
2919 ; AVX2-NEXT: setnp %al
2920 ; AVX2-NEXT: vzeroupper
2923 ; AVX512F-LABEL: icmp_v32i16_v32i1:
2925 ; AVX512F-NEXT: vextracti64x4 $1, %zmm1, %ymm2
2926 ; AVX512F-NEXT: vextracti64x4 $1, %zmm0, %ymm3
2927 ; AVX512F-NEXT: vpcmpeqw %ymm2, %ymm3, %ymm2
2928 ; AVX512F-NEXT: vpcmpeqw %ymm1, %ymm0, %ymm0
2929 ; AVX512F-NEXT: vpxor %ymm2, %ymm0, %ymm0
2930 ; AVX512F-NEXT: vpmovsxwd %ymm0, %zmm0
2931 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
2932 ; AVX512F-NEXT: kshiftrw $8, %k0, %k1
2933 ; AVX512F-NEXT: kxorw %k1, %k0, %k0
2934 ; AVX512F-NEXT: kshiftrw $4, %k0, %k1
2935 ; AVX512F-NEXT: kxorw %k1, %k0, %k0
2936 ; AVX512F-NEXT: kshiftrw $2, %k0, %k1
2937 ; AVX512F-NEXT: kxorw %k1, %k0, %k0
2938 ; AVX512F-NEXT: kshiftrw $1, %k0, %k1
2939 ; AVX512F-NEXT: kxorw %k1, %k0, %k0
2940 ; AVX512F-NEXT: kmovw %k0, %eax
2941 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
2942 ; AVX512F-NEXT: vzeroupper
2943 ; AVX512F-NEXT: retq
2945 ; AVX512BW-LABEL: icmp_v32i16_v32i1:
2946 ; AVX512BW: # %bb.0:
2947 ; AVX512BW-NEXT: vpcmpeqw %zmm1, %zmm0, %k0
2948 ; AVX512BW-NEXT: kmovd %k0, %eax
2949 ; AVX512BW-NEXT: movl %eax, %ecx
2950 ; AVX512BW-NEXT: shrl $16, %ecx
2951 ; AVX512BW-NEXT: xorl %eax, %ecx
2952 ; AVX512BW-NEXT: xorb %ch, %cl
2953 ; AVX512BW-NEXT: setnp %al
2954 ; AVX512BW-NEXT: vzeroupper
2955 ; AVX512BW-NEXT: retq
2957 ; AVX512VL-LABEL: icmp_v32i16_v32i1:
2958 ; AVX512VL: # %bb.0:
2959 ; AVX512VL-NEXT: vpcmpeqw %zmm1, %zmm0, %k0
2960 ; AVX512VL-NEXT: kmovd %k0, %eax
2961 ; AVX512VL-NEXT: movl %eax, %ecx
2962 ; AVX512VL-NEXT: shrl $16, %ecx
2963 ; AVX512VL-NEXT: xorl %eax, %ecx
2964 ; AVX512VL-NEXT: xorb %ch, %cl
2965 ; AVX512VL-NEXT: setnp %al
2966 ; AVX512VL-NEXT: vzeroupper
2967 ; AVX512VL-NEXT: retq
2968 %a = icmp eq <32 x i16> %0, %1
2969 %b = call i1 @llvm.vector.reduce.xor.v32i1(<32 x i1> %a)
2973 define i1 @icmp_v64i8_v64i1(<64 x i8>, <64 x i8>) nounwind {
2974 ; X86-SSE2-LABEL: icmp_v64i8_v64i1:
2975 ; X86-SSE2: # %bb.0:
2976 ; X86-SSE2-NEXT: pushl %ebp
2977 ; X86-SSE2-NEXT: movl %esp, %ebp
2978 ; X86-SSE2-NEXT: andl $-16, %esp
2979 ; X86-SSE2-NEXT: subl $16, %esp
2980 ; X86-SSE2-NEXT: movdqa 8(%ebp), %xmm3
2981 ; X86-SSE2-NEXT: pcmpeqb 56(%ebp), %xmm2
2982 ; X86-SSE2-NEXT: pcmpeqb 24(%ebp), %xmm0
2983 ; X86-SSE2-NEXT: pxor %xmm2, %xmm0
2984 ; X86-SSE2-NEXT: pcmpeqb 72(%ebp), %xmm3
2985 ; X86-SSE2-NEXT: pcmpeqb 40(%ebp), %xmm1
2986 ; X86-SSE2-NEXT: pxor %xmm3, %xmm1
2987 ; X86-SSE2-NEXT: pxor %xmm0, %xmm1
2988 ; X86-SSE2-NEXT: pmovmskb %xmm1, %eax
2989 ; X86-SSE2-NEXT: xorb %ah, %al
2990 ; X86-SSE2-NEXT: setnp %al
2991 ; X86-SSE2-NEXT: movl %ebp, %esp
2992 ; X86-SSE2-NEXT: popl %ebp
2993 ; X86-SSE2-NEXT: retl
2995 ; X64-SSE-LABEL: icmp_v64i8_v64i1:
2997 ; X64-SSE-NEXT: pcmpeqb %xmm6, %xmm2
2998 ; X64-SSE-NEXT: pcmpeqb %xmm4, %xmm0
2999 ; X64-SSE-NEXT: pxor %xmm2, %xmm0
3000 ; X64-SSE-NEXT: pcmpeqb %xmm7, %xmm3
3001 ; X64-SSE-NEXT: pcmpeqb %xmm5, %xmm1
3002 ; X64-SSE-NEXT: pxor %xmm3, %xmm1
3003 ; X64-SSE-NEXT: pxor %xmm0, %xmm1
3004 ; X64-SSE-NEXT: pmovmskb %xmm1, %eax
3005 ; X64-SSE-NEXT: xorb %ah, %al
3006 ; X64-SSE-NEXT: setnp %al
3007 ; X64-SSE-NEXT: retq
3009 ; AVX1-LABEL: icmp_v64i8_v64i1:
3011 ; AVX1-NEXT: vpcmpeqb %xmm3, %xmm1, %xmm4
3012 ; AVX1-NEXT: vpcmpeqb %xmm2, %xmm0, %xmm5
3013 ; AVX1-NEXT: vpxor %xmm4, %xmm5, %xmm4
3014 ; AVX1-NEXT: vextractf128 $1, %ymm3, %xmm3
3015 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm1
3016 ; AVX1-NEXT: vpcmpeqb %xmm3, %xmm1, %xmm1
3017 ; AVX1-NEXT: vextractf128 $1, %ymm2, %xmm2
3018 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm0
3019 ; AVX1-NEXT: vpcmpeqb %xmm2, %xmm0, %xmm0
3020 ; AVX1-NEXT: vpxor %xmm1, %xmm0, %xmm0
3021 ; AVX1-NEXT: vpxor %xmm0, %xmm4, %xmm0
3022 ; AVX1-NEXT: vpmovmskb %xmm0, %eax
3023 ; AVX1-NEXT: xorb %ah, %al
3024 ; AVX1-NEXT: setnp %al
3025 ; AVX1-NEXT: vzeroupper
3028 ; AVX2-LABEL: icmp_v64i8_v64i1:
3030 ; AVX2-NEXT: vpcmpeqb %ymm3, %ymm1, %ymm1
3031 ; AVX2-NEXT: vpcmpeqb %ymm2, %ymm0, %ymm0
3032 ; AVX2-NEXT: vpxor %ymm1, %ymm0, %ymm0
3033 ; AVX2-NEXT: vpmovmskb %ymm0, %eax
3034 ; AVX2-NEXT: movl %eax, %ecx
3035 ; AVX2-NEXT: shrl $16, %ecx
3036 ; AVX2-NEXT: xorl %eax, %ecx
3037 ; AVX2-NEXT: xorb %ch, %cl
3038 ; AVX2-NEXT: setnp %al
3039 ; AVX2-NEXT: vzeroupper
3042 ; AVX512F-LABEL: icmp_v64i8_v64i1:
3044 ; AVX512F-NEXT: vextracti64x4 $1, %zmm1, %ymm2
3045 ; AVX512F-NEXT: vextracti64x4 $1, %zmm0, %ymm3
3046 ; AVX512F-NEXT: vpcmpeqb %ymm2, %ymm3, %ymm2
3047 ; AVX512F-NEXT: vpcmpeqb %ymm1, %ymm0, %ymm0
3048 ; AVX512F-NEXT: vextracti128 $1, %ymm2, %xmm1
3049 ; AVX512F-NEXT: vextracti128 $1, %ymm0, %xmm3
3050 ; AVX512F-NEXT: vpxor %xmm1, %xmm3, %xmm1
3051 ; AVX512F-NEXT: vpxor %xmm2, %xmm0, %xmm0
3052 ; AVX512F-NEXT: vpxor %xmm1, %xmm0, %xmm0
3053 ; AVX512F-NEXT: vpmovsxbd %xmm0, %zmm0
3054 ; AVX512F-NEXT: vpslld $31, %zmm0, %zmm0
3055 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
3056 ; AVX512F-NEXT: kshiftrw $8, %k0, %k1
3057 ; AVX512F-NEXT: kxorw %k1, %k0, %k0
3058 ; AVX512F-NEXT: kshiftrw $4, %k0, %k1
3059 ; AVX512F-NEXT: kxorw %k1, %k0, %k0
3060 ; AVX512F-NEXT: kshiftrw $2, %k0, %k1
3061 ; AVX512F-NEXT: kxorw %k1, %k0, %k0
3062 ; AVX512F-NEXT: kshiftrw $1, %k0, %k1
3063 ; AVX512F-NEXT: kxorw %k1, %k0, %k0
3064 ; AVX512F-NEXT: kmovw %k0, %eax
3065 ; AVX512F-NEXT: # kill: def $al killed $al killed $eax
3066 ; AVX512F-NEXT: vzeroupper
3067 ; AVX512F-NEXT: retq
3069 ; AVX512BW-LABEL: icmp_v64i8_v64i1:
3070 ; AVX512BW: # %bb.0:
3071 ; AVX512BW-NEXT: vpcmpeqb %zmm1, %zmm0, %k0
3072 ; AVX512BW-NEXT: kmovq %k0, %rax
3073 ; AVX512BW-NEXT: movq %rax, %rcx
3074 ; AVX512BW-NEXT: shrq $32, %rcx
3075 ; AVX512BW-NEXT: xorl %eax, %ecx
3076 ; AVX512BW-NEXT: movl %ecx, %eax
3077 ; AVX512BW-NEXT: shrl $16, %eax
3078 ; AVX512BW-NEXT: xorl %ecx, %eax
3079 ; AVX512BW-NEXT: xorb %ah, %al
3080 ; AVX512BW-NEXT: setnp %al
3081 ; AVX512BW-NEXT: vzeroupper
3082 ; AVX512BW-NEXT: retq
3084 ; AVX512VL-LABEL: icmp_v64i8_v64i1:
3085 ; AVX512VL: # %bb.0:
3086 ; AVX512VL-NEXT: vpcmpeqb %zmm1, %zmm0, %k0
3087 ; AVX512VL-NEXT: kmovq %k0, %rax
3088 ; AVX512VL-NEXT: movq %rax, %rcx
3089 ; AVX512VL-NEXT: shrq $32, %rcx
3090 ; AVX512VL-NEXT: xorl %eax, %ecx
3091 ; AVX512VL-NEXT: movl %ecx, %eax
3092 ; AVX512VL-NEXT: shrl $16, %eax
3093 ; AVX512VL-NEXT: xorl %ecx, %eax
3094 ; AVX512VL-NEXT: xorb %ah, %al
3095 ; AVX512VL-NEXT: setnp %al
3096 ; AVX512VL-NEXT: vzeroupper
3097 ; AVX512VL-NEXT: retq
3098 %a = icmp eq <64 x i8> %0, %1
3099 %b = call i1 @llvm.vector.reduce.xor.v64i1(<64 x i1> %a)
3103 declare i1 @llvm.vector.reduce.xor.v2i1(<2 x i1>)
3104 declare i1 @llvm.vector.reduce.xor.v4i1(<4 x i1>)
3105 declare i1 @llvm.vector.reduce.xor.v8i1(<8 x i1>)
3106 declare i1 @llvm.vector.reduce.xor.v16i1(<16 x i1>)
3107 declare i1 @llvm.vector.reduce.xor.v32i1(<32 x i1>)
3108 declare i1 @llvm.vector.reduce.xor.v64i1(<64 x i1>)