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,AVX1OR2,AVX1
6 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx2 | FileCheck %s --check-prefixes=AVX,AVX1OR2,AVX2
7 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f | FileCheck %s --check-prefixes=AVX,AVX512,AVX512F
8 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f,+avx512bw | FileCheck %s --check-prefixes=AVX,AVX512,AVX512BW
9 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+avx512f,+avx512bw,+avx512vl | FileCheck %s --check-prefixes=AVX,AVX512,AVX512VL
15 define i1 @trunc_v2i64_v2i1(<2 x i64>) nounwind {
16 ; SSE2-LABEL: trunc_v2i64_v2i1:
18 ; SSE2-NEXT: psllq $63, %xmm0
19 ; SSE2-NEXT: movmskpd %xmm0, %eax
20 ; SSE2-NEXT: testl %eax, %eax
21 ; SSE2-NEXT: setne %al
22 ; SSE2-NEXT: ret{{[l|q]}}
24 ; SSE41-LABEL: trunc_v2i64_v2i1:
26 ; SSE41-NEXT: ptest {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
27 ; SSE41-NEXT: setne %al
30 ; AVX1OR2-LABEL: trunc_v2i64_v2i1:
32 ; AVX1OR2-NEXT: vptest {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
33 ; AVX1OR2-NEXT: setne %al
36 ; AVX512F-LABEL: trunc_v2i64_v2i1:
38 ; AVX512F-NEXT: vptest {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
39 ; AVX512F-NEXT: setne %al
42 ; AVX512BW-LABEL: trunc_v2i64_v2i1:
44 ; AVX512BW-NEXT: vptest {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
45 ; AVX512BW-NEXT: setne %al
48 ; AVX512VL-LABEL: trunc_v2i64_v2i1:
50 ; AVX512VL-NEXT: vpbroadcastq {{.*#+}} xmm1 = [1,1]
51 ; AVX512VL-NEXT: vptest %xmm1, %xmm0
52 ; AVX512VL-NEXT: setne %al
54 %a = trunc <2 x i64> %0 to <2 x i1>
55 %b = call i1 @llvm.vector.reduce.or.v2i1(<2 x i1> %a)
59 define i1 @trunc_v4i32_v4i1(<4 x i32>) nounwind {
60 ; SSE2-LABEL: trunc_v4i32_v4i1:
62 ; SSE2-NEXT: pslld $31, %xmm0
63 ; SSE2-NEXT: movmskps %xmm0, %eax
64 ; SSE2-NEXT: testl %eax, %eax
65 ; SSE2-NEXT: setne %al
66 ; SSE2-NEXT: ret{{[l|q]}}
68 ; SSE41-LABEL: trunc_v4i32_v4i1:
70 ; SSE41-NEXT: ptest {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
71 ; SSE41-NEXT: setne %al
74 ; AVX1OR2-LABEL: trunc_v4i32_v4i1:
76 ; AVX1OR2-NEXT: vptest {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
77 ; AVX1OR2-NEXT: setne %al
80 ; AVX512F-LABEL: trunc_v4i32_v4i1:
82 ; AVX512F-NEXT: vptest {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
83 ; AVX512F-NEXT: setne %al
86 ; AVX512BW-LABEL: trunc_v4i32_v4i1:
88 ; AVX512BW-NEXT: vptest {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
89 ; AVX512BW-NEXT: setne %al
92 ; AVX512VL-LABEL: trunc_v4i32_v4i1:
94 ; AVX512VL-NEXT: vpbroadcastq {{.*#+}} xmm1 = [4294967297,4294967297]
95 ; AVX512VL-NEXT: vptest %xmm1, %xmm0
96 ; AVX512VL-NEXT: setne %al
98 %a = trunc <4 x i32> %0 to <4 x i1>
99 %b = call i1 @llvm.vector.reduce.or.v4i1(<4 x i1> %a)
103 define i1 @trunc_v8i16_v8i1(<8 x i16>) nounwind {
104 ; SSE2-LABEL: trunc_v8i16_v8i1:
106 ; SSE2-NEXT: psllw $7, %xmm0
107 ; SSE2-NEXT: pmovmskb %xmm0, %eax
108 ; SSE2-NEXT: testl $21845, %eax # imm = 0x5555
109 ; SSE2-NEXT: setne %al
110 ; SSE2-NEXT: ret{{[l|q]}}
112 ; SSE41-LABEL: trunc_v8i16_v8i1:
114 ; SSE41-NEXT: ptest {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
115 ; SSE41-NEXT: setne %al
118 ; AVX1OR2-LABEL: trunc_v8i16_v8i1:
120 ; AVX1OR2-NEXT: vptest {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
121 ; AVX1OR2-NEXT: setne %al
124 ; AVX512F-LABEL: trunc_v8i16_v8i1:
126 ; AVX512F-NEXT: vptest {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
127 ; AVX512F-NEXT: setne %al
130 ; AVX512BW-LABEL: trunc_v8i16_v8i1:
132 ; AVX512BW-NEXT: vptest {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
133 ; AVX512BW-NEXT: setne %al
134 ; AVX512BW-NEXT: retq
136 ; AVX512VL-LABEL: trunc_v8i16_v8i1:
138 ; AVX512VL-NEXT: vpbroadcastq {{.*#+}} xmm1 = [281479271743489,281479271743489]
139 ; AVX512VL-NEXT: vptest %xmm1, %xmm0
140 ; AVX512VL-NEXT: setne %al
141 ; AVX512VL-NEXT: retq
142 %a = trunc <8 x i16> %0 to <8 x i1>
143 %b = call i1 @llvm.vector.reduce.or.v8i1(<8 x i1> %a)
147 define i1 @trunc_v16i8_v16i1(<16 x i8>) nounwind {
148 ; SSE2-LABEL: trunc_v16i8_v16i1:
150 ; SSE2-NEXT: psllw $7, %xmm0
151 ; SSE2-NEXT: pmovmskb %xmm0, %eax
152 ; SSE2-NEXT: testl %eax, %eax
153 ; SSE2-NEXT: setne %al
154 ; SSE2-NEXT: ret{{[l|q]}}
156 ; SSE41-LABEL: trunc_v16i8_v16i1:
158 ; SSE41-NEXT: ptest {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
159 ; SSE41-NEXT: setne %al
162 ; AVX1OR2-LABEL: trunc_v16i8_v16i1:
164 ; AVX1OR2-NEXT: vptest {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
165 ; AVX1OR2-NEXT: setne %al
168 ; AVX512F-LABEL: trunc_v16i8_v16i1:
170 ; AVX512F-NEXT: vptest {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
171 ; AVX512F-NEXT: setne %al
174 ; AVX512BW-LABEL: trunc_v16i8_v16i1:
176 ; AVX512BW-NEXT: vptest {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
177 ; AVX512BW-NEXT: setne %al
178 ; AVX512BW-NEXT: retq
180 ; AVX512VL-LABEL: trunc_v16i8_v16i1:
182 ; AVX512VL-NEXT: vpbroadcastq {{.*#+}} xmm1 = [72340172838076673,72340172838076673]
183 ; AVX512VL-NEXT: vptest %xmm1, %xmm0
184 ; AVX512VL-NEXT: setne %al
185 ; AVX512VL-NEXT: retq
186 %a = trunc <16 x i8> %0 to <16 x i1>
187 %b = call i1 @llvm.vector.reduce.or.v16i1(<16 x i1> %a)
191 define i1 @trunc_v4i64_v4i1(<4 x i64>) nounwind {
192 ; SSE2-LABEL: trunc_v4i64_v4i1:
194 ; SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,2],xmm1[0,2]
195 ; SSE2-NEXT: pslld $31, %xmm0
196 ; SSE2-NEXT: movmskps %xmm0, %eax
197 ; SSE2-NEXT: testl %eax, %eax
198 ; SSE2-NEXT: setne %al
199 ; SSE2-NEXT: ret{{[l|q]}}
201 ; SSE41-LABEL: trunc_v4i64_v4i1:
203 ; SSE41-NEXT: por %xmm1, %xmm0
204 ; SSE41-NEXT: ptest {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
205 ; SSE41-NEXT: setne %al
208 ; AVX1-LABEL: trunc_v4i64_v4i1:
210 ; AVX1-NEXT: vptest {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %ymm0
211 ; AVX1-NEXT: setne %al
212 ; AVX1-NEXT: vzeroupper
215 ; AVX2-LABEL: trunc_v4i64_v4i1:
217 ; AVX2-NEXT: vpbroadcastq {{.*#+}} ymm1 = [1,1,1,1]
218 ; AVX2-NEXT: vptest %ymm1, %ymm0
219 ; AVX2-NEXT: setne %al
220 ; AVX2-NEXT: vzeroupper
223 ; AVX512-LABEL: trunc_v4i64_v4i1:
225 ; AVX512-NEXT: vpbroadcastq {{.*#+}} ymm1 = [1,1,1,1]
226 ; AVX512-NEXT: vptest %ymm1, %ymm0
227 ; AVX512-NEXT: setne %al
228 ; AVX512-NEXT: vzeroupper
230 %a = trunc <4 x i64> %0 to <4 x i1>
231 %b = call i1 @llvm.vector.reduce.or.v4i1(<4 x i1> %a)
235 define i1 @trunc_v8i32_v8i1(<8 x i32>) nounwind {
236 ; SSE2-LABEL: trunc_v8i32_v8i1:
238 ; SSE2-NEXT: por %xmm1, %xmm0
239 ; SSE2-NEXT: pslld $31, %xmm0
240 ; SSE2-NEXT: movmskps %xmm0, %eax
241 ; SSE2-NEXT: testl %eax, %eax
242 ; SSE2-NEXT: setne %al
243 ; SSE2-NEXT: ret{{[l|q]}}
245 ; SSE41-LABEL: trunc_v8i32_v8i1:
247 ; SSE41-NEXT: por %xmm1, %xmm0
248 ; SSE41-NEXT: ptest {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
249 ; SSE41-NEXT: setne %al
252 ; AVX1-LABEL: trunc_v8i32_v8i1:
254 ; AVX1-NEXT: vptest {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %ymm0
255 ; AVX1-NEXT: setne %al
256 ; AVX1-NEXT: vzeroupper
259 ; AVX2-LABEL: trunc_v8i32_v8i1:
261 ; AVX2-NEXT: vpbroadcastq {{.*#+}} ymm1 = [4294967297,4294967297,4294967297,4294967297]
262 ; AVX2-NEXT: vptest %ymm1, %ymm0
263 ; AVX2-NEXT: setne %al
264 ; AVX2-NEXT: vzeroupper
267 ; AVX512-LABEL: trunc_v8i32_v8i1:
269 ; AVX512-NEXT: vpbroadcastq {{.*#+}} ymm1 = [4294967297,4294967297,4294967297,4294967297]
270 ; AVX512-NEXT: vptest %ymm1, %ymm0
271 ; AVX512-NEXT: setne %al
272 ; AVX512-NEXT: vzeroupper
274 %a = trunc <8 x i32> %0 to <8 x i1>
275 %b = call i1 @llvm.vector.reduce.or.v8i1(<8 x i1> %a)
279 define i1 @trunc_v16i16_v16i1(<16 x i16>) nounwind {
280 ; SSE2-LABEL: trunc_v16i16_v16i1:
282 ; SSE2-NEXT: por %xmm1, %xmm0
283 ; SSE2-NEXT: psllw $7, %xmm0
284 ; SSE2-NEXT: pmovmskb %xmm0, %eax
285 ; SSE2-NEXT: testl $21845, %eax # imm = 0x5555
286 ; SSE2-NEXT: setne %al
287 ; SSE2-NEXT: ret{{[l|q]}}
289 ; SSE41-LABEL: trunc_v16i16_v16i1:
291 ; SSE41-NEXT: por %xmm1, %xmm0
292 ; SSE41-NEXT: ptest {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
293 ; SSE41-NEXT: setne %al
296 ; AVX1-LABEL: trunc_v16i16_v16i1:
298 ; AVX1-NEXT: vptest {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %ymm0
299 ; AVX1-NEXT: setne %al
300 ; AVX1-NEXT: vzeroupper
303 ; AVX2-LABEL: trunc_v16i16_v16i1:
305 ; AVX2-NEXT: vpbroadcastq {{.*#+}} ymm1 = [281479271743489,281479271743489,281479271743489,281479271743489]
306 ; AVX2-NEXT: vptest %ymm1, %ymm0
307 ; AVX2-NEXT: setne %al
308 ; AVX2-NEXT: vzeroupper
311 ; AVX512-LABEL: trunc_v16i16_v16i1:
313 ; AVX512-NEXT: vpbroadcastq {{.*#+}} ymm1 = [281479271743489,281479271743489,281479271743489,281479271743489]
314 ; AVX512-NEXT: vptest %ymm1, %ymm0
315 ; AVX512-NEXT: setne %al
316 ; AVX512-NEXT: vzeroupper
318 %a = trunc <16 x i16> %0 to <16 x i1>
319 %b = call i1 @llvm.vector.reduce.or.v16i1(<16 x i1> %a)
323 define i1 @trunc_v32i8_v32i1(<32 x i8>) nounwind {
324 ; SSE2-LABEL: trunc_v32i8_v32i1:
326 ; SSE2-NEXT: por %xmm1, %xmm0
327 ; SSE2-NEXT: psllw $7, %xmm0
328 ; SSE2-NEXT: pmovmskb %xmm0, %eax
329 ; SSE2-NEXT: testl %eax, %eax
330 ; SSE2-NEXT: setne %al
331 ; SSE2-NEXT: ret{{[l|q]}}
333 ; SSE41-LABEL: trunc_v32i8_v32i1:
335 ; SSE41-NEXT: por %xmm1, %xmm0
336 ; SSE41-NEXT: ptest {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
337 ; SSE41-NEXT: setne %al
340 ; AVX1-LABEL: trunc_v32i8_v32i1:
342 ; AVX1-NEXT: vptest {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %ymm0
343 ; AVX1-NEXT: setne %al
344 ; AVX1-NEXT: vzeroupper
347 ; AVX2-LABEL: trunc_v32i8_v32i1:
349 ; AVX2-NEXT: vpbroadcastq {{.*#+}} ymm1 = [72340172838076673,72340172838076673,72340172838076673,72340172838076673]
350 ; AVX2-NEXT: vptest %ymm1, %ymm0
351 ; AVX2-NEXT: setne %al
352 ; AVX2-NEXT: vzeroupper
355 ; AVX512-LABEL: trunc_v32i8_v32i1:
357 ; AVX512-NEXT: vpbroadcastq {{.*#+}} ymm1 = [72340172838076673,72340172838076673,72340172838076673,72340172838076673]
358 ; AVX512-NEXT: vptest %ymm1, %ymm0
359 ; AVX512-NEXT: setne %al
360 ; AVX512-NEXT: vzeroupper
362 %a = trunc <32 x i8> %0 to <32 x i1>
363 %b = call i1 @llvm.vector.reduce.or.v32i1(<32 x i1> %a)
367 define i1 @trunc_v8i64_v8i1(<8 x i64>) nounwind {
368 ; X86-SSE2-LABEL: trunc_v8i64_v8i1:
370 ; X86-SSE2-NEXT: pushl %ebp
371 ; X86-SSE2-NEXT: movl %esp, %ebp
372 ; X86-SSE2-NEXT: andl $-16, %esp
373 ; X86-SSE2-NEXT: subl $16, %esp
374 ; X86-SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,2],xmm1[0,2]
375 ; X86-SSE2-NEXT: pslld $16, %xmm0
376 ; X86-SSE2-NEXT: psrad $16, %xmm0
377 ; X86-SSE2-NEXT: shufps {{.*#+}} xmm2 = xmm2[0,2],mem[0,2]
378 ; X86-SSE2-NEXT: pslld $16, %xmm2
379 ; X86-SSE2-NEXT: psrad $16, %xmm2
380 ; X86-SSE2-NEXT: packssdw %xmm2, %xmm0
381 ; X86-SSE2-NEXT: psllw $15, %xmm0
382 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
383 ; X86-SSE2-NEXT: testl $43690, %eax # imm = 0xAAAA
384 ; X86-SSE2-NEXT: setne %al
385 ; X86-SSE2-NEXT: movl %ebp, %esp
386 ; X86-SSE2-NEXT: popl %ebp
387 ; X86-SSE2-NEXT: retl
389 ; X64-SSE2-LABEL: trunc_v8i64_v8i1:
391 ; X64-SSE2-NEXT: shufps {{.*#+}} xmm2 = xmm2[0,2],xmm3[0,2]
392 ; X64-SSE2-NEXT: pslld $16, %xmm2
393 ; X64-SSE2-NEXT: psrad $16, %xmm2
394 ; X64-SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,2],xmm1[0,2]
395 ; X64-SSE2-NEXT: pslld $16, %xmm0
396 ; X64-SSE2-NEXT: psrad $16, %xmm0
397 ; X64-SSE2-NEXT: packssdw %xmm2, %xmm0
398 ; X64-SSE2-NEXT: psllw $15, %xmm0
399 ; X64-SSE2-NEXT: pmovmskb %xmm0, %eax
400 ; X64-SSE2-NEXT: testl $43690, %eax # imm = 0xAAAA
401 ; X64-SSE2-NEXT: setne %al
402 ; X64-SSE2-NEXT: retq
404 ; SSE41-LABEL: trunc_v8i64_v8i1:
406 ; SSE41-NEXT: por %xmm3, %xmm1
407 ; SSE41-NEXT: por %xmm2, %xmm0
408 ; SSE41-NEXT: por %xmm1, %xmm0
409 ; SSE41-NEXT: ptest {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
410 ; SSE41-NEXT: setne %al
413 ; AVX1-LABEL: trunc_v8i64_v8i1:
415 ; AVX1-NEXT: vorps %ymm1, %ymm0, %ymm0
416 ; AVX1-NEXT: vptest {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %ymm0
417 ; AVX1-NEXT: setne %al
418 ; AVX1-NEXT: vzeroupper
421 ; AVX2-LABEL: trunc_v8i64_v8i1:
423 ; AVX2-NEXT: vpor %ymm1, %ymm0, %ymm0
424 ; AVX2-NEXT: vpbroadcastq {{.*#+}} ymm1 = [1,1,1,1]
425 ; AVX2-NEXT: vptest %ymm1, %ymm0
426 ; AVX2-NEXT: setne %al
427 ; AVX2-NEXT: vzeroupper
430 ; AVX512-LABEL: trunc_v8i64_v8i1:
432 ; AVX512-NEXT: vpbroadcastq {{.*#+}} zmm1 = [1,1,1,1,1,1,1,1]
433 ; AVX512-NEXT: vptestmd %zmm1, %zmm0, %k0
434 ; AVX512-NEXT: kortestw %k0, %k0
435 ; AVX512-NEXT: setne %al
436 ; AVX512-NEXT: vzeroupper
438 %a = trunc <8 x i64> %0 to <8 x i1>
439 %b = call i1 @llvm.vector.reduce.or.v8i1(<8 x i1> %a)
443 define i1 @trunc_v16i32_v16i1(<16 x i32>) nounwind {
444 ; X86-SSE2-LABEL: trunc_v16i32_v16i1:
446 ; X86-SSE2-NEXT: pushl %ebp
447 ; X86-SSE2-NEXT: movl %esp, %ebp
448 ; X86-SSE2-NEXT: andl $-16, %esp
449 ; X86-SSE2-NEXT: subl $16, %esp
450 ; X86-SSE2-NEXT: por %xmm2, %xmm0
451 ; X86-SSE2-NEXT: por 8(%ebp), %xmm1
452 ; X86-SSE2-NEXT: por %xmm0, %xmm1
453 ; X86-SSE2-NEXT: pslld $31, %xmm1
454 ; X86-SSE2-NEXT: movmskps %xmm1, %eax
455 ; X86-SSE2-NEXT: testl %eax, %eax
456 ; X86-SSE2-NEXT: setne %al
457 ; X86-SSE2-NEXT: movl %ebp, %esp
458 ; X86-SSE2-NEXT: popl %ebp
459 ; X86-SSE2-NEXT: retl
461 ; X64-SSE2-LABEL: trunc_v16i32_v16i1:
463 ; X64-SSE2-NEXT: por %xmm3, %xmm1
464 ; X64-SSE2-NEXT: por %xmm2, %xmm0
465 ; X64-SSE2-NEXT: por %xmm1, %xmm0
466 ; X64-SSE2-NEXT: pslld $31, %xmm0
467 ; X64-SSE2-NEXT: movmskps %xmm0, %eax
468 ; X64-SSE2-NEXT: testl %eax, %eax
469 ; X64-SSE2-NEXT: setne %al
470 ; X64-SSE2-NEXT: retq
472 ; SSE41-LABEL: trunc_v16i32_v16i1:
474 ; SSE41-NEXT: por %xmm3, %xmm1
475 ; SSE41-NEXT: por %xmm2, %xmm0
476 ; SSE41-NEXT: por %xmm1, %xmm0
477 ; SSE41-NEXT: ptest {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
478 ; SSE41-NEXT: setne %al
481 ; AVX1-LABEL: trunc_v16i32_v16i1:
483 ; AVX1-NEXT: vorps %ymm1, %ymm0, %ymm0
484 ; AVX1-NEXT: vptest {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %ymm0
485 ; AVX1-NEXT: setne %al
486 ; AVX1-NEXT: vzeroupper
489 ; AVX2-LABEL: trunc_v16i32_v16i1:
491 ; AVX2-NEXT: vpor %ymm1, %ymm0, %ymm0
492 ; AVX2-NEXT: vpbroadcastq {{.*#+}} ymm1 = [4294967297,4294967297,4294967297,4294967297]
493 ; AVX2-NEXT: vptest %ymm1, %ymm0
494 ; AVX2-NEXT: setne %al
495 ; AVX2-NEXT: vzeroupper
498 ; AVX512-LABEL: trunc_v16i32_v16i1:
500 ; AVX512-NEXT: vptestmd {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to16}, %zmm0, %k0
501 ; AVX512-NEXT: kortestw %k0, %k0
502 ; AVX512-NEXT: setne %al
503 ; AVX512-NEXT: vzeroupper
505 %a = trunc <16 x i32> %0 to <16 x i1>
506 %b = call i1 @llvm.vector.reduce.or.v16i1(<16 x i1> %a)
510 define i1 @trunc_v32i16_v32i1(<32 x i16>) nounwind {
511 ; X86-SSE2-LABEL: trunc_v32i16_v32i1:
513 ; X86-SSE2-NEXT: pushl %ebp
514 ; X86-SSE2-NEXT: movl %esp, %ebp
515 ; X86-SSE2-NEXT: andl $-16, %esp
516 ; X86-SSE2-NEXT: subl $16, %esp
517 ; X86-SSE2-NEXT: por %xmm2, %xmm0
518 ; X86-SSE2-NEXT: por 8(%ebp), %xmm1
519 ; X86-SSE2-NEXT: por %xmm0, %xmm1
520 ; X86-SSE2-NEXT: psllw $7, %xmm1
521 ; X86-SSE2-NEXT: pmovmskb %xmm1, %eax
522 ; X86-SSE2-NEXT: testl $21845, %eax # imm = 0x5555
523 ; X86-SSE2-NEXT: setne %al
524 ; X86-SSE2-NEXT: movl %ebp, %esp
525 ; X86-SSE2-NEXT: popl %ebp
526 ; X86-SSE2-NEXT: retl
528 ; X64-SSE2-LABEL: trunc_v32i16_v32i1:
530 ; X64-SSE2-NEXT: por %xmm3, %xmm1
531 ; X64-SSE2-NEXT: por %xmm2, %xmm0
532 ; X64-SSE2-NEXT: por %xmm1, %xmm0
533 ; X64-SSE2-NEXT: psllw $7, %xmm0
534 ; X64-SSE2-NEXT: pmovmskb %xmm0, %eax
535 ; X64-SSE2-NEXT: testl $21845, %eax # imm = 0x5555
536 ; X64-SSE2-NEXT: setne %al
537 ; X64-SSE2-NEXT: retq
539 ; SSE41-LABEL: trunc_v32i16_v32i1:
541 ; SSE41-NEXT: por %xmm3, %xmm1
542 ; SSE41-NEXT: por %xmm2, %xmm0
543 ; SSE41-NEXT: por %xmm1, %xmm0
544 ; SSE41-NEXT: ptest {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
545 ; SSE41-NEXT: setne %al
548 ; AVX1-LABEL: trunc_v32i16_v32i1:
550 ; AVX1-NEXT: vorps %ymm1, %ymm0, %ymm0
551 ; AVX1-NEXT: vptest {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %ymm0
552 ; AVX1-NEXT: setne %al
553 ; AVX1-NEXT: vzeroupper
556 ; AVX2-LABEL: trunc_v32i16_v32i1:
558 ; AVX2-NEXT: vpor %ymm1, %ymm0, %ymm0
559 ; AVX2-NEXT: vpbroadcastq {{.*#+}} ymm1 = [281479271743489,281479271743489,281479271743489,281479271743489]
560 ; AVX2-NEXT: vptest %ymm1, %ymm0
561 ; AVX2-NEXT: setne %al
562 ; AVX2-NEXT: vzeroupper
565 ; AVX512-LABEL: trunc_v32i16_v32i1:
567 ; AVX512-NEXT: vptestmd {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to16}, %zmm0, %k0
568 ; AVX512-NEXT: kortestw %k0, %k0
569 ; AVX512-NEXT: setne %al
570 ; AVX512-NEXT: vzeroupper
572 %a = trunc <32 x i16> %0 to <32 x i1>
573 %b = call i1 @llvm.vector.reduce.or.v32i1(<32 x i1> %a)
577 define i1 @trunc_v64i8_v64i1(<64 x i8>) nounwind {
578 ; X86-SSE2-LABEL: trunc_v64i8_v64i1:
580 ; X86-SSE2-NEXT: pushl %ebp
581 ; X86-SSE2-NEXT: movl %esp, %ebp
582 ; X86-SSE2-NEXT: andl $-16, %esp
583 ; X86-SSE2-NEXT: subl $16, %esp
584 ; X86-SSE2-NEXT: por %xmm2, %xmm0
585 ; X86-SSE2-NEXT: por 8(%ebp), %xmm1
586 ; X86-SSE2-NEXT: por %xmm0, %xmm1
587 ; X86-SSE2-NEXT: psllw $7, %xmm1
588 ; X86-SSE2-NEXT: pmovmskb %xmm1, %eax
589 ; X86-SSE2-NEXT: testl %eax, %eax
590 ; X86-SSE2-NEXT: setne %al
591 ; X86-SSE2-NEXT: movl %ebp, %esp
592 ; X86-SSE2-NEXT: popl %ebp
593 ; X86-SSE2-NEXT: retl
595 ; X64-SSE2-LABEL: trunc_v64i8_v64i1:
597 ; X64-SSE2-NEXT: por %xmm3, %xmm1
598 ; X64-SSE2-NEXT: por %xmm2, %xmm0
599 ; X64-SSE2-NEXT: por %xmm1, %xmm0
600 ; X64-SSE2-NEXT: psllw $7, %xmm0
601 ; X64-SSE2-NEXT: pmovmskb %xmm0, %eax
602 ; X64-SSE2-NEXT: testl %eax, %eax
603 ; X64-SSE2-NEXT: setne %al
604 ; X64-SSE2-NEXT: retq
606 ; SSE41-LABEL: trunc_v64i8_v64i1:
608 ; SSE41-NEXT: por %xmm3, %xmm1
609 ; SSE41-NEXT: por %xmm2, %xmm0
610 ; SSE41-NEXT: por %xmm1, %xmm0
611 ; SSE41-NEXT: ptest {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
612 ; SSE41-NEXT: setne %al
615 ; AVX1-LABEL: trunc_v64i8_v64i1:
617 ; AVX1-NEXT: vorps %ymm1, %ymm0, %ymm0
618 ; AVX1-NEXT: vptest {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %ymm0
619 ; AVX1-NEXT: setne %al
620 ; AVX1-NEXT: vzeroupper
623 ; AVX2-LABEL: trunc_v64i8_v64i1:
625 ; AVX2-NEXT: vpor %ymm1, %ymm0, %ymm0
626 ; AVX2-NEXT: vpbroadcastq {{.*#+}} ymm1 = [72340172838076673,72340172838076673,72340172838076673,72340172838076673]
627 ; AVX2-NEXT: vptest %ymm1, %ymm0
628 ; AVX2-NEXT: setne %al
629 ; AVX2-NEXT: vzeroupper
632 ; AVX512-LABEL: trunc_v64i8_v64i1:
634 ; AVX512-NEXT: vptestmd {{\.?LCPI[0-9]+_[0-9]+}}(%rip){1to16}, %zmm0, %k0
635 ; AVX512-NEXT: kortestw %k0, %k0
636 ; AVX512-NEXT: setne %al
637 ; AVX512-NEXT: vzeroupper
639 %a = trunc <64 x i8> %0 to <64 x i1>
640 %b = call i1 @llvm.vector.reduce.or.v64i1(<64 x i1> %a)
645 ; Comparison With Zero
648 define i1 @icmp0_v2i64_v2i1(<2 x i64>) nounwind {
649 ; SSE2-LABEL: icmp0_v2i64_v2i1:
651 ; SSE2-NEXT: pxor %xmm1, %xmm1
652 ; SSE2-NEXT: pcmpeqd %xmm0, %xmm1
653 ; SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm1[1,0,3,2]
654 ; SSE2-NEXT: pand %xmm1, %xmm0
655 ; SSE2-NEXT: movmskpd %xmm0, %eax
656 ; SSE2-NEXT: testl %eax, %eax
657 ; SSE2-NEXT: setne %al
658 ; SSE2-NEXT: ret{{[l|q]}}
660 ; SSE41-LABEL: icmp0_v2i64_v2i1:
662 ; SSE41-NEXT: pxor %xmm1, %xmm1
663 ; SSE41-NEXT: pcmpeqq %xmm0, %xmm1
664 ; SSE41-NEXT: movmskpd %xmm1, %eax
665 ; SSE41-NEXT: testl %eax, %eax
666 ; SSE41-NEXT: setne %al
669 ; AVX1OR2-LABEL: icmp0_v2i64_v2i1:
671 ; AVX1OR2-NEXT: vpxor %xmm1, %xmm1, %xmm1
672 ; AVX1OR2-NEXT: vpcmpeqq %xmm1, %xmm0, %xmm0
673 ; AVX1OR2-NEXT: vtestpd %xmm0, %xmm0
674 ; AVX1OR2-NEXT: setne %al
677 ; AVX512F-LABEL: icmp0_v2i64_v2i1:
679 ; AVX512F-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
680 ; AVX512F-NEXT: vptestnmq %zmm0, %zmm0, %k0
681 ; AVX512F-NEXT: kmovw %k0, %eax
682 ; AVX512F-NEXT: testb $3, %al
683 ; AVX512F-NEXT: setne %al
684 ; AVX512F-NEXT: vzeroupper
687 ; AVX512BW-LABEL: icmp0_v2i64_v2i1:
689 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
690 ; AVX512BW-NEXT: vptestnmq %zmm0, %zmm0, %k0
691 ; AVX512BW-NEXT: kmovd %k0, %eax
692 ; AVX512BW-NEXT: testb $3, %al
693 ; AVX512BW-NEXT: setne %al
694 ; AVX512BW-NEXT: vzeroupper
695 ; AVX512BW-NEXT: retq
697 ; AVX512VL-LABEL: icmp0_v2i64_v2i1:
699 ; AVX512VL-NEXT: vptestnmq %xmm0, %xmm0, %k0
700 ; AVX512VL-NEXT: kmovd %k0, %eax
701 ; AVX512VL-NEXT: testb %al, %al
702 ; AVX512VL-NEXT: setne %al
703 ; AVX512VL-NEXT: retq
704 %a = icmp eq <2 x i64> %0, zeroinitializer
705 %b = call i1 @llvm.vector.reduce.or.v2i1(<2 x i1> %a)
709 define i1 @icmp0_v4i32_v4i1(<4 x i32>) nounwind {
710 ; SSE-LABEL: icmp0_v4i32_v4i1:
712 ; SSE-NEXT: pxor %xmm1, %xmm1
713 ; SSE-NEXT: pcmpeqd %xmm0, %xmm1
714 ; SSE-NEXT: movmskps %xmm1, %eax
715 ; SSE-NEXT: testl %eax, %eax
716 ; SSE-NEXT: setne %al
717 ; SSE-NEXT: ret{{[l|q]}}
719 ; AVX1OR2-LABEL: icmp0_v4i32_v4i1:
721 ; AVX1OR2-NEXT: vpxor %xmm1, %xmm1, %xmm1
722 ; AVX1OR2-NEXT: vpcmpeqd %xmm1, %xmm0, %xmm0
723 ; AVX1OR2-NEXT: vtestps %xmm0, %xmm0
724 ; AVX1OR2-NEXT: setne %al
727 ; AVX512F-LABEL: icmp0_v4i32_v4i1:
729 ; AVX512F-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
730 ; AVX512F-NEXT: vptestnmd %zmm0, %zmm0, %k0
731 ; AVX512F-NEXT: kmovw %k0, %eax
732 ; AVX512F-NEXT: testb $15, %al
733 ; AVX512F-NEXT: setne %al
734 ; AVX512F-NEXT: vzeroupper
737 ; AVX512BW-LABEL: icmp0_v4i32_v4i1:
739 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
740 ; AVX512BW-NEXT: vptestnmd %zmm0, %zmm0, %k0
741 ; AVX512BW-NEXT: kmovd %k0, %eax
742 ; AVX512BW-NEXT: testb $15, %al
743 ; AVX512BW-NEXT: setne %al
744 ; AVX512BW-NEXT: vzeroupper
745 ; AVX512BW-NEXT: retq
747 ; AVX512VL-LABEL: icmp0_v4i32_v4i1:
749 ; AVX512VL-NEXT: vptestnmd %xmm0, %xmm0, %k0
750 ; AVX512VL-NEXT: kmovd %k0, %eax
751 ; AVX512VL-NEXT: testb %al, %al
752 ; AVX512VL-NEXT: setne %al
753 ; AVX512VL-NEXT: retq
754 %a = icmp eq <4 x i32> %0, zeroinitializer
755 %b = call i1 @llvm.vector.reduce.or.v4i1(<4 x i1> %a)
759 define i1 @icmp0_v8i16_v8i1(<8 x i16>) nounwind {
760 ; SSE-LABEL: icmp0_v8i16_v8i1:
762 ; SSE-NEXT: pxor %xmm1, %xmm1
763 ; SSE-NEXT: pcmpeqw %xmm0, %xmm1
764 ; SSE-NEXT: pmovmskb %xmm1, %eax
765 ; SSE-NEXT: testl %eax, %eax
766 ; SSE-NEXT: setne %al
767 ; SSE-NEXT: ret{{[l|q]}}
769 ; AVX1OR2-LABEL: icmp0_v8i16_v8i1:
771 ; AVX1OR2-NEXT: vpxor %xmm1, %xmm1, %xmm1
772 ; AVX1OR2-NEXT: vpcmpeqw %xmm1, %xmm0, %xmm0
773 ; AVX1OR2-NEXT: vpmovmskb %xmm0, %eax
774 ; AVX1OR2-NEXT: testl %eax, %eax
775 ; AVX1OR2-NEXT: setne %al
778 ; AVX512F-LABEL: icmp0_v8i16_v8i1:
780 ; AVX512F-NEXT: vpxor %xmm1, %xmm1, %xmm1
781 ; AVX512F-NEXT: vpcmpeqw %xmm1, %xmm0, %xmm0
782 ; AVX512F-NEXT: vpmovsxwq %xmm0, %zmm0
783 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
784 ; AVX512F-NEXT: kortestw %k0, %k0
785 ; AVX512F-NEXT: setne %al
786 ; AVX512F-NEXT: vzeroupper
789 ; AVX512BW-LABEL: icmp0_v8i16_v8i1:
791 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
792 ; AVX512BW-NEXT: vptestnmw %zmm0, %zmm0, %k0
793 ; AVX512BW-NEXT: kmovd %k0, %eax
794 ; AVX512BW-NEXT: testb %al, %al
795 ; AVX512BW-NEXT: setne %al
796 ; AVX512BW-NEXT: vzeroupper
797 ; AVX512BW-NEXT: retq
799 ; AVX512VL-LABEL: icmp0_v8i16_v8i1:
801 ; AVX512VL-NEXT: vptestnmw %xmm0, %xmm0, %k0
802 ; AVX512VL-NEXT: kmovd %k0, %eax
803 ; AVX512VL-NEXT: testb %al, %al
804 ; AVX512VL-NEXT: setne %al
805 ; AVX512VL-NEXT: retq
806 %a = icmp eq <8 x i16> %0, zeroinitializer
807 %b = call i1 @llvm.vector.reduce.or.v8i1(<8 x i1> %a)
811 define i1 @icmp0_v16i8_v16i1(<16 x i8>) nounwind {
812 ; SSE-LABEL: icmp0_v16i8_v16i1:
814 ; SSE-NEXT: pxor %xmm1, %xmm1
815 ; SSE-NEXT: pcmpeqb %xmm0, %xmm1
816 ; SSE-NEXT: pmovmskb %xmm1, %eax
817 ; SSE-NEXT: testl %eax, %eax
818 ; SSE-NEXT: setne %al
819 ; SSE-NEXT: ret{{[l|q]}}
821 ; AVX1OR2-LABEL: icmp0_v16i8_v16i1:
823 ; AVX1OR2-NEXT: vpxor %xmm1, %xmm1, %xmm1
824 ; AVX1OR2-NEXT: vpcmpeqb %xmm1, %xmm0, %xmm0
825 ; AVX1OR2-NEXT: vpmovmskb %xmm0, %eax
826 ; AVX1OR2-NEXT: testl %eax, %eax
827 ; AVX1OR2-NEXT: setne %al
830 ; AVX512F-LABEL: icmp0_v16i8_v16i1:
832 ; AVX512F-NEXT: vpxor %xmm1, %xmm1, %xmm1
833 ; AVX512F-NEXT: vpcmpeqb %xmm1, %xmm0, %xmm0
834 ; AVX512F-NEXT: vpmovmskb %xmm0, %eax
835 ; AVX512F-NEXT: testl %eax, %eax
836 ; AVX512F-NEXT: setne %al
839 ; AVX512BW-LABEL: icmp0_v16i8_v16i1:
841 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
842 ; AVX512BW-NEXT: vptestnmb %zmm0, %zmm0, %k0
843 ; AVX512BW-NEXT: kortestw %k0, %k0
844 ; AVX512BW-NEXT: setne %al
845 ; AVX512BW-NEXT: vzeroupper
846 ; AVX512BW-NEXT: retq
848 ; AVX512VL-LABEL: icmp0_v16i8_v16i1:
850 ; AVX512VL-NEXT: vptestnmb %xmm0, %xmm0, %k0
851 ; AVX512VL-NEXT: kortestw %k0, %k0
852 ; AVX512VL-NEXT: setne %al
853 ; AVX512VL-NEXT: retq
854 %a = icmp eq <16 x i8> %0, zeroinitializer
855 %b = call i1 @llvm.vector.reduce.or.v16i1(<16 x i1> %a)
859 define i1 @icmp0_v4i64_v4i1(<4 x i64>) nounwind {
860 ; SSE2-LABEL: icmp0_v4i64_v4i1:
862 ; SSE2-NEXT: pxor %xmm2, %xmm2
863 ; SSE2-NEXT: pcmpeqd %xmm2, %xmm1
864 ; SSE2-NEXT: pcmpeqd %xmm2, %xmm0
865 ; SSE2-NEXT: movdqa %xmm0, %xmm2
866 ; SSE2-NEXT: shufps {{.*#+}} xmm2 = xmm2[1,3],xmm1[1,3]
867 ; SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,2],xmm1[0,2]
868 ; SSE2-NEXT: andps %xmm2, %xmm0
869 ; SSE2-NEXT: movmskps %xmm0, %eax
870 ; SSE2-NEXT: testl %eax, %eax
871 ; SSE2-NEXT: setne %al
872 ; SSE2-NEXT: ret{{[l|q]}}
874 ; SSE41-LABEL: icmp0_v4i64_v4i1:
876 ; SSE41-NEXT: pxor %xmm2, %xmm2
877 ; SSE41-NEXT: pcmpeqq %xmm2, %xmm1
878 ; SSE41-NEXT: pcmpeqq %xmm2, %xmm0
879 ; SSE41-NEXT: packssdw %xmm1, %xmm0
880 ; SSE41-NEXT: movmskps %xmm0, %eax
881 ; SSE41-NEXT: testl %eax, %eax
882 ; SSE41-NEXT: setne %al
885 ; AVX1-LABEL: icmp0_v4i64_v4i1:
887 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
888 ; AVX1-NEXT: vpxor %xmm2, %xmm2, %xmm2
889 ; AVX1-NEXT: vpcmpeqq %xmm2, %xmm1, %xmm1
890 ; AVX1-NEXT: vpcmpeqq %xmm2, %xmm0, %xmm0
891 ; AVX1-NEXT: vpor %xmm1, %xmm0, %xmm0
892 ; AVX1-NEXT: vtestpd %xmm0, %xmm0
893 ; AVX1-NEXT: setne %al
894 ; AVX1-NEXT: vzeroupper
897 ; AVX2-LABEL: icmp0_v4i64_v4i1:
899 ; AVX2-NEXT: vpxor %xmm1, %xmm1, %xmm1
900 ; AVX2-NEXT: vpcmpeqq %ymm1, %ymm0, %ymm0
901 ; AVX2-NEXT: vtestpd %ymm0, %ymm0
902 ; AVX2-NEXT: setne %al
903 ; AVX2-NEXT: vzeroupper
906 ; AVX512F-LABEL: icmp0_v4i64_v4i1:
908 ; AVX512F-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
909 ; AVX512F-NEXT: vptestnmq %zmm0, %zmm0, %k0
910 ; AVX512F-NEXT: kmovw %k0, %eax
911 ; AVX512F-NEXT: testb $15, %al
912 ; AVX512F-NEXT: setne %al
913 ; AVX512F-NEXT: vzeroupper
916 ; AVX512BW-LABEL: icmp0_v4i64_v4i1:
918 ; AVX512BW-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
919 ; AVX512BW-NEXT: vptestnmq %zmm0, %zmm0, %k0
920 ; AVX512BW-NEXT: kmovd %k0, %eax
921 ; AVX512BW-NEXT: testb $15, %al
922 ; AVX512BW-NEXT: setne %al
923 ; AVX512BW-NEXT: vzeroupper
924 ; AVX512BW-NEXT: retq
926 ; AVX512VL-LABEL: icmp0_v4i64_v4i1:
928 ; AVX512VL-NEXT: vptestnmq %ymm0, %ymm0, %k0
929 ; AVX512VL-NEXT: kmovd %k0, %eax
930 ; AVX512VL-NEXT: testb %al, %al
931 ; AVX512VL-NEXT: setne %al
932 ; AVX512VL-NEXT: vzeroupper
933 ; AVX512VL-NEXT: retq
934 %a = icmp eq <4 x i64> %0, zeroinitializer
935 %b = call i1 @llvm.vector.reduce.or.v4i1(<4 x i1> %a)
939 define i1 @icmp0_v8i32_v8i1(<8 x i32>) nounwind {
940 ; SSE-LABEL: icmp0_v8i32_v8i1:
942 ; SSE-NEXT: pxor %xmm2, %xmm2
943 ; SSE-NEXT: pcmpeqd %xmm2, %xmm1
944 ; SSE-NEXT: pcmpeqd %xmm2, %xmm0
945 ; SSE-NEXT: packssdw %xmm1, %xmm0
946 ; SSE-NEXT: pmovmskb %xmm0, %eax
947 ; SSE-NEXT: testl %eax, %eax
948 ; SSE-NEXT: setne %al
949 ; SSE-NEXT: ret{{[l|q]}}
951 ; AVX1-LABEL: icmp0_v8i32_v8i1:
953 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
954 ; AVX1-NEXT: vpxor %xmm2, %xmm2, %xmm2
955 ; AVX1-NEXT: vpcmpeqd %xmm2, %xmm1, %xmm1
956 ; AVX1-NEXT: vpcmpeqd %xmm2, %xmm0, %xmm0
957 ; AVX1-NEXT: vpor %xmm1, %xmm0, %xmm0
958 ; AVX1-NEXT: vtestps %xmm0, %xmm0
959 ; AVX1-NEXT: setne %al
960 ; AVX1-NEXT: vzeroupper
963 ; AVX2-LABEL: icmp0_v8i32_v8i1:
965 ; AVX2-NEXT: vpxor %xmm1, %xmm1, %xmm1
966 ; AVX2-NEXT: vpcmpeqd %ymm1, %ymm0, %ymm0
967 ; AVX2-NEXT: vtestps %ymm0, %ymm0
968 ; AVX2-NEXT: setne %al
969 ; AVX2-NEXT: vzeroupper
972 ; AVX512F-LABEL: icmp0_v8i32_v8i1:
974 ; AVX512F-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
975 ; AVX512F-NEXT: vptestnmd %zmm0, %zmm0, %k0
976 ; AVX512F-NEXT: kmovw %k0, %eax
977 ; AVX512F-NEXT: testb %al, %al
978 ; AVX512F-NEXT: setne %al
979 ; AVX512F-NEXT: vzeroupper
982 ; AVX512BW-LABEL: icmp0_v8i32_v8i1:
984 ; AVX512BW-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
985 ; AVX512BW-NEXT: vptestnmd %zmm0, %zmm0, %k0
986 ; AVX512BW-NEXT: kmovd %k0, %eax
987 ; AVX512BW-NEXT: testb %al, %al
988 ; AVX512BW-NEXT: setne %al
989 ; AVX512BW-NEXT: vzeroupper
990 ; AVX512BW-NEXT: retq
992 ; AVX512VL-LABEL: icmp0_v8i32_v8i1:
994 ; AVX512VL-NEXT: vptestnmd %ymm0, %ymm0, %k0
995 ; AVX512VL-NEXT: kmovd %k0, %eax
996 ; AVX512VL-NEXT: testb %al, %al
997 ; AVX512VL-NEXT: setne %al
998 ; AVX512VL-NEXT: vzeroupper
999 ; AVX512VL-NEXT: retq
1000 %a = icmp eq <8 x i32> %0, zeroinitializer
1001 %b = call i1 @llvm.vector.reduce.or.v8i1(<8 x i1> %a)
1005 define i1 @icmp0_v16i16_v16i1(<16 x i16>) nounwind {
1006 ; SSE-LABEL: icmp0_v16i16_v16i1:
1008 ; SSE-NEXT: pxor %xmm2, %xmm2
1009 ; SSE-NEXT: pcmpeqw %xmm2, %xmm1
1010 ; SSE-NEXT: pcmpeqw %xmm2, %xmm0
1011 ; SSE-NEXT: packsswb %xmm1, %xmm0
1012 ; SSE-NEXT: pmovmskb %xmm0, %eax
1013 ; SSE-NEXT: testl %eax, %eax
1014 ; SSE-NEXT: setne %al
1015 ; SSE-NEXT: ret{{[l|q]}}
1017 ; AVX1-LABEL: icmp0_v16i16_v16i1:
1019 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
1020 ; AVX1-NEXT: vpxor %xmm2, %xmm2, %xmm2
1021 ; AVX1-NEXT: vpcmpeqw %xmm2, %xmm1, %xmm1
1022 ; AVX1-NEXT: vpcmpeqw %xmm2, %xmm0, %xmm0
1023 ; AVX1-NEXT: vpacksswb %xmm1, %xmm0, %xmm0
1024 ; AVX1-NEXT: vpmovmskb %xmm0, %eax
1025 ; AVX1-NEXT: testl %eax, %eax
1026 ; AVX1-NEXT: setne %al
1027 ; AVX1-NEXT: vzeroupper
1030 ; AVX2-LABEL: icmp0_v16i16_v16i1:
1032 ; AVX2-NEXT: vpxor %xmm1, %xmm1, %xmm1
1033 ; AVX2-NEXT: vpcmpeqw %ymm1, %ymm0, %ymm0
1034 ; AVX2-NEXT: vpmovmskb %ymm0, %eax
1035 ; AVX2-NEXT: testl %eax, %eax
1036 ; AVX2-NEXT: setne %al
1037 ; AVX2-NEXT: vzeroupper
1040 ; AVX512F-LABEL: icmp0_v16i16_v16i1:
1042 ; AVX512F-NEXT: vpxor %xmm1, %xmm1, %xmm1
1043 ; AVX512F-NEXT: vpcmpeqw %ymm1, %ymm0, %ymm0
1044 ; AVX512F-NEXT: vpmovsxwd %ymm0, %zmm0
1045 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
1046 ; AVX512F-NEXT: kortestw %k0, %k0
1047 ; AVX512F-NEXT: setne %al
1048 ; AVX512F-NEXT: vzeroupper
1049 ; AVX512F-NEXT: retq
1051 ; AVX512BW-LABEL: icmp0_v16i16_v16i1:
1052 ; AVX512BW: # %bb.0:
1053 ; AVX512BW-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
1054 ; AVX512BW-NEXT: vptestnmw %zmm0, %zmm0, %k0
1055 ; AVX512BW-NEXT: kortestw %k0, %k0
1056 ; AVX512BW-NEXT: setne %al
1057 ; AVX512BW-NEXT: vzeroupper
1058 ; AVX512BW-NEXT: retq
1060 ; AVX512VL-LABEL: icmp0_v16i16_v16i1:
1061 ; AVX512VL: # %bb.0:
1062 ; AVX512VL-NEXT: vptestnmw %ymm0, %ymm0, %k0
1063 ; AVX512VL-NEXT: kortestw %k0, %k0
1064 ; AVX512VL-NEXT: setne %al
1065 ; AVX512VL-NEXT: vzeroupper
1066 ; AVX512VL-NEXT: retq
1067 %a = icmp eq <16 x i16> %0, zeroinitializer
1068 %b = call i1 @llvm.vector.reduce.or.v16i1(<16 x i1> %a)
1072 define i1 @icmp0_v32i8_v32i1(<32 x i8>) nounwind {
1073 ; SSE-LABEL: icmp0_v32i8_v32i1:
1075 ; SSE-NEXT: pxor %xmm2, %xmm2
1076 ; SSE-NEXT: pcmpeqb %xmm2, %xmm1
1077 ; SSE-NEXT: pcmpeqb %xmm2, %xmm0
1078 ; SSE-NEXT: por %xmm1, %xmm0
1079 ; SSE-NEXT: pmovmskb %xmm0, %eax
1080 ; SSE-NEXT: testl %eax, %eax
1081 ; SSE-NEXT: setne %al
1082 ; SSE-NEXT: ret{{[l|q]}}
1084 ; AVX1-LABEL: icmp0_v32i8_v32i1:
1086 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm1
1087 ; AVX1-NEXT: vpxor %xmm2, %xmm2, %xmm2
1088 ; AVX1-NEXT: vpcmpeqb %xmm2, %xmm1, %xmm1
1089 ; AVX1-NEXT: vpcmpeqb %xmm2, %xmm0, %xmm0
1090 ; AVX1-NEXT: vpor %xmm1, %xmm0, %xmm0
1091 ; AVX1-NEXT: vpmovmskb %xmm0, %eax
1092 ; AVX1-NEXT: testl %eax, %eax
1093 ; AVX1-NEXT: setne %al
1094 ; AVX1-NEXT: vzeroupper
1097 ; AVX2-LABEL: icmp0_v32i8_v32i1:
1099 ; AVX2-NEXT: vpxor %xmm1, %xmm1, %xmm1
1100 ; AVX2-NEXT: vpcmpeqb %ymm1, %ymm0, %ymm0
1101 ; AVX2-NEXT: vpmovmskb %ymm0, %eax
1102 ; AVX2-NEXT: testl %eax, %eax
1103 ; AVX2-NEXT: setne %al
1104 ; AVX2-NEXT: vzeroupper
1107 ; AVX512F-LABEL: icmp0_v32i8_v32i1:
1109 ; AVX512F-NEXT: vpxor %xmm1, %xmm1, %xmm1
1110 ; AVX512F-NEXT: vpcmpeqb %ymm1, %ymm0, %ymm0
1111 ; AVX512F-NEXT: vpmovmskb %ymm0, %eax
1112 ; AVX512F-NEXT: testl %eax, %eax
1113 ; AVX512F-NEXT: setne %al
1114 ; AVX512F-NEXT: vzeroupper
1115 ; AVX512F-NEXT: retq
1117 ; AVX512BW-LABEL: icmp0_v32i8_v32i1:
1118 ; AVX512BW: # %bb.0:
1119 ; AVX512BW-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
1120 ; AVX512BW-NEXT: vptestnmb %zmm0, %zmm0, %k0
1121 ; AVX512BW-NEXT: kortestd %k0, %k0
1122 ; AVX512BW-NEXT: setne %al
1123 ; AVX512BW-NEXT: vzeroupper
1124 ; AVX512BW-NEXT: retq
1126 ; AVX512VL-LABEL: icmp0_v32i8_v32i1:
1127 ; AVX512VL: # %bb.0:
1128 ; AVX512VL-NEXT: vptestnmb %ymm0, %ymm0, %k0
1129 ; AVX512VL-NEXT: kortestd %k0, %k0
1130 ; AVX512VL-NEXT: setne %al
1131 ; AVX512VL-NEXT: vzeroupper
1132 ; AVX512VL-NEXT: retq
1133 %a = icmp eq <32 x i8> %0, zeroinitializer
1134 %b = call i1 @llvm.vector.reduce.or.v32i1(<32 x i1> %a)
1138 define i1 @icmp0_v8i64_v8i1(<8 x i64>) nounwind {
1139 ; X86-SSE2-LABEL: icmp0_v8i64_v8i1:
1140 ; X86-SSE2: # %bb.0:
1141 ; X86-SSE2-NEXT: pushl %ebp
1142 ; X86-SSE2-NEXT: movl %esp, %ebp
1143 ; X86-SSE2-NEXT: andl $-16, %esp
1144 ; X86-SSE2-NEXT: subl $16, %esp
1145 ; X86-SSE2-NEXT: pxor %xmm3, %xmm3
1146 ; X86-SSE2-NEXT: pcmpeqd %xmm3, %xmm1
1147 ; X86-SSE2-NEXT: pshufd {{.*#+}} xmm4 = xmm1[1,0,3,2]
1148 ; X86-SSE2-NEXT: pand %xmm1, %xmm4
1149 ; X86-SSE2-NEXT: pcmpeqd %xmm3, %xmm0
1150 ; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,0,3,2]
1151 ; X86-SSE2-NEXT: pand %xmm0, %xmm1
1152 ; X86-SSE2-NEXT: packssdw %xmm4, %xmm1
1153 ; X86-SSE2-NEXT: pcmpeqd %xmm3, %xmm2
1154 ; X86-SSE2-NEXT: pshufd {{.*#+}} xmm0 = xmm2[1,0,3,2]
1155 ; X86-SSE2-NEXT: pand %xmm2, %xmm0
1156 ; X86-SSE2-NEXT: pcmpeqd 8(%ebp), %xmm3
1157 ; X86-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm3[1,0,3,2]
1158 ; X86-SSE2-NEXT: pand %xmm3, %xmm2
1159 ; X86-SSE2-NEXT: packssdw %xmm2, %xmm0
1160 ; X86-SSE2-NEXT: packssdw %xmm0, %xmm1
1161 ; X86-SSE2-NEXT: pmovmskb %xmm1, %eax
1162 ; X86-SSE2-NEXT: testl $43690, %eax # imm = 0xAAAA
1163 ; X86-SSE2-NEXT: setne %al
1164 ; X86-SSE2-NEXT: movl %ebp, %esp
1165 ; X86-SSE2-NEXT: popl %ebp
1166 ; X86-SSE2-NEXT: retl
1168 ; X64-SSE2-LABEL: icmp0_v8i64_v8i1:
1169 ; X64-SSE2: # %bb.0:
1170 ; X64-SSE2-NEXT: pxor %xmm4, %xmm4
1171 ; X64-SSE2-NEXT: pcmpeqd %xmm4, %xmm3
1172 ; X64-SSE2-NEXT: pshufd {{.*#+}} xmm5 = xmm3[1,0,3,2]
1173 ; X64-SSE2-NEXT: pand %xmm3, %xmm5
1174 ; X64-SSE2-NEXT: pcmpeqd %xmm4, %xmm2
1175 ; X64-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm2[1,0,3,2]
1176 ; X64-SSE2-NEXT: pand %xmm2, %xmm3
1177 ; X64-SSE2-NEXT: packssdw %xmm5, %xmm3
1178 ; X64-SSE2-NEXT: pcmpeqd %xmm4, %xmm1
1179 ; X64-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm1[1,0,3,2]
1180 ; X64-SSE2-NEXT: pand %xmm1, %xmm2
1181 ; X64-SSE2-NEXT: pcmpeqd %xmm4, %xmm0
1182 ; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,0,3,2]
1183 ; X64-SSE2-NEXT: pand %xmm0, %xmm1
1184 ; X64-SSE2-NEXT: packssdw %xmm2, %xmm1
1185 ; X64-SSE2-NEXT: packssdw %xmm3, %xmm1
1186 ; X64-SSE2-NEXT: pmovmskb %xmm1, %eax
1187 ; X64-SSE2-NEXT: testl $43690, %eax # imm = 0xAAAA
1188 ; X64-SSE2-NEXT: setne %al
1189 ; X64-SSE2-NEXT: retq
1191 ; SSE41-LABEL: icmp0_v8i64_v8i1:
1193 ; SSE41-NEXT: pxor %xmm4, %xmm4
1194 ; SSE41-NEXT: pcmpeqq %xmm4, %xmm3
1195 ; SSE41-NEXT: pcmpeqq %xmm4, %xmm2
1196 ; SSE41-NEXT: packssdw %xmm3, %xmm2
1197 ; SSE41-NEXT: pcmpeqq %xmm4, %xmm1
1198 ; SSE41-NEXT: pcmpeqq %xmm4, %xmm0
1199 ; SSE41-NEXT: packssdw %xmm1, %xmm0
1200 ; SSE41-NEXT: packssdw %xmm2, %xmm0
1201 ; SSE41-NEXT: pmovmskb %xmm0, %eax
1202 ; SSE41-NEXT: testl %eax, %eax
1203 ; SSE41-NEXT: setne %al
1206 ; AVX1-LABEL: icmp0_v8i64_v8i1:
1208 ; AVX1-NEXT: vpxor %xmm2, %xmm2, %xmm2
1209 ; AVX1-NEXT: vpcmpeqq %xmm2, %xmm1, %xmm3
1210 ; AVX1-NEXT: vpcmpeqq %xmm2, %xmm0, %xmm4
1211 ; AVX1-NEXT: vpor %xmm3, %xmm4, %xmm3
1212 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm1
1213 ; AVX1-NEXT: vpcmpeqq %xmm2, %xmm1, %xmm1
1214 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm0
1215 ; AVX1-NEXT: vpcmpeqq %xmm2, %xmm0, %xmm0
1216 ; AVX1-NEXT: vpor %xmm1, %xmm0, %xmm0
1217 ; AVX1-NEXT: vpackssdw %xmm0, %xmm3, %xmm0
1218 ; AVX1-NEXT: vtestps %xmm0, %xmm0
1219 ; AVX1-NEXT: setne %al
1220 ; AVX1-NEXT: vzeroupper
1223 ; AVX2-LABEL: icmp0_v8i64_v8i1:
1225 ; AVX2-NEXT: vpxor %xmm2, %xmm2, %xmm2
1226 ; AVX2-NEXT: vpcmpeqq %ymm2, %ymm1, %ymm1
1227 ; AVX2-NEXT: vpcmpeqq %ymm2, %ymm0, %ymm0
1228 ; AVX2-NEXT: vpackssdw %ymm1, %ymm0, %ymm0
1229 ; AVX2-NEXT: vtestps %ymm0, %ymm0
1230 ; AVX2-NEXT: setne %al
1231 ; AVX2-NEXT: vzeroupper
1234 ; AVX512F-LABEL: icmp0_v8i64_v8i1:
1236 ; AVX512F-NEXT: vptestnmq %zmm0, %zmm0, %k0
1237 ; AVX512F-NEXT: kmovw %k0, %eax
1238 ; AVX512F-NEXT: testb %al, %al
1239 ; AVX512F-NEXT: setne %al
1240 ; AVX512F-NEXT: vzeroupper
1241 ; AVX512F-NEXT: retq
1243 ; AVX512BW-LABEL: icmp0_v8i64_v8i1:
1244 ; AVX512BW: # %bb.0:
1245 ; AVX512BW-NEXT: vptestnmq %zmm0, %zmm0, %k0
1246 ; AVX512BW-NEXT: kmovd %k0, %eax
1247 ; AVX512BW-NEXT: testb %al, %al
1248 ; AVX512BW-NEXT: setne %al
1249 ; AVX512BW-NEXT: vzeroupper
1250 ; AVX512BW-NEXT: retq
1252 ; AVX512VL-LABEL: icmp0_v8i64_v8i1:
1253 ; AVX512VL: # %bb.0:
1254 ; AVX512VL-NEXT: vptestnmq %zmm0, %zmm0, %k0
1255 ; AVX512VL-NEXT: kmovd %k0, %eax
1256 ; AVX512VL-NEXT: testb %al, %al
1257 ; AVX512VL-NEXT: setne %al
1258 ; AVX512VL-NEXT: vzeroupper
1259 ; AVX512VL-NEXT: retq
1260 %a = icmp eq <8 x i64> %0, zeroinitializer
1261 %b = call i1 @llvm.vector.reduce.or.v8i1(<8 x i1> %a)
1265 define i1 @icmp0_v16i32_v16i1(<16 x i32>) nounwind {
1266 ; X86-SSE2-LABEL: icmp0_v16i32_v16i1:
1267 ; X86-SSE2: # %bb.0:
1268 ; X86-SSE2-NEXT: pushl %ebp
1269 ; X86-SSE2-NEXT: movl %esp, %ebp
1270 ; X86-SSE2-NEXT: andl $-16, %esp
1271 ; X86-SSE2-NEXT: subl $16, %esp
1272 ; X86-SSE2-NEXT: pxor %xmm3, %xmm3
1273 ; X86-SSE2-NEXT: pcmpeqd %xmm3, %xmm1
1274 ; X86-SSE2-NEXT: pcmpeqd %xmm3, %xmm0
1275 ; X86-SSE2-NEXT: packssdw %xmm1, %xmm0
1276 ; X86-SSE2-NEXT: pcmpeqd %xmm3, %xmm2
1277 ; X86-SSE2-NEXT: pcmpeqd 8(%ebp), %xmm3
1278 ; X86-SSE2-NEXT: packssdw %xmm3, %xmm2
1279 ; X86-SSE2-NEXT: packsswb %xmm2, %xmm0
1280 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
1281 ; X86-SSE2-NEXT: testl %eax, %eax
1282 ; X86-SSE2-NEXT: setne %al
1283 ; X86-SSE2-NEXT: movl %ebp, %esp
1284 ; X86-SSE2-NEXT: popl %ebp
1285 ; X86-SSE2-NEXT: retl
1287 ; X64-SSE-LABEL: icmp0_v16i32_v16i1:
1289 ; X64-SSE-NEXT: pxor %xmm4, %xmm4
1290 ; X64-SSE-NEXT: pcmpeqd %xmm4, %xmm3
1291 ; X64-SSE-NEXT: pcmpeqd %xmm4, %xmm2
1292 ; X64-SSE-NEXT: packssdw %xmm3, %xmm2
1293 ; X64-SSE-NEXT: pcmpeqd %xmm4, %xmm1
1294 ; X64-SSE-NEXT: pcmpeqd %xmm4, %xmm0
1295 ; X64-SSE-NEXT: packssdw %xmm1, %xmm0
1296 ; X64-SSE-NEXT: packsswb %xmm2, %xmm0
1297 ; X64-SSE-NEXT: pmovmskb %xmm0, %eax
1298 ; X64-SSE-NEXT: testl %eax, %eax
1299 ; X64-SSE-NEXT: setne %al
1300 ; X64-SSE-NEXT: retq
1302 ; AVX1-LABEL: icmp0_v16i32_v16i1:
1304 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
1305 ; AVX1-NEXT: vpxor %xmm3, %xmm3, %xmm3
1306 ; AVX1-NEXT: vpcmpeqd %xmm3, %xmm2, %xmm2
1307 ; AVX1-NEXT: vpcmpeqd %xmm3, %xmm1, %xmm1
1308 ; AVX1-NEXT: vpackssdw %xmm2, %xmm1, %xmm1
1309 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm2
1310 ; AVX1-NEXT: vpcmpeqd %xmm3, %xmm2, %xmm2
1311 ; AVX1-NEXT: vpcmpeqd %xmm3, %xmm0, %xmm0
1312 ; AVX1-NEXT: vpackssdw %xmm2, %xmm0, %xmm0
1313 ; AVX1-NEXT: vpacksswb %xmm1, %xmm0, %xmm0
1314 ; AVX1-NEXT: vpmovmskb %xmm0, %eax
1315 ; AVX1-NEXT: testl %eax, %eax
1316 ; AVX1-NEXT: setne %al
1317 ; AVX1-NEXT: vzeroupper
1320 ; AVX2-LABEL: icmp0_v16i32_v16i1:
1322 ; AVX2-NEXT: vpxor %xmm2, %xmm2, %xmm2
1323 ; AVX2-NEXT: vpcmpeqd %ymm2, %ymm1, %ymm1
1324 ; AVX2-NEXT: vpcmpeqd %ymm2, %ymm0, %ymm0
1325 ; AVX2-NEXT: vpackssdw %ymm1, %ymm0, %ymm0
1326 ; AVX2-NEXT: vpmovmskb %ymm0, %eax
1327 ; AVX2-NEXT: testl %eax, %eax
1328 ; AVX2-NEXT: setne %al
1329 ; AVX2-NEXT: vzeroupper
1332 ; AVX512-LABEL: icmp0_v16i32_v16i1:
1334 ; AVX512-NEXT: vptestnmd %zmm0, %zmm0, %k0
1335 ; AVX512-NEXT: kortestw %k0, %k0
1336 ; AVX512-NEXT: setne %al
1337 ; AVX512-NEXT: vzeroupper
1339 %a = icmp eq <16 x i32> %0, zeroinitializer
1340 %b = call i1 @llvm.vector.reduce.or.v16i1(<16 x i1> %a)
1344 define i1 @icmp0_v32i16_v32i1(<32 x i16>) nounwind {
1345 ; X86-SSE2-LABEL: icmp0_v32i16_v32i1:
1346 ; X86-SSE2: # %bb.0:
1347 ; X86-SSE2-NEXT: pushl %ebp
1348 ; X86-SSE2-NEXT: movl %esp, %ebp
1349 ; X86-SSE2-NEXT: andl $-16, %esp
1350 ; X86-SSE2-NEXT: subl $16, %esp
1351 ; X86-SSE2-NEXT: pxor %xmm3, %xmm3
1352 ; X86-SSE2-NEXT: pcmpeqw %xmm3, %xmm1
1353 ; X86-SSE2-NEXT: pcmpeqw %xmm3, %xmm2
1354 ; X86-SSE2-NEXT: pcmpeqw %xmm3, %xmm0
1355 ; X86-SSE2-NEXT: por %xmm2, %xmm0
1356 ; X86-SSE2-NEXT: pcmpeqw 8(%ebp), %xmm3
1357 ; X86-SSE2-NEXT: por %xmm1, %xmm3
1358 ; X86-SSE2-NEXT: packsswb %xmm3, %xmm0
1359 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
1360 ; X86-SSE2-NEXT: testl %eax, %eax
1361 ; X86-SSE2-NEXT: setne %al
1362 ; X86-SSE2-NEXT: movl %ebp, %esp
1363 ; X86-SSE2-NEXT: popl %ebp
1364 ; X86-SSE2-NEXT: retl
1366 ; X64-SSE-LABEL: icmp0_v32i16_v32i1:
1368 ; X64-SSE-NEXT: pxor %xmm4, %xmm4
1369 ; X64-SSE-NEXT: pcmpeqw %xmm4, %xmm2
1370 ; X64-SSE-NEXT: pcmpeqw %xmm4, %xmm0
1371 ; X64-SSE-NEXT: por %xmm2, %xmm0
1372 ; X64-SSE-NEXT: pcmpeqw %xmm4, %xmm3
1373 ; X64-SSE-NEXT: pcmpeqw %xmm4, %xmm1
1374 ; X64-SSE-NEXT: por %xmm3, %xmm1
1375 ; X64-SSE-NEXT: packsswb %xmm1, %xmm0
1376 ; X64-SSE-NEXT: pmovmskb %xmm0, %eax
1377 ; X64-SSE-NEXT: testl %eax, %eax
1378 ; X64-SSE-NEXT: setne %al
1379 ; X64-SSE-NEXT: retq
1381 ; AVX1-LABEL: icmp0_v32i16_v32i1:
1383 ; AVX1-NEXT: vpxor %xmm2, %xmm2, %xmm2
1384 ; AVX1-NEXT: vpcmpeqw %xmm2, %xmm1, %xmm3
1385 ; AVX1-NEXT: vpcmpeqw %xmm2, %xmm0, %xmm4
1386 ; AVX1-NEXT: vpor %xmm3, %xmm4, %xmm3
1387 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm1
1388 ; AVX1-NEXT: vpcmpeqw %xmm2, %xmm1, %xmm1
1389 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm0
1390 ; AVX1-NEXT: vpcmpeqw %xmm2, %xmm0, %xmm0
1391 ; AVX1-NEXT: vpor %xmm1, %xmm0, %xmm0
1392 ; AVX1-NEXT: vpacksswb %xmm0, %xmm3, %xmm0
1393 ; AVX1-NEXT: vpmovmskb %xmm0, %eax
1394 ; AVX1-NEXT: testl %eax, %eax
1395 ; AVX1-NEXT: setne %al
1396 ; AVX1-NEXT: vzeroupper
1399 ; AVX2-LABEL: icmp0_v32i16_v32i1:
1401 ; AVX2-NEXT: vpxor %xmm2, %xmm2, %xmm2
1402 ; AVX2-NEXT: vpcmpeqw %ymm2, %ymm1, %ymm1
1403 ; AVX2-NEXT: vpcmpeqw %ymm2, %ymm0, %ymm0
1404 ; AVX2-NEXT: vpacksswb %ymm1, %ymm0, %ymm0
1405 ; AVX2-NEXT: vpmovmskb %ymm0, %eax
1406 ; AVX2-NEXT: testl %eax, %eax
1407 ; AVX2-NEXT: setne %al
1408 ; AVX2-NEXT: vzeroupper
1411 ; AVX512F-LABEL: icmp0_v32i16_v32i1:
1413 ; AVX512F-NEXT: vextracti64x4 $1, %zmm0, %ymm1
1414 ; AVX512F-NEXT: vpxor %xmm2, %xmm2, %xmm2
1415 ; AVX512F-NEXT: vpcmpeqw %ymm2, %ymm1, %ymm1
1416 ; AVX512F-NEXT: vpcmpeqw %ymm2, %ymm0, %ymm0
1417 ; AVX512F-NEXT: vpor %ymm1, %ymm0, %ymm0
1418 ; AVX512F-NEXT: vpmovsxwd %ymm0, %zmm0
1419 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
1420 ; AVX512F-NEXT: kortestw %k0, %k0
1421 ; AVX512F-NEXT: setne %al
1422 ; AVX512F-NEXT: vzeroupper
1423 ; AVX512F-NEXT: retq
1425 ; AVX512BW-LABEL: icmp0_v32i16_v32i1:
1426 ; AVX512BW: # %bb.0:
1427 ; AVX512BW-NEXT: vptestnmw %zmm0, %zmm0, %k0
1428 ; AVX512BW-NEXT: kortestd %k0, %k0
1429 ; AVX512BW-NEXT: setne %al
1430 ; AVX512BW-NEXT: vzeroupper
1431 ; AVX512BW-NEXT: retq
1433 ; AVX512VL-LABEL: icmp0_v32i16_v32i1:
1434 ; AVX512VL: # %bb.0:
1435 ; AVX512VL-NEXT: vptestnmw %zmm0, %zmm0, %k0
1436 ; AVX512VL-NEXT: kortestd %k0, %k0
1437 ; AVX512VL-NEXT: setne %al
1438 ; AVX512VL-NEXT: vzeroupper
1439 ; AVX512VL-NEXT: retq
1440 %a = icmp eq <32 x i16> %0, zeroinitializer
1441 %b = call i1 @llvm.vector.reduce.or.v32i1(<32 x i1> %a)
1445 define i1 @icmp0_v64i8_v64i1(<64 x i8>) nounwind {
1446 ; X86-SSE2-LABEL: icmp0_v64i8_v64i1:
1447 ; X86-SSE2: # %bb.0:
1448 ; X86-SSE2-NEXT: pushl %ebp
1449 ; X86-SSE2-NEXT: movl %esp, %ebp
1450 ; X86-SSE2-NEXT: andl $-16, %esp
1451 ; X86-SSE2-NEXT: subl $16, %esp
1452 ; X86-SSE2-NEXT: pxor %xmm3, %xmm3
1453 ; X86-SSE2-NEXT: pcmpeqb %xmm3, %xmm1
1454 ; X86-SSE2-NEXT: pcmpeqb %xmm3, %xmm2
1455 ; X86-SSE2-NEXT: pcmpeqb %xmm3, %xmm0
1456 ; X86-SSE2-NEXT: por %xmm2, %xmm0
1457 ; X86-SSE2-NEXT: pcmpeqb 8(%ebp), %xmm3
1458 ; X86-SSE2-NEXT: por %xmm1, %xmm3
1459 ; X86-SSE2-NEXT: por %xmm0, %xmm3
1460 ; X86-SSE2-NEXT: pmovmskb %xmm3, %eax
1461 ; X86-SSE2-NEXT: testl %eax, %eax
1462 ; X86-SSE2-NEXT: setne %al
1463 ; X86-SSE2-NEXT: movl %ebp, %esp
1464 ; X86-SSE2-NEXT: popl %ebp
1465 ; X86-SSE2-NEXT: retl
1467 ; X64-SSE-LABEL: icmp0_v64i8_v64i1:
1469 ; X64-SSE-NEXT: pxor %xmm4, %xmm4
1470 ; X64-SSE-NEXT: pcmpeqb %xmm4, %xmm2
1471 ; X64-SSE-NEXT: pcmpeqb %xmm4, %xmm0
1472 ; X64-SSE-NEXT: por %xmm2, %xmm0
1473 ; X64-SSE-NEXT: pcmpeqb %xmm4, %xmm3
1474 ; X64-SSE-NEXT: pcmpeqb %xmm4, %xmm1
1475 ; X64-SSE-NEXT: por %xmm3, %xmm1
1476 ; X64-SSE-NEXT: por %xmm0, %xmm1
1477 ; X64-SSE-NEXT: pmovmskb %xmm1, %eax
1478 ; X64-SSE-NEXT: testl %eax, %eax
1479 ; X64-SSE-NEXT: setne %al
1480 ; X64-SSE-NEXT: retq
1482 ; AVX1-LABEL: icmp0_v64i8_v64i1:
1484 ; AVX1-NEXT: vpxor %xmm2, %xmm2, %xmm2
1485 ; AVX1-NEXT: vpcmpeqb %xmm2, %xmm1, %xmm3
1486 ; AVX1-NEXT: vpcmpeqb %xmm2, %xmm0, %xmm4
1487 ; AVX1-NEXT: vpor %xmm3, %xmm4, %xmm3
1488 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm1
1489 ; AVX1-NEXT: vpcmpeqb %xmm2, %xmm1, %xmm1
1490 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm0
1491 ; AVX1-NEXT: vpcmpeqb %xmm2, %xmm0, %xmm0
1492 ; AVX1-NEXT: vpor %xmm1, %xmm0, %xmm0
1493 ; AVX1-NEXT: vpor %xmm0, %xmm3, %xmm0
1494 ; AVX1-NEXT: vpmovmskb %xmm0, %eax
1495 ; AVX1-NEXT: testl %eax, %eax
1496 ; AVX1-NEXT: setne %al
1497 ; AVX1-NEXT: vzeroupper
1500 ; AVX2-LABEL: icmp0_v64i8_v64i1:
1502 ; AVX2-NEXT: vpxor %xmm2, %xmm2, %xmm2
1503 ; AVX2-NEXT: vpcmpeqb %ymm2, %ymm1, %ymm1
1504 ; AVX2-NEXT: vpcmpeqb %ymm2, %ymm0, %ymm0
1505 ; AVX2-NEXT: vpor %ymm1, %ymm0, %ymm0
1506 ; AVX2-NEXT: vpmovmskb %ymm0, %eax
1507 ; AVX2-NEXT: testl %eax, %eax
1508 ; AVX2-NEXT: setne %al
1509 ; AVX2-NEXT: vzeroupper
1512 ; AVX512F-LABEL: icmp0_v64i8_v64i1:
1514 ; AVX512F-NEXT: vextracti64x4 $1, %zmm0, %ymm1
1515 ; AVX512F-NEXT: vpxor %xmm2, %xmm2, %xmm2
1516 ; AVX512F-NEXT: vpcmpeqb %ymm2, %ymm1, %ymm1
1517 ; AVX512F-NEXT: vpcmpeqb %ymm2, %ymm0, %ymm0
1518 ; AVX512F-NEXT: vpor %ymm1, %ymm0, %ymm0
1519 ; AVX512F-NEXT: vpmovmskb %ymm0, %eax
1520 ; AVX512F-NEXT: testl %eax, %eax
1521 ; AVX512F-NEXT: setne %al
1522 ; AVX512F-NEXT: vzeroupper
1523 ; AVX512F-NEXT: retq
1525 ; AVX512BW-LABEL: icmp0_v64i8_v64i1:
1526 ; AVX512BW: # %bb.0:
1527 ; AVX512BW-NEXT: vptestnmb %zmm0, %zmm0, %k0
1528 ; AVX512BW-NEXT: kortestq %k0, %k0
1529 ; AVX512BW-NEXT: setne %al
1530 ; AVX512BW-NEXT: vzeroupper
1531 ; AVX512BW-NEXT: retq
1533 ; AVX512VL-LABEL: icmp0_v64i8_v64i1:
1534 ; AVX512VL: # %bb.0:
1535 ; AVX512VL-NEXT: vptestnmb %zmm0, %zmm0, %k0
1536 ; AVX512VL-NEXT: kortestq %k0, %k0
1537 ; AVX512VL-NEXT: setne %al
1538 ; AVX512VL-NEXT: vzeroupper
1539 ; AVX512VL-NEXT: retq
1540 %a = icmp eq <64 x i8> %0, zeroinitializer
1541 %b = call i1 @llvm.vector.reduce.or.v64i1(<64 x i1> %a)
1548 define i1 @icmp_v2i64_v2i1(<2 x i64>, <2 x i64>) nounwind {
1549 ; SSE2-LABEL: icmp_v2i64_v2i1:
1551 ; SSE2-NEXT: pcmpeqd %xmm1, %xmm0
1552 ; SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,0,3,2]
1553 ; SSE2-NEXT: pand %xmm0, %xmm1
1554 ; SSE2-NEXT: movmskpd %xmm1, %eax
1555 ; SSE2-NEXT: testl %eax, %eax
1556 ; SSE2-NEXT: setne %al
1557 ; SSE2-NEXT: ret{{[l|q]}}
1559 ; SSE41-LABEL: icmp_v2i64_v2i1:
1561 ; SSE41-NEXT: pcmpeqq %xmm1, %xmm0
1562 ; SSE41-NEXT: movmskpd %xmm0, %eax
1563 ; SSE41-NEXT: testl %eax, %eax
1564 ; SSE41-NEXT: setne %al
1567 ; AVX1OR2-LABEL: icmp_v2i64_v2i1:
1569 ; AVX1OR2-NEXT: vpcmpeqq %xmm1, %xmm0, %xmm0
1570 ; AVX1OR2-NEXT: vtestpd %xmm0, %xmm0
1571 ; AVX1OR2-NEXT: setne %al
1572 ; AVX1OR2-NEXT: retq
1574 ; AVX512F-LABEL: icmp_v2i64_v2i1:
1576 ; AVX512F-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
1577 ; AVX512F-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
1578 ; AVX512F-NEXT: vpcmpeqq %zmm1, %zmm0, %k0
1579 ; AVX512F-NEXT: kmovw %k0, %eax
1580 ; AVX512F-NEXT: testb $3, %al
1581 ; AVX512F-NEXT: setne %al
1582 ; AVX512F-NEXT: vzeroupper
1583 ; AVX512F-NEXT: retq
1585 ; AVX512BW-LABEL: icmp_v2i64_v2i1:
1586 ; AVX512BW: # %bb.0:
1587 ; AVX512BW-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
1588 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
1589 ; AVX512BW-NEXT: vpcmpeqq %zmm1, %zmm0, %k0
1590 ; AVX512BW-NEXT: kmovd %k0, %eax
1591 ; AVX512BW-NEXT: testb $3, %al
1592 ; AVX512BW-NEXT: setne %al
1593 ; AVX512BW-NEXT: vzeroupper
1594 ; AVX512BW-NEXT: retq
1596 ; AVX512VL-LABEL: icmp_v2i64_v2i1:
1597 ; AVX512VL: # %bb.0:
1598 ; AVX512VL-NEXT: vpcmpeqq %xmm1, %xmm0, %k0
1599 ; AVX512VL-NEXT: kmovd %k0, %eax
1600 ; AVX512VL-NEXT: testb %al, %al
1601 ; AVX512VL-NEXT: setne %al
1602 ; AVX512VL-NEXT: retq
1603 %a = icmp eq <2 x i64> %0, %1
1604 %b = call i1 @llvm.vector.reduce.or.v2i1(<2 x i1> %a)
1608 define i1 @icmp_v4i32_v4i1(<4 x i32>, <4 x i32>) nounwind {
1609 ; SSE-LABEL: icmp_v4i32_v4i1:
1611 ; SSE-NEXT: pcmpeqd %xmm1, %xmm0
1612 ; SSE-NEXT: movmskps %xmm0, %eax
1613 ; SSE-NEXT: testl %eax, %eax
1614 ; SSE-NEXT: setne %al
1615 ; SSE-NEXT: ret{{[l|q]}}
1617 ; AVX1OR2-LABEL: icmp_v4i32_v4i1:
1619 ; AVX1OR2-NEXT: vpcmpeqd %xmm1, %xmm0, %xmm0
1620 ; AVX1OR2-NEXT: vtestps %xmm0, %xmm0
1621 ; AVX1OR2-NEXT: setne %al
1622 ; AVX1OR2-NEXT: retq
1624 ; AVX512F-LABEL: icmp_v4i32_v4i1:
1626 ; AVX512F-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
1627 ; AVX512F-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
1628 ; AVX512F-NEXT: vpcmpeqd %zmm1, %zmm0, %k0
1629 ; AVX512F-NEXT: kmovw %k0, %eax
1630 ; AVX512F-NEXT: testb $15, %al
1631 ; AVX512F-NEXT: setne %al
1632 ; AVX512F-NEXT: vzeroupper
1633 ; AVX512F-NEXT: retq
1635 ; AVX512BW-LABEL: icmp_v4i32_v4i1:
1636 ; AVX512BW: # %bb.0:
1637 ; AVX512BW-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
1638 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
1639 ; AVX512BW-NEXT: vpcmpeqd %zmm1, %zmm0, %k0
1640 ; AVX512BW-NEXT: kmovd %k0, %eax
1641 ; AVX512BW-NEXT: testb $15, %al
1642 ; AVX512BW-NEXT: setne %al
1643 ; AVX512BW-NEXT: vzeroupper
1644 ; AVX512BW-NEXT: retq
1646 ; AVX512VL-LABEL: icmp_v4i32_v4i1:
1647 ; AVX512VL: # %bb.0:
1648 ; AVX512VL-NEXT: vpcmpeqd %xmm1, %xmm0, %k0
1649 ; AVX512VL-NEXT: kmovd %k0, %eax
1650 ; AVX512VL-NEXT: testb %al, %al
1651 ; AVX512VL-NEXT: setne %al
1652 ; AVX512VL-NEXT: retq
1653 %a = icmp eq <4 x i32> %0, %1
1654 %b = call i1 @llvm.vector.reduce.or.v4i1(<4 x i1> %a)
1658 define i1 @icmp_v8i16_v8i1(<8 x i16>, <8 x i16>) nounwind {
1659 ; SSE-LABEL: icmp_v8i16_v8i1:
1661 ; SSE-NEXT: pcmpeqw %xmm1, %xmm0
1662 ; SSE-NEXT: pmovmskb %xmm0, %eax
1663 ; SSE-NEXT: testl %eax, %eax
1664 ; SSE-NEXT: setne %al
1665 ; SSE-NEXT: ret{{[l|q]}}
1667 ; AVX1OR2-LABEL: icmp_v8i16_v8i1:
1669 ; AVX1OR2-NEXT: vpcmpeqw %xmm1, %xmm0, %xmm0
1670 ; AVX1OR2-NEXT: vpmovmskb %xmm0, %eax
1671 ; AVX1OR2-NEXT: testl %eax, %eax
1672 ; AVX1OR2-NEXT: setne %al
1673 ; AVX1OR2-NEXT: retq
1675 ; AVX512F-LABEL: icmp_v8i16_v8i1:
1677 ; AVX512F-NEXT: vpcmpeqw %xmm1, %xmm0, %xmm0
1678 ; AVX512F-NEXT: vpmovsxwq %xmm0, %zmm0
1679 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
1680 ; AVX512F-NEXT: kortestw %k0, %k0
1681 ; AVX512F-NEXT: setne %al
1682 ; AVX512F-NEXT: vzeroupper
1683 ; AVX512F-NEXT: retq
1685 ; AVX512BW-LABEL: icmp_v8i16_v8i1:
1686 ; AVX512BW: # %bb.0:
1687 ; AVX512BW-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
1688 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
1689 ; AVX512BW-NEXT: vpcmpeqw %zmm1, %zmm0, %k0
1690 ; AVX512BW-NEXT: kmovd %k0, %eax
1691 ; AVX512BW-NEXT: testb %al, %al
1692 ; AVX512BW-NEXT: setne %al
1693 ; AVX512BW-NEXT: vzeroupper
1694 ; AVX512BW-NEXT: retq
1696 ; AVX512VL-LABEL: icmp_v8i16_v8i1:
1697 ; AVX512VL: # %bb.0:
1698 ; AVX512VL-NEXT: vpcmpeqw %xmm1, %xmm0, %k0
1699 ; AVX512VL-NEXT: kmovd %k0, %eax
1700 ; AVX512VL-NEXT: testb %al, %al
1701 ; AVX512VL-NEXT: setne %al
1702 ; AVX512VL-NEXT: retq
1703 %a = icmp eq <8 x i16> %0, %1
1704 %b = call i1 @llvm.vector.reduce.or.v8i1(<8 x i1> %a)
1708 define i1 @icmp_v16i8_v16i1(<16 x i8>, <16 x i8>) nounwind {
1709 ; SSE-LABEL: icmp_v16i8_v16i1:
1711 ; SSE-NEXT: pcmpeqb %xmm1, %xmm0
1712 ; SSE-NEXT: pmovmskb %xmm0, %eax
1713 ; SSE-NEXT: testl %eax, %eax
1714 ; SSE-NEXT: setne %al
1715 ; SSE-NEXT: ret{{[l|q]}}
1717 ; AVX1OR2-LABEL: icmp_v16i8_v16i1:
1719 ; AVX1OR2-NEXT: vpcmpeqb %xmm1, %xmm0, %xmm0
1720 ; AVX1OR2-NEXT: vpmovmskb %xmm0, %eax
1721 ; AVX1OR2-NEXT: testl %eax, %eax
1722 ; AVX1OR2-NEXT: setne %al
1723 ; AVX1OR2-NEXT: retq
1725 ; AVX512F-LABEL: icmp_v16i8_v16i1:
1727 ; AVX512F-NEXT: vpcmpeqb %xmm1, %xmm0, %xmm0
1728 ; AVX512F-NEXT: vpmovmskb %xmm0, %eax
1729 ; AVX512F-NEXT: testl %eax, %eax
1730 ; AVX512F-NEXT: setne %al
1731 ; AVX512F-NEXT: retq
1733 ; AVX512BW-LABEL: icmp_v16i8_v16i1:
1734 ; AVX512BW: # %bb.0:
1735 ; AVX512BW-NEXT: # kill: def $xmm1 killed $xmm1 def $zmm1
1736 ; AVX512BW-NEXT: # kill: def $xmm0 killed $xmm0 def $zmm0
1737 ; AVX512BW-NEXT: vpcmpeqb %zmm1, %zmm0, %k0
1738 ; AVX512BW-NEXT: kortestw %k0, %k0
1739 ; AVX512BW-NEXT: setne %al
1740 ; AVX512BW-NEXT: vzeroupper
1741 ; AVX512BW-NEXT: retq
1743 ; AVX512VL-LABEL: icmp_v16i8_v16i1:
1744 ; AVX512VL: # %bb.0:
1745 ; AVX512VL-NEXT: vpcmpeqb %xmm1, %xmm0, %k0
1746 ; AVX512VL-NEXT: kortestw %k0, %k0
1747 ; AVX512VL-NEXT: setne %al
1748 ; AVX512VL-NEXT: retq
1749 %a = icmp eq <16 x i8> %0, %1
1750 %b = call i1 @llvm.vector.reduce.or.v16i1(<16 x i1> %a)
1754 define i1 @icmp_v4i64_v4i1(<4 x i64>, <4 x i64>) nounwind {
1755 ; X86-SSE2-LABEL: icmp_v4i64_v4i1:
1756 ; X86-SSE2: # %bb.0:
1757 ; X86-SSE2-NEXT: pushl %ebp
1758 ; X86-SSE2-NEXT: movl %esp, %ebp
1759 ; X86-SSE2-NEXT: andl $-16, %esp
1760 ; X86-SSE2-NEXT: subl $16, %esp
1761 ; X86-SSE2-NEXT: pcmpeqd %xmm2, %xmm0
1762 ; X86-SSE2-NEXT: pcmpeqd 8(%ebp), %xmm1
1763 ; X86-SSE2-NEXT: movdqa %xmm0, %xmm2
1764 ; X86-SSE2-NEXT: shufps {{.*#+}} xmm2 = xmm2[1,3],xmm1[1,3]
1765 ; X86-SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,2],xmm1[0,2]
1766 ; X86-SSE2-NEXT: andps %xmm2, %xmm0
1767 ; X86-SSE2-NEXT: movmskps %xmm0, %eax
1768 ; X86-SSE2-NEXT: testl %eax, %eax
1769 ; X86-SSE2-NEXT: setne %al
1770 ; X86-SSE2-NEXT: movl %ebp, %esp
1771 ; X86-SSE2-NEXT: popl %ebp
1772 ; X86-SSE2-NEXT: retl
1774 ; X64-SSE2-LABEL: icmp_v4i64_v4i1:
1775 ; X64-SSE2: # %bb.0:
1776 ; X64-SSE2-NEXT: pcmpeqd %xmm3, %xmm1
1777 ; X64-SSE2-NEXT: pcmpeqd %xmm2, %xmm0
1778 ; X64-SSE2-NEXT: movdqa %xmm0, %xmm2
1779 ; X64-SSE2-NEXT: shufps {{.*#+}} xmm2 = xmm2[1,3],xmm1[1,3]
1780 ; X64-SSE2-NEXT: shufps {{.*#+}} xmm0 = xmm0[0,2],xmm1[0,2]
1781 ; X64-SSE2-NEXT: andps %xmm2, %xmm0
1782 ; X64-SSE2-NEXT: movmskps %xmm0, %eax
1783 ; X64-SSE2-NEXT: testl %eax, %eax
1784 ; X64-SSE2-NEXT: setne %al
1785 ; X64-SSE2-NEXT: retq
1787 ; SSE41-LABEL: icmp_v4i64_v4i1:
1789 ; SSE41-NEXT: pcmpeqq %xmm3, %xmm1
1790 ; SSE41-NEXT: pcmpeqq %xmm2, %xmm0
1791 ; SSE41-NEXT: packssdw %xmm1, %xmm0
1792 ; SSE41-NEXT: movmskps %xmm0, %eax
1793 ; SSE41-NEXT: testl %eax, %eax
1794 ; SSE41-NEXT: setne %al
1797 ; AVX1-LABEL: icmp_v4i64_v4i1:
1799 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
1800 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
1801 ; AVX1-NEXT: vpcmpeqq %xmm2, %xmm3, %xmm2
1802 ; AVX1-NEXT: vpcmpeqq %xmm1, %xmm0, %xmm0
1803 ; AVX1-NEXT: vpor %xmm2, %xmm0, %xmm0
1804 ; AVX1-NEXT: vtestpd %xmm0, %xmm0
1805 ; AVX1-NEXT: setne %al
1806 ; AVX1-NEXT: vzeroupper
1809 ; AVX2-LABEL: icmp_v4i64_v4i1:
1811 ; AVX2-NEXT: vpcmpeqq %ymm1, %ymm0, %ymm0
1812 ; AVX2-NEXT: vtestpd %ymm0, %ymm0
1813 ; AVX2-NEXT: setne %al
1814 ; AVX2-NEXT: vzeroupper
1817 ; AVX512F-LABEL: icmp_v4i64_v4i1:
1819 ; AVX512F-NEXT: # kill: def $ymm1 killed $ymm1 def $zmm1
1820 ; AVX512F-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
1821 ; AVX512F-NEXT: vpcmpeqq %zmm1, %zmm0, %k0
1822 ; AVX512F-NEXT: kmovw %k0, %eax
1823 ; AVX512F-NEXT: testb $15, %al
1824 ; AVX512F-NEXT: setne %al
1825 ; AVX512F-NEXT: vzeroupper
1826 ; AVX512F-NEXT: retq
1828 ; AVX512BW-LABEL: icmp_v4i64_v4i1:
1829 ; AVX512BW: # %bb.0:
1830 ; AVX512BW-NEXT: # kill: def $ymm1 killed $ymm1 def $zmm1
1831 ; AVX512BW-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
1832 ; AVX512BW-NEXT: vpcmpeqq %zmm1, %zmm0, %k0
1833 ; AVX512BW-NEXT: kmovd %k0, %eax
1834 ; AVX512BW-NEXT: testb $15, %al
1835 ; AVX512BW-NEXT: setne %al
1836 ; AVX512BW-NEXT: vzeroupper
1837 ; AVX512BW-NEXT: retq
1839 ; AVX512VL-LABEL: icmp_v4i64_v4i1:
1840 ; AVX512VL: # %bb.0:
1841 ; AVX512VL-NEXT: vpcmpeqq %ymm1, %ymm0, %k0
1842 ; AVX512VL-NEXT: kmovd %k0, %eax
1843 ; AVX512VL-NEXT: testb %al, %al
1844 ; AVX512VL-NEXT: setne %al
1845 ; AVX512VL-NEXT: vzeroupper
1846 ; AVX512VL-NEXT: retq
1847 %a = icmp eq <4 x i64> %0, %1
1848 %b = call i1 @llvm.vector.reduce.or.v4i1(<4 x i1> %a)
1852 define i1 @icmp_v8i32_v8i1(<8 x i32>, <8 x i32>) nounwind {
1853 ; X86-SSE2-LABEL: icmp_v8i32_v8i1:
1854 ; X86-SSE2: # %bb.0:
1855 ; X86-SSE2-NEXT: pushl %ebp
1856 ; X86-SSE2-NEXT: movl %esp, %ebp
1857 ; X86-SSE2-NEXT: andl $-16, %esp
1858 ; X86-SSE2-NEXT: subl $16, %esp
1859 ; X86-SSE2-NEXT: pcmpeqd %xmm2, %xmm0
1860 ; X86-SSE2-NEXT: pcmpeqd 8(%ebp), %xmm1
1861 ; X86-SSE2-NEXT: packssdw %xmm1, %xmm0
1862 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
1863 ; X86-SSE2-NEXT: testl %eax, %eax
1864 ; X86-SSE2-NEXT: setne %al
1865 ; X86-SSE2-NEXT: movl %ebp, %esp
1866 ; X86-SSE2-NEXT: popl %ebp
1867 ; X86-SSE2-NEXT: retl
1869 ; X64-SSE-LABEL: icmp_v8i32_v8i1:
1871 ; X64-SSE-NEXT: pcmpeqd %xmm3, %xmm1
1872 ; X64-SSE-NEXT: pcmpeqd %xmm2, %xmm0
1873 ; X64-SSE-NEXT: packssdw %xmm1, %xmm0
1874 ; X64-SSE-NEXT: pmovmskb %xmm0, %eax
1875 ; X64-SSE-NEXT: testl %eax, %eax
1876 ; X64-SSE-NEXT: setne %al
1877 ; X64-SSE-NEXT: retq
1879 ; AVX1-LABEL: icmp_v8i32_v8i1:
1881 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
1882 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
1883 ; AVX1-NEXT: vpcmpeqd %xmm2, %xmm3, %xmm2
1884 ; AVX1-NEXT: vpcmpeqd %xmm1, %xmm0, %xmm0
1885 ; AVX1-NEXT: vpor %xmm2, %xmm0, %xmm0
1886 ; AVX1-NEXT: vtestps %xmm0, %xmm0
1887 ; AVX1-NEXT: setne %al
1888 ; AVX1-NEXT: vzeroupper
1891 ; AVX2-LABEL: icmp_v8i32_v8i1:
1893 ; AVX2-NEXT: vpcmpeqd %ymm1, %ymm0, %ymm0
1894 ; AVX2-NEXT: vtestps %ymm0, %ymm0
1895 ; AVX2-NEXT: setne %al
1896 ; AVX2-NEXT: vzeroupper
1899 ; AVX512F-LABEL: icmp_v8i32_v8i1:
1901 ; AVX512F-NEXT: # kill: def $ymm1 killed $ymm1 def $zmm1
1902 ; AVX512F-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
1903 ; AVX512F-NEXT: vpcmpeqd %zmm1, %zmm0, %k0
1904 ; AVX512F-NEXT: kmovw %k0, %eax
1905 ; AVX512F-NEXT: testb %al, %al
1906 ; AVX512F-NEXT: setne %al
1907 ; AVX512F-NEXT: vzeroupper
1908 ; AVX512F-NEXT: retq
1910 ; AVX512BW-LABEL: icmp_v8i32_v8i1:
1911 ; AVX512BW: # %bb.0:
1912 ; AVX512BW-NEXT: # kill: def $ymm1 killed $ymm1 def $zmm1
1913 ; AVX512BW-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
1914 ; AVX512BW-NEXT: vpcmpeqd %zmm1, %zmm0, %k0
1915 ; AVX512BW-NEXT: kmovd %k0, %eax
1916 ; AVX512BW-NEXT: testb %al, %al
1917 ; AVX512BW-NEXT: setne %al
1918 ; AVX512BW-NEXT: vzeroupper
1919 ; AVX512BW-NEXT: retq
1921 ; AVX512VL-LABEL: icmp_v8i32_v8i1:
1922 ; AVX512VL: # %bb.0:
1923 ; AVX512VL-NEXT: vpcmpeqd %ymm1, %ymm0, %k0
1924 ; AVX512VL-NEXT: kmovd %k0, %eax
1925 ; AVX512VL-NEXT: testb %al, %al
1926 ; AVX512VL-NEXT: setne %al
1927 ; AVX512VL-NEXT: vzeroupper
1928 ; AVX512VL-NEXT: retq
1929 %a = icmp eq <8 x i32> %0, %1
1930 %b = call i1 @llvm.vector.reduce.or.v8i1(<8 x i1> %a)
1934 define i1 @icmp_v16i16_v16i1(<16 x i16>, <16 x i16>) nounwind {
1935 ; X86-SSE2-LABEL: icmp_v16i16_v16i1:
1936 ; X86-SSE2: # %bb.0:
1937 ; X86-SSE2-NEXT: pushl %ebp
1938 ; X86-SSE2-NEXT: movl %esp, %ebp
1939 ; X86-SSE2-NEXT: andl $-16, %esp
1940 ; X86-SSE2-NEXT: subl $16, %esp
1941 ; X86-SSE2-NEXT: pcmpeqw %xmm2, %xmm0
1942 ; X86-SSE2-NEXT: pcmpeqw 8(%ebp), %xmm1
1943 ; X86-SSE2-NEXT: packsswb %xmm1, %xmm0
1944 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
1945 ; X86-SSE2-NEXT: testl %eax, %eax
1946 ; X86-SSE2-NEXT: setne %al
1947 ; X86-SSE2-NEXT: movl %ebp, %esp
1948 ; X86-SSE2-NEXT: popl %ebp
1949 ; X86-SSE2-NEXT: retl
1951 ; X64-SSE-LABEL: icmp_v16i16_v16i1:
1953 ; X64-SSE-NEXT: pcmpeqw %xmm3, %xmm1
1954 ; X64-SSE-NEXT: pcmpeqw %xmm2, %xmm0
1955 ; X64-SSE-NEXT: packsswb %xmm1, %xmm0
1956 ; X64-SSE-NEXT: pmovmskb %xmm0, %eax
1957 ; X64-SSE-NEXT: testl %eax, %eax
1958 ; X64-SSE-NEXT: setne %al
1959 ; X64-SSE-NEXT: retq
1961 ; AVX1-LABEL: icmp_v16i16_v16i1:
1963 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
1964 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
1965 ; AVX1-NEXT: vpcmpeqw %xmm2, %xmm3, %xmm2
1966 ; AVX1-NEXT: vpcmpeqw %xmm1, %xmm0, %xmm0
1967 ; AVX1-NEXT: vpacksswb %xmm2, %xmm0, %xmm0
1968 ; AVX1-NEXT: vpmovmskb %xmm0, %eax
1969 ; AVX1-NEXT: testl %eax, %eax
1970 ; AVX1-NEXT: setne %al
1971 ; AVX1-NEXT: vzeroupper
1974 ; AVX2-LABEL: icmp_v16i16_v16i1:
1976 ; AVX2-NEXT: vpcmpeqw %ymm1, %ymm0, %ymm0
1977 ; AVX2-NEXT: vpmovmskb %ymm0, %eax
1978 ; AVX2-NEXT: testl %eax, %eax
1979 ; AVX2-NEXT: setne %al
1980 ; AVX2-NEXT: vzeroupper
1983 ; AVX512F-LABEL: icmp_v16i16_v16i1:
1985 ; AVX512F-NEXT: vpcmpeqw %ymm1, %ymm0, %ymm0
1986 ; AVX512F-NEXT: vpmovsxwd %ymm0, %zmm0
1987 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
1988 ; AVX512F-NEXT: kortestw %k0, %k0
1989 ; AVX512F-NEXT: setne %al
1990 ; AVX512F-NEXT: vzeroupper
1991 ; AVX512F-NEXT: retq
1993 ; AVX512BW-LABEL: icmp_v16i16_v16i1:
1994 ; AVX512BW: # %bb.0:
1995 ; AVX512BW-NEXT: # kill: def $ymm1 killed $ymm1 def $zmm1
1996 ; AVX512BW-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
1997 ; AVX512BW-NEXT: vpcmpeqw %zmm1, %zmm0, %k0
1998 ; AVX512BW-NEXT: kortestw %k0, %k0
1999 ; AVX512BW-NEXT: setne %al
2000 ; AVX512BW-NEXT: vzeroupper
2001 ; AVX512BW-NEXT: retq
2003 ; AVX512VL-LABEL: icmp_v16i16_v16i1:
2004 ; AVX512VL: # %bb.0:
2005 ; AVX512VL-NEXT: vpcmpeqw %ymm1, %ymm0, %k0
2006 ; AVX512VL-NEXT: kortestw %k0, %k0
2007 ; AVX512VL-NEXT: setne %al
2008 ; AVX512VL-NEXT: vzeroupper
2009 ; AVX512VL-NEXT: retq
2010 %a = icmp eq <16 x i16> %0, %1
2011 %b = call i1 @llvm.vector.reduce.or.v16i1(<16 x i1> %a)
2015 define i1 @icmp_v32i8_v32i1(<32 x i8>, <32 x i8>) nounwind {
2016 ; X86-SSE2-LABEL: icmp_v32i8_v32i1:
2017 ; X86-SSE2: # %bb.0:
2018 ; X86-SSE2-NEXT: pushl %ebp
2019 ; X86-SSE2-NEXT: movl %esp, %ebp
2020 ; X86-SSE2-NEXT: andl $-16, %esp
2021 ; X86-SSE2-NEXT: subl $16, %esp
2022 ; X86-SSE2-NEXT: pcmpeqb %xmm2, %xmm0
2023 ; X86-SSE2-NEXT: pcmpeqb 8(%ebp), %xmm1
2024 ; X86-SSE2-NEXT: por %xmm0, %xmm1
2025 ; X86-SSE2-NEXT: pmovmskb %xmm1, %eax
2026 ; X86-SSE2-NEXT: testl %eax, %eax
2027 ; X86-SSE2-NEXT: setne %al
2028 ; X86-SSE2-NEXT: movl %ebp, %esp
2029 ; X86-SSE2-NEXT: popl %ebp
2030 ; X86-SSE2-NEXT: retl
2032 ; X64-SSE-LABEL: icmp_v32i8_v32i1:
2034 ; X64-SSE-NEXT: pcmpeqb %xmm3, %xmm1
2035 ; X64-SSE-NEXT: pcmpeqb %xmm2, %xmm0
2036 ; X64-SSE-NEXT: por %xmm1, %xmm0
2037 ; X64-SSE-NEXT: pmovmskb %xmm0, %eax
2038 ; X64-SSE-NEXT: testl %eax, %eax
2039 ; X64-SSE-NEXT: setne %al
2040 ; X64-SSE-NEXT: retq
2042 ; AVX1-LABEL: icmp_v32i8_v32i1:
2044 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm2
2045 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm3
2046 ; AVX1-NEXT: vpcmpeqb %xmm2, %xmm3, %xmm2
2047 ; AVX1-NEXT: vpcmpeqb %xmm1, %xmm0, %xmm0
2048 ; AVX1-NEXT: vpor %xmm2, %xmm0, %xmm0
2049 ; AVX1-NEXT: vpmovmskb %xmm0, %eax
2050 ; AVX1-NEXT: testl %eax, %eax
2051 ; AVX1-NEXT: setne %al
2052 ; AVX1-NEXT: vzeroupper
2055 ; AVX2-LABEL: icmp_v32i8_v32i1:
2057 ; AVX2-NEXT: vpcmpeqb %ymm1, %ymm0, %ymm0
2058 ; AVX2-NEXT: vpmovmskb %ymm0, %eax
2059 ; AVX2-NEXT: testl %eax, %eax
2060 ; AVX2-NEXT: setne %al
2061 ; AVX2-NEXT: vzeroupper
2064 ; AVX512F-LABEL: icmp_v32i8_v32i1:
2066 ; AVX512F-NEXT: vpcmpeqb %ymm1, %ymm0, %ymm0
2067 ; AVX512F-NEXT: vpmovmskb %ymm0, %eax
2068 ; AVX512F-NEXT: testl %eax, %eax
2069 ; AVX512F-NEXT: setne %al
2070 ; AVX512F-NEXT: vzeroupper
2071 ; AVX512F-NEXT: retq
2073 ; AVX512BW-LABEL: icmp_v32i8_v32i1:
2074 ; AVX512BW: # %bb.0:
2075 ; AVX512BW-NEXT: # kill: def $ymm1 killed $ymm1 def $zmm1
2076 ; AVX512BW-NEXT: # kill: def $ymm0 killed $ymm0 def $zmm0
2077 ; AVX512BW-NEXT: vpcmpeqb %zmm1, %zmm0, %k0
2078 ; AVX512BW-NEXT: kortestd %k0, %k0
2079 ; AVX512BW-NEXT: setne %al
2080 ; AVX512BW-NEXT: vzeroupper
2081 ; AVX512BW-NEXT: retq
2083 ; AVX512VL-LABEL: icmp_v32i8_v32i1:
2084 ; AVX512VL: # %bb.0:
2085 ; AVX512VL-NEXT: vpcmpeqb %ymm1, %ymm0, %k0
2086 ; AVX512VL-NEXT: kortestd %k0, %k0
2087 ; AVX512VL-NEXT: setne %al
2088 ; AVX512VL-NEXT: vzeroupper
2089 ; AVX512VL-NEXT: retq
2090 %a = icmp eq <32 x i8> %0, %1
2091 %b = call i1 @llvm.vector.reduce.or.v32i1(<32 x i1> %a)
2095 define i1 @icmp_v8i64_v8i1(<8 x i64>, <8 x i64>) nounwind {
2096 ; X86-SSE2-LABEL: icmp_v8i64_v8i1:
2097 ; X86-SSE2: # %bb.0:
2098 ; X86-SSE2-NEXT: pushl %ebp
2099 ; X86-SSE2-NEXT: movl %esp, %ebp
2100 ; X86-SSE2-NEXT: andl $-16, %esp
2101 ; X86-SSE2-NEXT: subl $16, %esp
2102 ; X86-SSE2-NEXT: movdqa 8(%ebp), %xmm3
2103 ; X86-SSE2-NEXT: pcmpeqd 72(%ebp), %xmm3
2104 ; X86-SSE2-NEXT: pshufd {{.*#+}} xmm4 = xmm3[1,0,3,2]
2105 ; X86-SSE2-NEXT: pand %xmm3, %xmm4
2106 ; X86-SSE2-NEXT: pcmpeqd 56(%ebp), %xmm2
2107 ; X86-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm2[1,0,3,2]
2108 ; X86-SSE2-NEXT: pand %xmm2, %xmm3
2109 ; X86-SSE2-NEXT: packssdw %xmm4, %xmm3
2110 ; X86-SSE2-NEXT: pcmpeqd 40(%ebp), %xmm1
2111 ; X86-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm1[1,0,3,2]
2112 ; X86-SSE2-NEXT: pand %xmm1, %xmm2
2113 ; X86-SSE2-NEXT: pcmpeqd 24(%ebp), %xmm0
2114 ; X86-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,0,3,2]
2115 ; X86-SSE2-NEXT: pand %xmm0, %xmm1
2116 ; X86-SSE2-NEXT: packssdw %xmm2, %xmm1
2117 ; X86-SSE2-NEXT: packssdw %xmm3, %xmm1
2118 ; X86-SSE2-NEXT: pmovmskb %xmm1, %eax
2119 ; X86-SSE2-NEXT: testl $43690, %eax # imm = 0xAAAA
2120 ; X86-SSE2-NEXT: setne %al
2121 ; X86-SSE2-NEXT: movl %ebp, %esp
2122 ; X86-SSE2-NEXT: popl %ebp
2123 ; X86-SSE2-NEXT: retl
2125 ; X64-SSE2-LABEL: icmp_v8i64_v8i1:
2126 ; X64-SSE2: # %bb.0:
2127 ; X64-SSE2-NEXT: pcmpeqd %xmm7, %xmm3
2128 ; X64-SSE2-NEXT: pshufd {{.*#+}} xmm7 = xmm3[1,0,3,2]
2129 ; X64-SSE2-NEXT: pand %xmm3, %xmm7
2130 ; X64-SSE2-NEXT: pcmpeqd %xmm6, %xmm2
2131 ; X64-SSE2-NEXT: pshufd {{.*#+}} xmm3 = xmm2[1,0,3,2]
2132 ; X64-SSE2-NEXT: pand %xmm2, %xmm3
2133 ; X64-SSE2-NEXT: packssdw %xmm7, %xmm3
2134 ; X64-SSE2-NEXT: pcmpeqd %xmm5, %xmm1
2135 ; X64-SSE2-NEXT: pshufd {{.*#+}} xmm2 = xmm1[1,0,3,2]
2136 ; X64-SSE2-NEXT: pand %xmm1, %xmm2
2137 ; X64-SSE2-NEXT: pcmpeqd %xmm4, %xmm0
2138 ; X64-SSE2-NEXT: pshufd {{.*#+}} xmm1 = xmm0[1,0,3,2]
2139 ; X64-SSE2-NEXT: pand %xmm0, %xmm1
2140 ; X64-SSE2-NEXT: packssdw %xmm2, %xmm1
2141 ; X64-SSE2-NEXT: packssdw %xmm3, %xmm1
2142 ; X64-SSE2-NEXT: pmovmskb %xmm1, %eax
2143 ; X64-SSE2-NEXT: testl $43690, %eax # imm = 0xAAAA
2144 ; X64-SSE2-NEXT: setne %al
2145 ; X64-SSE2-NEXT: retq
2147 ; SSE41-LABEL: icmp_v8i64_v8i1:
2149 ; SSE41-NEXT: pcmpeqq %xmm7, %xmm3
2150 ; SSE41-NEXT: pcmpeqq %xmm6, %xmm2
2151 ; SSE41-NEXT: packssdw %xmm3, %xmm2
2152 ; SSE41-NEXT: pcmpeqq %xmm5, %xmm1
2153 ; SSE41-NEXT: pcmpeqq %xmm4, %xmm0
2154 ; SSE41-NEXT: packssdw %xmm1, %xmm0
2155 ; SSE41-NEXT: packssdw %xmm2, %xmm0
2156 ; SSE41-NEXT: pmovmskb %xmm0, %eax
2157 ; SSE41-NEXT: testl %eax, %eax
2158 ; SSE41-NEXT: setne %al
2161 ; AVX1-LABEL: icmp_v8i64_v8i1:
2163 ; AVX1-NEXT: vpcmpeqq %xmm3, %xmm1, %xmm4
2164 ; AVX1-NEXT: vpcmpeqq %xmm2, %xmm0, %xmm5
2165 ; AVX1-NEXT: vpor %xmm4, %xmm5, %xmm4
2166 ; AVX1-NEXT: vextractf128 $1, %ymm3, %xmm3
2167 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm1
2168 ; AVX1-NEXT: vpcmpeqq %xmm3, %xmm1, %xmm1
2169 ; AVX1-NEXT: vextractf128 $1, %ymm2, %xmm2
2170 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm0
2171 ; AVX1-NEXT: vpcmpeqq %xmm2, %xmm0, %xmm0
2172 ; AVX1-NEXT: vpor %xmm1, %xmm0, %xmm0
2173 ; AVX1-NEXT: vpackssdw %xmm0, %xmm4, %xmm0
2174 ; AVX1-NEXT: vtestps %xmm0, %xmm0
2175 ; AVX1-NEXT: setne %al
2176 ; AVX1-NEXT: vzeroupper
2179 ; AVX2-LABEL: icmp_v8i64_v8i1:
2181 ; AVX2-NEXT: vpcmpeqq %ymm3, %ymm1, %ymm1
2182 ; AVX2-NEXT: vpcmpeqq %ymm2, %ymm0, %ymm0
2183 ; AVX2-NEXT: vpackssdw %ymm1, %ymm0, %ymm0
2184 ; AVX2-NEXT: vtestps %ymm0, %ymm0
2185 ; AVX2-NEXT: setne %al
2186 ; AVX2-NEXT: vzeroupper
2189 ; AVX512F-LABEL: icmp_v8i64_v8i1:
2191 ; AVX512F-NEXT: vpcmpeqq %zmm1, %zmm0, %k0
2192 ; AVX512F-NEXT: kmovw %k0, %eax
2193 ; AVX512F-NEXT: testb %al, %al
2194 ; AVX512F-NEXT: setne %al
2195 ; AVX512F-NEXT: vzeroupper
2196 ; AVX512F-NEXT: retq
2198 ; AVX512BW-LABEL: icmp_v8i64_v8i1:
2199 ; AVX512BW: # %bb.0:
2200 ; AVX512BW-NEXT: vpcmpeqq %zmm1, %zmm0, %k0
2201 ; AVX512BW-NEXT: kmovd %k0, %eax
2202 ; AVX512BW-NEXT: testb %al, %al
2203 ; AVX512BW-NEXT: setne %al
2204 ; AVX512BW-NEXT: vzeroupper
2205 ; AVX512BW-NEXT: retq
2207 ; AVX512VL-LABEL: icmp_v8i64_v8i1:
2208 ; AVX512VL: # %bb.0:
2209 ; AVX512VL-NEXT: vpcmpeqq %zmm1, %zmm0, %k0
2210 ; AVX512VL-NEXT: kmovd %k0, %eax
2211 ; AVX512VL-NEXT: testb %al, %al
2212 ; AVX512VL-NEXT: setne %al
2213 ; AVX512VL-NEXT: vzeroupper
2214 ; AVX512VL-NEXT: retq
2215 %a = icmp eq <8 x i64> %0, %1
2216 %b = call i1 @llvm.vector.reduce.or.v8i1(<8 x i1> %a)
2220 define i1 @icmp_v16i32_v16i1(<16 x i32>, <16 x i32>) nounwind {
2221 ; X86-SSE2-LABEL: icmp_v16i32_v16i1:
2222 ; X86-SSE2: # %bb.0:
2223 ; X86-SSE2-NEXT: pushl %ebp
2224 ; X86-SSE2-NEXT: movl %esp, %ebp
2225 ; X86-SSE2-NEXT: andl $-16, %esp
2226 ; X86-SSE2-NEXT: subl $16, %esp
2227 ; X86-SSE2-NEXT: movdqa 8(%ebp), %xmm3
2228 ; X86-SSE2-NEXT: pcmpeqd 72(%ebp), %xmm3
2229 ; X86-SSE2-NEXT: pcmpeqd 56(%ebp), %xmm2
2230 ; X86-SSE2-NEXT: packssdw %xmm3, %xmm2
2231 ; X86-SSE2-NEXT: pcmpeqd 40(%ebp), %xmm1
2232 ; X86-SSE2-NEXT: pcmpeqd 24(%ebp), %xmm0
2233 ; X86-SSE2-NEXT: packssdw %xmm1, %xmm0
2234 ; X86-SSE2-NEXT: packsswb %xmm2, %xmm0
2235 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
2236 ; X86-SSE2-NEXT: testl %eax, %eax
2237 ; X86-SSE2-NEXT: setne %al
2238 ; X86-SSE2-NEXT: movl %ebp, %esp
2239 ; X86-SSE2-NEXT: popl %ebp
2240 ; X86-SSE2-NEXT: retl
2242 ; X64-SSE-LABEL: icmp_v16i32_v16i1:
2244 ; X64-SSE-NEXT: pcmpeqd %xmm7, %xmm3
2245 ; X64-SSE-NEXT: pcmpeqd %xmm6, %xmm2
2246 ; X64-SSE-NEXT: packssdw %xmm3, %xmm2
2247 ; X64-SSE-NEXT: pcmpeqd %xmm5, %xmm1
2248 ; X64-SSE-NEXT: pcmpeqd %xmm4, %xmm0
2249 ; X64-SSE-NEXT: packssdw %xmm1, %xmm0
2250 ; X64-SSE-NEXT: packsswb %xmm2, %xmm0
2251 ; X64-SSE-NEXT: pmovmskb %xmm0, %eax
2252 ; X64-SSE-NEXT: testl %eax, %eax
2253 ; X64-SSE-NEXT: setne %al
2254 ; X64-SSE-NEXT: retq
2256 ; AVX1-LABEL: icmp_v16i32_v16i1:
2258 ; AVX1-NEXT: vextractf128 $1, %ymm3, %xmm4
2259 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm5
2260 ; AVX1-NEXT: vpcmpeqd %xmm4, %xmm5, %xmm4
2261 ; AVX1-NEXT: vpcmpeqd %xmm3, %xmm1, %xmm1
2262 ; AVX1-NEXT: vpackssdw %xmm4, %xmm1, %xmm1
2263 ; AVX1-NEXT: vextractf128 $1, %ymm2, %xmm3
2264 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm4
2265 ; AVX1-NEXT: vpcmpeqd %xmm3, %xmm4, %xmm3
2266 ; AVX1-NEXT: vpcmpeqd %xmm2, %xmm0, %xmm0
2267 ; AVX1-NEXT: vpackssdw %xmm3, %xmm0, %xmm0
2268 ; AVX1-NEXT: vpacksswb %xmm1, %xmm0, %xmm0
2269 ; AVX1-NEXT: vpmovmskb %xmm0, %eax
2270 ; AVX1-NEXT: testl %eax, %eax
2271 ; AVX1-NEXT: setne %al
2272 ; AVX1-NEXT: vzeroupper
2275 ; AVX2-LABEL: icmp_v16i32_v16i1:
2277 ; AVX2-NEXT: vpcmpeqd %ymm3, %ymm1, %ymm1
2278 ; AVX2-NEXT: vpcmpeqd %ymm2, %ymm0, %ymm0
2279 ; AVX2-NEXT: vpackssdw %ymm1, %ymm0, %ymm0
2280 ; AVX2-NEXT: vpmovmskb %ymm0, %eax
2281 ; AVX2-NEXT: testl %eax, %eax
2282 ; AVX2-NEXT: setne %al
2283 ; AVX2-NEXT: vzeroupper
2286 ; AVX512-LABEL: icmp_v16i32_v16i1:
2288 ; AVX512-NEXT: vpcmpeqd %zmm1, %zmm0, %k0
2289 ; AVX512-NEXT: kortestw %k0, %k0
2290 ; AVX512-NEXT: setne %al
2291 ; AVX512-NEXT: vzeroupper
2293 %a = icmp eq <16 x i32> %0, %1
2294 %b = call i1 @llvm.vector.reduce.or.v16i1(<16 x i1> %a)
2298 define i1 @icmp_v32i16_v32i1(<32 x i16>, <32 x i16>) nounwind {
2299 ; X86-SSE2-LABEL: icmp_v32i16_v32i1:
2300 ; X86-SSE2: # %bb.0:
2301 ; X86-SSE2-NEXT: pushl %ebp
2302 ; X86-SSE2-NEXT: movl %esp, %ebp
2303 ; X86-SSE2-NEXT: andl $-16, %esp
2304 ; X86-SSE2-NEXT: subl $16, %esp
2305 ; X86-SSE2-NEXT: movdqa 8(%ebp), %xmm3
2306 ; X86-SSE2-NEXT: pcmpeqw 56(%ebp), %xmm2
2307 ; X86-SSE2-NEXT: pcmpeqw 24(%ebp), %xmm0
2308 ; X86-SSE2-NEXT: por %xmm2, %xmm0
2309 ; X86-SSE2-NEXT: pcmpeqw 72(%ebp), %xmm3
2310 ; X86-SSE2-NEXT: pcmpeqw 40(%ebp), %xmm1
2311 ; X86-SSE2-NEXT: por %xmm3, %xmm1
2312 ; X86-SSE2-NEXT: packsswb %xmm1, %xmm0
2313 ; X86-SSE2-NEXT: pmovmskb %xmm0, %eax
2314 ; X86-SSE2-NEXT: testl %eax, %eax
2315 ; X86-SSE2-NEXT: setne %al
2316 ; X86-SSE2-NEXT: movl %ebp, %esp
2317 ; X86-SSE2-NEXT: popl %ebp
2318 ; X86-SSE2-NEXT: retl
2320 ; X64-SSE-LABEL: icmp_v32i16_v32i1:
2322 ; X64-SSE-NEXT: pcmpeqw %xmm6, %xmm2
2323 ; X64-SSE-NEXT: pcmpeqw %xmm4, %xmm0
2324 ; X64-SSE-NEXT: por %xmm2, %xmm0
2325 ; X64-SSE-NEXT: pcmpeqw %xmm7, %xmm3
2326 ; X64-SSE-NEXT: pcmpeqw %xmm5, %xmm1
2327 ; X64-SSE-NEXT: por %xmm3, %xmm1
2328 ; X64-SSE-NEXT: packsswb %xmm1, %xmm0
2329 ; X64-SSE-NEXT: pmovmskb %xmm0, %eax
2330 ; X64-SSE-NEXT: testl %eax, %eax
2331 ; X64-SSE-NEXT: setne %al
2332 ; X64-SSE-NEXT: retq
2334 ; AVX1-LABEL: icmp_v32i16_v32i1:
2336 ; AVX1-NEXT: vpcmpeqw %xmm3, %xmm1, %xmm4
2337 ; AVX1-NEXT: vpcmpeqw %xmm2, %xmm0, %xmm5
2338 ; AVX1-NEXT: vpor %xmm4, %xmm5, %xmm4
2339 ; AVX1-NEXT: vextractf128 $1, %ymm3, %xmm3
2340 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm1
2341 ; AVX1-NEXT: vpcmpeqw %xmm3, %xmm1, %xmm1
2342 ; AVX1-NEXT: vextractf128 $1, %ymm2, %xmm2
2343 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm0
2344 ; AVX1-NEXT: vpcmpeqw %xmm2, %xmm0, %xmm0
2345 ; AVX1-NEXT: vpor %xmm1, %xmm0, %xmm0
2346 ; AVX1-NEXT: vpacksswb %xmm0, %xmm4, %xmm0
2347 ; AVX1-NEXT: vpmovmskb %xmm0, %eax
2348 ; AVX1-NEXT: testl %eax, %eax
2349 ; AVX1-NEXT: setne %al
2350 ; AVX1-NEXT: vzeroupper
2353 ; AVX2-LABEL: icmp_v32i16_v32i1:
2355 ; AVX2-NEXT: vpcmpeqw %ymm3, %ymm1, %ymm1
2356 ; AVX2-NEXT: vpcmpeqw %ymm2, %ymm0, %ymm0
2357 ; AVX2-NEXT: vpacksswb %ymm1, %ymm0, %ymm0
2358 ; AVX2-NEXT: vpmovmskb %ymm0, %eax
2359 ; AVX2-NEXT: testl %eax, %eax
2360 ; AVX2-NEXT: setne %al
2361 ; AVX2-NEXT: vzeroupper
2364 ; AVX512F-LABEL: icmp_v32i16_v32i1:
2366 ; AVX512F-NEXT: vextracti64x4 $1, %zmm1, %ymm2
2367 ; AVX512F-NEXT: vextracti64x4 $1, %zmm0, %ymm3
2368 ; AVX512F-NEXT: vpcmpeqw %ymm2, %ymm3, %ymm2
2369 ; AVX512F-NEXT: vpcmpeqw %ymm1, %ymm0, %ymm0
2370 ; AVX512F-NEXT: vpor %ymm2, %ymm0, %ymm0
2371 ; AVX512F-NEXT: vpmovsxwd %ymm0, %zmm0
2372 ; AVX512F-NEXT: vptestmd %zmm0, %zmm0, %k0
2373 ; AVX512F-NEXT: kortestw %k0, %k0
2374 ; AVX512F-NEXT: setne %al
2375 ; AVX512F-NEXT: vzeroupper
2376 ; AVX512F-NEXT: retq
2378 ; AVX512BW-LABEL: icmp_v32i16_v32i1:
2379 ; AVX512BW: # %bb.0:
2380 ; AVX512BW-NEXT: vpcmpeqw %zmm1, %zmm0, %k0
2381 ; AVX512BW-NEXT: kortestd %k0, %k0
2382 ; AVX512BW-NEXT: setne %al
2383 ; AVX512BW-NEXT: vzeroupper
2384 ; AVX512BW-NEXT: retq
2386 ; AVX512VL-LABEL: icmp_v32i16_v32i1:
2387 ; AVX512VL: # %bb.0:
2388 ; AVX512VL-NEXT: vpcmpeqw %zmm1, %zmm0, %k0
2389 ; AVX512VL-NEXT: kortestd %k0, %k0
2390 ; AVX512VL-NEXT: setne %al
2391 ; AVX512VL-NEXT: vzeroupper
2392 ; AVX512VL-NEXT: retq
2393 %a = icmp eq <32 x i16> %0, %1
2394 %b = call i1 @llvm.vector.reduce.or.v32i1(<32 x i1> %a)
2398 define i1 @icmp_v64i8_v64i1(<64 x i8>, <64 x i8>) nounwind {
2399 ; X86-SSE2-LABEL: icmp_v64i8_v64i1:
2400 ; X86-SSE2: # %bb.0:
2401 ; X86-SSE2-NEXT: pushl %ebp
2402 ; X86-SSE2-NEXT: movl %esp, %ebp
2403 ; X86-SSE2-NEXT: andl $-16, %esp
2404 ; X86-SSE2-NEXT: subl $16, %esp
2405 ; X86-SSE2-NEXT: movdqa 8(%ebp), %xmm3
2406 ; X86-SSE2-NEXT: pcmpeqb 56(%ebp), %xmm2
2407 ; X86-SSE2-NEXT: pcmpeqb 24(%ebp), %xmm0
2408 ; X86-SSE2-NEXT: por %xmm2, %xmm0
2409 ; X86-SSE2-NEXT: pcmpeqb 72(%ebp), %xmm3
2410 ; X86-SSE2-NEXT: pcmpeqb 40(%ebp), %xmm1
2411 ; X86-SSE2-NEXT: por %xmm3, %xmm1
2412 ; X86-SSE2-NEXT: por %xmm0, %xmm1
2413 ; X86-SSE2-NEXT: pmovmskb %xmm1, %eax
2414 ; X86-SSE2-NEXT: testl %eax, %eax
2415 ; X86-SSE2-NEXT: setne %al
2416 ; X86-SSE2-NEXT: movl %ebp, %esp
2417 ; X86-SSE2-NEXT: popl %ebp
2418 ; X86-SSE2-NEXT: retl
2420 ; X64-SSE-LABEL: icmp_v64i8_v64i1:
2422 ; X64-SSE-NEXT: pcmpeqb %xmm6, %xmm2
2423 ; X64-SSE-NEXT: pcmpeqb %xmm4, %xmm0
2424 ; X64-SSE-NEXT: por %xmm2, %xmm0
2425 ; X64-SSE-NEXT: pcmpeqb %xmm7, %xmm3
2426 ; X64-SSE-NEXT: pcmpeqb %xmm5, %xmm1
2427 ; X64-SSE-NEXT: por %xmm3, %xmm1
2428 ; X64-SSE-NEXT: por %xmm0, %xmm1
2429 ; X64-SSE-NEXT: pmovmskb %xmm1, %eax
2430 ; X64-SSE-NEXT: testl %eax, %eax
2431 ; X64-SSE-NEXT: setne %al
2432 ; X64-SSE-NEXT: retq
2434 ; AVX1-LABEL: icmp_v64i8_v64i1:
2436 ; AVX1-NEXT: vpcmpeqb %xmm3, %xmm1, %xmm4
2437 ; AVX1-NEXT: vpcmpeqb %xmm2, %xmm0, %xmm5
2438 ; AVX1-NEXT: vpor %xmm4, %xmm5, %xmm4
2439 ; AVX1-NEXT: vextractf128 $1, %ymm3, %xmm3
2440 ; AVX1-NEXT: vextractf128 $1, %ymm1, %xmm1
2441 ; AVX1-NEXT: vpcmpeqb %xmm3, %xmm1, %xmm1
2442 ; AVX1-NEXT: vextractf128 $1, %ymm2, %xmm2
2443 ; AVX1-NEXT: vextractf128 $1, %ymm0, %xmm0
2444 ; AVX1-NEXT: vpcmpeqb %xmm2, %xmm0, %xmm0
2445 ; AVX1-NEXT: vpor %xmm1, %xmm0, %xmm0
2446 ; AVX1-NEXT: vpor %xmm0, %xmm4, %xmm0
2447 ; AVX1-NEXT: vpmovmskb %xmm0, %eax
2448 ; AVX1-NEXT: testl %eax, %eax
2449 ; AVX1-NEXT: setne %al
2450 ; AVX1-NEXT: vzeroupper
2453 ; AVX2-LABEL: icmp_v64i8_v64i1:
2455 ; AVX2-NEXT: vpcmpeqb %ymm3, %ymm1, %ymm1
2456 ; AVX2-NEXT: vpcmpeqb %ymm2, %ymm0, %ymm0
2457 ; AVX2-NEXT: vpor %ymm1, %ymm0, %ymm0
2458 ; AVX2-NEXT: vpmovmskb %ymm0, %eax
2459 ; AVX2-NEXT: testl %eax, %eax
2460 ; AVX2-NEXT: setne %al
2461 ; AVX2-NEXT: vzeroupper
2464 ; AVX512F-LABEL: icmp_v64i8_v64i1:
2466 ; AVX512F-NEXT: vextracti64x4 $1, %zmm1, %ymm2
2467 ; AVX512F-NEXT: vextracti64x4 $1, %zmm0, %ymm3
2468 ; AVX512F-NEXT: vpcmpeqb %ymm2, %ymm3, %ymm2
2469 ; AVX512F-NEXT: vpcmpeqb %ymm1, %ymm0, %ymm0
2470 ; AVX512F-NEXT: vpor %ymm2, %ymm0, %ymm0
2471 ; AVX512F-NEXT: vpmovmskb %ymm0, %eax
2472 ; AVX512F-NEXT: testl %eax, %eax
2473 ; AVX512F-NEXT: setne %al
2474 ; AVX512F-NEXT: vzeroupper
2475 ; AVX512F-NEXT: retq
2477 ; AVX512BW-LABEL: icmp_v64i8_v64i1:
2478 ; AVX512BW: # %bb.0:
2479 ; AVX512BW-NEXT: vpcmpeqb %zmm1, %zmm0, %k0
2480 ; AVX512BW-NEXT: kortestq %k0, %k0
2481 ; AVX512BW-NEXT: setne %al
2482 ; AVX512BW-NEXT: vzeroupper
2483 ; AVX512BW-NEXT: retq
2485 ; AVX512VL-LABEL: icmp_v64i8_v64i1:
2486 ; AVX512VL: # %bb.0:
2487 ; AVX512VL-NEXT: vpcmpeqb %zmm1, %zmm0, %k0
2488 ; AVX512VL-NEXT: kortestq %k0, %k0
2489 ; AVX512VL-NEXT: setne %al
2490 ; AVX512VL-NEXT: vzeroupper
2491 ; AVX512VL-NEXT: retq
2492 %a = icmp eq <64 x i8> %0, %1
2493 %b = call i1 @llvm.vector.reduce.or.v64i1(<64 x i1> %a)
2497 declare i1 @llvm.vector.reduce.or.v2i1(<2 x i1>)
2498 declare i1 @llvm.vector.reduce.or.v4i1(<4 x i1>)
2499 declare i1 @llvm.vector.reduce.or.v8i1(<8 x i1>)
2500 declare i1 @llvm.vector.reduce.or.v16i1(<16 x i1>)
2501 declare i1 @llvm.vector.reduce.or.v32i1(<32 x i1>)
2502 declare i1 @llvm.vector.reduce.or.v64i1(<64 x i1>)
2503 ;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: