1 ; NOTE: Assertions have been autogenerated by utils/update_llc_test_checks.py
2 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown | FileCheck %s --check-prefixes=CHECK,NOBMI
3 ; RUN: llc < %s -mtriple=x86_64-unknown-unknown -mattr=+bmi | FileCheck %s --check-prefixes=CHECK,BMI
5 define zeroext i1 @all_bits_clear(i32 %P, i32 %Q) nounwind {
6 ; CHECK-LABEL: all_bits_clear:
8 ; CHECK-NEXT: orl %esi, %edi
11 %a = icmp eq i32 %P, 0
12 %b = icmp eq i32 %Q, 0
17 define zeroext i1 @all_sign_bits_clear(i32 %P, i32 %Q) nounwind {
18 ; CHECK-LABEL: all_sign_bits_clear:
20 ; CHECK-NEXT: orl %esi, %edi
21 ; CHECK-NEXT: setns %al
23 %a = icmp sgt i32 %P, -1
24 %b = icmp sgt i32 %Q, -1
29 define zeroext i1 @all_bits_set(i32 %P, i32 %Q) nounwind {
30 ; CHECK-LABEL: all_bits_set:
32 ; CHECK-NEXT: andl %esi, %edi
33 ; CHECK-NEXT: cmpl $-1, %edi
34 ; CHECK-NEXT: sete %al
36 %a = icmp eq i32 %P, -1
37 %b = icmp eq i32 %Q, -1
42 define zeroext i1 @all_sign_bits_set(i32 %P, i32 %Q) nounwind {
43 ; CHECK-LABEL: all_sign_bits_set:
45 ; CHECK-NEXT: movl %edi, %eax
46 ; CHECK-NEXT: andl %esi, %eax
47 ; CHECK-NEXT: shrl $31, %eax
48 ; CHECK-NEXT: # kill: def $al killed $al killed $eax
50 %a = icmp slt i32 %P, 0
51 %b = icmp slt i32 %Q, 0
56 define zeroext i1 @any_bits_set(i32 %P, i32 %Q) nounwind {
57 ; CHECK-LABEL: any_bits_set:
59 ; CHECK-NEXT: orl %esi, %edi
60 ; CHECK-NEXT: setne %al
62 %a = icmp ne i32 %P, 0
63 %b = icmp ne i32 %Q, 0
68 define zeroext i1 @any_sign_bits_set(i32 %P, i32 %Q) nounwind {
69 ; CHECK-LABEL: any_sign_bits_set:
71 ; CHECK-NEXT: movl %edi, %eax
72 ; CHECK-NEXT: orl %esi, %eax
73 ; CHECK-NEXT: shrl $31, %eax
74 ; CHECK-NEXT: # kill: def $al killed $al killed $eax
76 %a = icmp slt i32 %P, 0
77 %b = icmp slt i32 %Q, 0
82 define zeroext i1 @any_bits_clear(i32 %P, i32 %Q) nounwind {
83 ; CHECK-LABEL: any_bits_clear:
85 ; CHECK-NEXT: andl %esi, %edi
86 ; CHECK-NEXT: cmpl $-1, %edi
87 ; CHECK-NEXT: setne %al
89 %a = icmp ne i32 %P, -1
90 %b = icmp ne i32 %Q, -1
95 define zeroext i1 @any_sign_bits_clear(i32 %P, i32 %Q) nounwind {
96 ; CHECK-LABEL: any_sign_bits_clear:
98 ; CHECK-NEXT: testl %esi, %edi
99 ; CHECK-NEXT: setns %al
101 %a = icmp sgt i32 %P, -1
102 %b = icmp sgt i32 %Q, -1
107 ; PR3351 - (P == 0) & (Q == 0) -> (P|Q) == 0
108 define i32 @all_bits_clear_branch(ptr %P, ptr %Q) nounwind {
109 ; CHECK-LABEL: all_bits_clear_branch:
110 ; CHECK: # %bb.0: # %entry
111 ; CHECK-NEXT: orq %rsi, %rdi
112 ; CHECK-NEXT: jne .LBB8_2
113 ; CHECK-NEXT: # %bb.1: # %bb1
114 ; CHECK-NEXT: movl $4, %eax
116 ; CHECK-NEXT: .LBB8_2: # %return
117 ; CHECK-NEXT: movl $192, %eax
120 %a = icmp eq ptr %P, null
121 %b = icmp eq ptr %Q, null
123 br i1 %c, label %bb1, label %return
132 define i32 @all_sign_bits_clear_branch(i32 %P, i32 %Q) nounwind {
133 ; CHECK-LABEL: all_sign_bits_clear_branch:
134 ; CHECK: # %bb.0: # %entry
135 ; CHECK-NEXT: testl %edi, %edi
136 ; CHECK-NEXT: js .LBB9_3
137 ; CHECK-NEXT: # %bb.1: # %entry
138 ; CHECK-NEXT: testl %esi, %esi
139 ; CHECK-NEXT: js .LBB9_3
140 ; CHECK-NEXT: # %bb.2: # %bb1
141 ; CHECK-NEXT: movl $4, %eax
143 ; CHECK-NEXT: .LBB9_3: # %return
144 ; CHECK-NEXT: movl $192, %eax
147 %a = icmp sgt i32 %P, -1
148 %b = icmp sgt i32 %Q, -1
150 br i1 %c, label %bb1, label %return
159 define i32 @all_bits_set_branch(i32 %P, i32 %Q) nounwind {
160 ; CHECK-LABEL: all_bits_set_branch:
161 ; CHECK: # %bb.0: # %entry
162 ; CHECK-NEXT: cmpl $-1, %edi
163 ; CHECK-NEXT: jne .LBB10_3
164 ; CHECK-NEXT: # %bb.1: # %entry
165 ; CHECK-NEXT: cmpl $-1, %esi
166 ; CHECK-NEXT: jne .LBB10_3
167 ; CHECK-NEXT: # %bb.2: # %bb1
168 ; CHECK-NEXT: movl $4, %eax
170 ; CHECK-NEXT: .LBB10_3: # %return
171 ; CHECK-NEXT: movl $192, %eax
174 %a = icmp eq i32 %P, -1
175 %b = icmp eq i32 %Q, -1
177 br i1 %c, label %bb1, label %return
186 define i32 @all_sign_bits_set_branch(i32 %P, i32 %Q) nounwind {
187 ; CHECK-LABEL: all_sign_bits_set_branch:
188 ; CHECK: # %bb.0: # %entry
189 ; CHECK-NEXT: testl %edi, %edi
190 ; CHECK-NEXT: jns .LBB11_3
191 ; CHECK-NEXT: # %bb.1: # %entry
192 ; CHECK-NEXT: testl %esi, %esi
193 ; CHECK-NEXT: jns .LBB11_3
194 ; CHECK-NEXT: # %bb.2: # %bb1
195 ; CHECK-NEXT: movl $4, %eax
197 ; CHECK-NEXT: .LBB11_3: # %return
198 ; CHECK-NEXT: movl $192, %eax
201 %a = icmp slt i32 %P, 0
202 %b = icmp slt i32 %Q, 0
204 br i1 %c, label %bb1, label %return
213 ; PR3351 - (P != 0) | (Q != 0) -> (P|Q) != 0
214 define i32 @any_bits_set_branch(ptr %P, ptr %Q) nounwind {
215 ; CHECK-LABEL: any_bits_set_branch:
216 ; CHECK: # %bb.0: # %entry
217 ; CHECK-NEXT: orq %rsi, %rdi
218 ; CHECK-NEXT: je .LBB12_2
219 ; CHECK-NEXT: # %bb.1: # %bb1
220 ; CHECK-NEXT: movl $4, %eax
222 ; CHECK-NEXT: .LBB12_2: # %return
223 ; CHECK-NEXT: movl $192, %eax
226 %a = icmp ne ptr %P, null
227 %b = icmp ne ptr %Q, null
229 br i1 %c, label %bb1, label %return
238 define i32 @any_sign_bits_set_branch(i32 %P, i32 %Q) nounwind {
239 ; CHECK-LABEL: any_sign_bits_set_branch:
240 ; CHECK: # %bb.0: # %entry
241 ; CHECK-NEXT: testl %edi, %edi
242 ; CHECK-NEXT: js .LBB13_2
243 ; CHECK-NEXT: # %bb.1: # %entry
244 ; CHECK-NEXT: testl %esi, %esi
245 ; CHECK-NEXT: js .LBB13_2
246 ; CHECK-NEXT: # %bb.3: # %return
247 ; CHECK-NEXT: movl $192, %eax
249 ; CHECK-NEXT: .LBB13_2: # %bb1
250 ; CHECK-NEXT: movl $4, %eax
253 %a = icmp slt i32 %P, 0
254 %b = icmp slt i32 %Q, 0
256 br i1 %c, label %bb1, label %return
265 define i32 @any_bits_clear_branch(i32 %P, i32 %Q) nounwind {
266 ; CHECK-LABEL: any_bits_clear_branch:
267 ; CHECK: # %bb.0: # %entry
268 ; CHECK-NEXT: cmpl $-1, %edi
269 ; CHECK-NEXT: jne .LBB14_2
270 ; CHECK-NEXT: # %bb.1: # %entry
271 ; CHECK-NEXT: cmpl $-1, %esi
272 ; CHECK-NEXT: jne .LBB14_2
273 ; CHECK-NEXT: # %bb.3: # %return
274 ; CHECK-NEXT: movl $192, %eax
276 ; CHECK-NEXT: .LBB14_2: # %bb1
277 ; CHECK-NEXT: movl $4, %eax
280 %a = icmp ne i32 %P, -1
281 %b = icmp ne i32 %Q, -1
283 br i1 %c, label %bb1, label %return
292 define i32 @any_sign_bits_clear_branch(i32 %P, i32 %Q) nounwind {
293 ; CHECK-LABEL: any_sign_bits_clear_branch:
294 ; CHECK: # %bb.0: # %entry
295 ; CHECK-NEXT: testl %edi, %edi
296 ; CHECK-NEXT: jns .LBB15_2
297 ; CHECK-NEXT: # %bb.1: # %entry
298 ; CHECK-NEXT: testl %esi, %esi
299 ; CHECK-NEXT: jns .LBB15_2
300 ; CHECK-NEXT: # %bb.3: # %return
301 ; CHECK-NEXT: movl $192, %eax
303 ; CHECK-NEXT: .LBB15_2: # %bb1
304 ; CHECK-NEXT: movl $4, %eax
307 %a = icmp sgt i32 %P, -1
308 %b = icmp sgt i32 %Q, -1
310 br i1 %c, label %bb1, label %return
319 ; PR44565 - https://bugs.llvm.org/show_bug.cgi?id=44565
321 define i32 @vec_extract_branch(<2 x double> %x) {
322 ; CHECK-LABEL: vec_extract_branch:
324 ; CHECK-NEXT: xorpd %xmm1, %xmm1
325 ; CHECK-NEXT: cmpltpd %xmm0, %xmm1
326 ; CHECK-NEXT: movmskpd %xmm1, %eax
327 ; CHECK-NEXT: cmpl $3, %eax
328 ; CHECK-NEXT: jne .LBB16_2
329 ; CHECK-NEXT: # %bb.1: # %true
330 ; CHECK-NEXT: movl $42, %eax
332 ; CHECK-NEXT: .LBB16_2: # %false
333 ; CHECK-NEXT: movl $88, %eax
335 %t1 = fcmp ogt <2 x double> %x, zeroinitializer
336 %t2 = extractelement <2 x i1> %t1, i32 0
337 %t3 = extractelement <2 x i1> %t1, i32 1
338 %t4 = and i1 %t2, %t3
339 br i1 %t4, label %true, label %false
346 define <4 x i1> @all_bits_clear_vec(<4 x i32> %P, <4 x i32> %Q) nounwind {
347 ; CHECK-LABEL: all_bits_clear_vec:
349 ; CHECK-NEXT: por %xmm1, %xmm0
350 ; CHECK-NEXT: pxor %xmm1, %xmm1
351 ; CHECK-NEXT: pcmpeqd %xmm1, %xmm0
353 %a = icmp eq <4 x i32> %P, zeroinitializer
354 %b = icmp eq <4 x i32> %Q, zeroinitializer
355 %c = and <4 x i1> %a, %b
359 define <4 x i1> @all_sign_bits_clear_vec(<4 x i32> %P, <4 x i32> %Q) nounwind {
360 ; CHECK-LABEL: all_sign_bits_clear_vec:
362 ; CHECK-NEXT: por %xmm1, %xmm0
363 ; CHECK-NEXT: pcmpeqd %xmm1, %xmm1
364 ; CHECK-NEXT: pcmpgtd %xmm1, %xmm0
366 %a = icmp sgt <4 x i32> %P, <i32 -1, i32 -1, i32 -1, i32 -1>
367 %b = icmp sgt <4 x i32> %Q, <i32 -1, i32 -1, i32 -1, i32 -1>
368 %c = and <4 x i1> %a, %b
372 define <4 x i1> @all_bits_set_vec(<4 x i32> %P, <4 x i32> %Q) nounwind {
373 ; CHECK-LABEL: all_bits_set_vec:
375 ; CHECK-NEXT: pand %xmm1, %xmm0
376 ; CHECK-NEXT: pcmpeqd %xmm1, %xmm1
377 ; CHECK-NEXT: pcmpeqd %xmm1, %xmm0
379 %a = icmp eq <4 x i32> %P, <i32 -1, i32 -1, i32 -1, i32 -1>
380 %b = icmp eq <4 x i32> %Q, <i32 -1, i32 -1, i32 -1, i32 -1>
381 %c = and <4 x i1> %a, %b
385 define <4 x i1> @all_sign_bits_set_vec(<4 x i32> %P, <4 x i32> %Q) nounwind {
386 ; CHECK-LABEL: all_sign_bits_set_vec:
388 ; CHECK-NEXT: pand %xmm1, %xmm0
389 ; CHECK-NEXT: pxor %xmm1, %xmm1
390 ; CHECK-NEXT: pcmpgtd %xmm0, %xmm1
391 ; CHECK-NEXT: movdqa %xmm1, %xmm0
393 %a = icmp slt <4 x i32> %P, zeroinitializer
394 %b = icmp slt <4 x i32> %Q, zeroinitializer
395 %c = and <4 x i1> %a, %b
399 define <4 x i1> @any_bits_set_vec(<4 x i32> %P, <4 x i32> %Q) nounwind {
400 ; CHECK-LABEL: any_bits_set_vec:
402 ; CHECK-NEXT: por %xmm1, %xmm0
403 ; CHECK-NEXT: pxor %xmm1, %xmm1
404 ; CHECK-NEXT: pcmpeqd %xmm1, %xmm0
405 ; CHECK-NEXT: pcmpeqd %xmm1, %xmm1
406 ; CHECK-NEXT: pxor %xmm1, %xmm0
408 %a = icmp ne <4 x i32> %P, zeroinitializer
409 %b = icmp ne <4 x i32> %Q, zeroinitializer
410 %c = or <4 x i1> %a, %b
414 define <4 x i1> @any_sign_bits_set_vec(<4 x i32> %P, <4 x i32> %Q) nounwind {
415 ; CHECK-LABEL: any_sign_bits_set_vec:
417 ; CHECK-NEXT: por %xmm1, %xmm0
418 ; CHECK-NEXT: pxor %xmm1, %xmm1
419 ; CHECK-NEXT: pcmpgtd %xmm0, %xmm1
420 ; CHECK-NEXT: movdqa %xmm1, %xmm0
422 %a = icmp slt <4 x i32> %P, zeroinitializer
423 %b = icmp slt <4 x i32> %Q, zeroinitializer
424 %c = or <4 x i1> %a, %b
428 define <4 x i1> @any_bits_clear_vec(<4 x i32> %P, <4 x i32> %Q) nounwind {
429 ; CHECK-LABEL: any_bits_clear_vec:
431 ; CHECK-NEXT: pand %xmm1, %xmm0
432 ; CHECK-NEXT: pcmpeqd %xmm1, %xmm1
433 ; CHECK-NEXT: pcmpeqd %xmm1, %xmm0
434 ; CHECK-NEXT: pxor %xmm1, %xmm0
436 %a = icmp ne <4 x i32> %P, <i32 -1, i32 -1, i32 -1, i32 -1>
437 %b = icmp ne <4 x i32> %Q, <i32 -1, i32 -1, i32 -1, i32 -1>
438 %c = or <4 x i1> %a, %b
442 define <4 x i1> @any_sign_bits_clear_vec(<4 x i32> %P, <4 x i32> %Q) nounwind {
443 ; CHECK-LABEL: any_sign_bits_clear_vec:
445 ; CHECK-NEXT: pand %xmm1, %xmm0
446 ; CHECK-NEXT: pcmpeqd %xmm1, %xmm1
447 ; CHECK-NEXT: pcmpgtd %xmm1, %xmm0
449 %a = icmp sgt <4 x i32> %P, <i32 -1, i32 -1, i32 -1, i32 -1>
450 %b = icmp sgt <4 x i32> %Q, <i32 -1, i32 -1, i32 -1, i32 -1>
451 %c = or <4 x i1> %a, %b
455 define zeroext i1 @ne_neg1_and_ne_zero(i64 %x) nounwind {
456 ; CHECK-LABEL: ne_neg1_and_ne_zero:
458 ; CHECK-NEXT: incq %rdi
459 ; CHECK-NEXT: testq $-2, %rdi
460 ; CHECK-NEXT: setne %al
462 %cmp1 = icmp ne i64 %x, -1
463 %cmp2 = icmp ne i64 %x, 0
464 %and = and i1 %cmp1, %cmp2
468 ; PR32401 - https://bugs.llvm.org/show_bug.cgi?id=32401
470 define zeroext i1 @and_eq(i8 %a, i8 %b, i8 %c, i8 %d) nounwind {
471 ; CHECK-LABEL: and_eq:
473 ; CHECK-NEXT: xorl %esi, %edi
474 ; CHECK-NEXT: xorl %ecx, %edx
475 ; CHECK-NEXT: orb %dl, %dil
476 ; CHECK-NEXT: sete %al
478 %cmp1 = icmp eq i8 %a, %b
479 %cmp2 = icmp eq i8 %c, %d
480 %and = and i1 %cmp1, %cmp2
484 define zeroext i1 @or_ne(i8 %a, i8 %b, i8 %c, i8 %d) nounwind {
485 ; CHECK-LABEL: or_ne:
487 ; CHECK-NEXT: xorl %esi, %edi
488 ; CHECK-NEXT: xorl %ecx, %edx
489 ; CHECK-NEXT: orb %dl, %dil
490 ; CHECK-NEXT: setne %al
492 %cmp1 = icmp ne i8 %a, %b
493 %cmp2 = icmp ne i8 %c, %d
494 %or = or i1 %cmp1, %cmp2
498 ; This should not be transformed because vector compares + bitwise logic are faster.
500 define <4 x i1> @and_eq_vec(<4 x i32> %a, <4 x i32> %b, <4 x i32> %c, <4 x i32> %d) nounwind {
501 ; CHECK-LABEL: and_eq_vec:
503 ; CHECK-NEXT: pcmpeqd %xmm1, %xmm0
504 ; CHECK-NEXT: pcmpeqd %xmm3, %xmm2
505 ; CHECK-NEXT: pand %xmm2, %xmm0
507 %cmp1 = icmp eq <4 x i32> %a, %b
508 %cmp2 = icmp eq <4 x i32> %c, %d
509 %and = and <4 x i1> %cmp1, %cmp2
513 define i1 @or_icmps_const_1bit_diff(i8 %x) {
514 ; CHECK-LABEL: or_icmps_const_1bit_diff:
516 ; CHECK-NEXT: addb $-43, %dil
517 ; CHECK-NEXT: testb $-3, %dil
518 ; CHECK-NEXT: sete %al
520 %a = icmp eq i8 %x, 43
521 %b = icmp eq i8 %x, 45
526 define <4 x i32> @or_icmps_const_1bit_diff_vec(<4 x i32> %x) {
527 ; CHECK-LABEL: or_icmps_const_1bit_diff_vec:
529 ; CHECK-NEXT: movdqa {{.*#+}} xmm1 = [43,45,43,45]
530 ; CHECK-NEXT: pcmpeqd %xmm0, %xmm1
531 ; CHECK-NEXT: pcmpeqd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
532 ; CHECK-NEXT: por %xmm1, %xmm0
534 %a = icmp eq <4 x i32> %x, <i32 43, i32 45, i32 43, i32 45>
535 %b = icmp eq <4 x i32> %x, <i32 45, i32 43, i32 45, i32 43>
536 %t = or <4 x i1> %a, %b
537 %r = sext <4 x i1> %t to <4 x i32>
541 define i1 @and_icmps_const_1bit_diff(i32 %x) {
542 ; CHECK-LABEL: and_icmps_const_1bit_diff:
544 ; CHECK-NEXT: addl $-44, %edi
545 ; CHECK-NEXT: testl $-17, %edi
546 ; CHECK-NEXT: setne %al
548 %a = icmp ne i32 %x, 44
549 %b = icmp ne i32 %x, 60
554 define <4 x i32> @and_icmps_const_1bit_diff_vec(<4 x i32> %x) {
555 ; CHECK-LABEL: and_icmps_const_1bit_diff_vec:
557 ; CHECK-NEXT: movdqa {{.*#+}} xmm1 = [44,60,44,60]
558 ; CHECK-NEXT: pcmpeqd %xmm0, %xmm1
559 ; CHECK-NEXT: pcmpeqd {{\.?LCPI[0-9]+_[0-9]+}}(%rip), %xmm0
560 ; CHECK-NEXT: por %xmm1, %xmm0
561 ; CHECK-NEXT: pcmpeqd %xmm1, %xmm1
562 ; CHECK-NEXT: pxor %xmm1, %xmm0
564 %a = icmp ne <4 x i32> %x, <i32 44, i32 60, i32 44, i32 60>
565 %b = icmp ne <4 x i32> %x, <i32 60, i32 44, i32 60, i32 44>
566 %t = and <4 x i1> %a, %b
567 %r = sext <4 x i1> %t to <4 x i32>
571 ; Negative test - extra use prevents optimization
573 define i1 @or_icmps_const_1bit_diff_extra_use(i8 %x, ptr %p) {
574 ; CHECK-LABEL: or_icmps_const_1bit_diff_extra_use:
576 ; CHECK-NEXT: cmpb $45, %dil
577 ; CHECK-NEXT: sete %cl
578 ; CHECK-NEXT: cmpb $43, %dil
579 ; CHECK-NEXT: sete %al
580 ; CHECK-NEXT: sete (%rsi)
581 ; CHECK-NEXT: orb %cl, %al
583 %a = icmp eq i8 %x, 43
584 %b = icmp eq i8 %x, 45
586 %z = zext i1 %a to i8
591 ; Negative test - constant diff is >1 bit
593 define i1 @and_icmps_const_not1bit_diff(i32 %x) {
594 ; CHECK-LABEL: and_icmps_const_not1bit_diff:
596 ; CHECK-NEXT: cmpl $44, %edi
597 ; CHECK-NEXT: setne %cl
598 ; CHECK-NEXT: cmpl $92, %edi
599 ; CHECK-NEXT: setne %al
600 ; CHECK-NEXT: andb %cl, %al
602 %a = icmp ne i32 %x, 44
603 %b = icmp ne i32 %x, 92
608 ; Negative test - wrong comparison
610 define i1 @and_icmps_const_1bit_diff_wrong_pred(i32 %x) {
611 ; CHECK-LABEL: and_icmps_const_1bit_diff_wrong_pred:
613 ; CHECK-NEXT: cmpl $43, %edi
614 ; CHECK-NEXT: sete %cl
615 ; CHECK-NEXT: cmpl $45, %edi
616 ; CHECK-NEXT: setl %al
617 ; CHECK-NEXT: orb %cl, %al
619 %a = icmp eq i32 %x, 43
620 %b = icmp slt i32 %x, 45
625 ; Negative test - no common operand
627 define i1 @and_icmps_const_1bit_diff_common_op(i32 %x, i32 %y) {
628 ; CHECK-LABEL: and_icmps_const_1bit_diff_common_op:
630 ; CHECK-NEXT: cmpl $43, %edi
631 ; CHECK-NEXT: sete %cl
632 ; CHECK-NEXT: cmpl $45, %esi
633 ; CHECK-NEXT: sete %al
634 ; CHECK-NEXT: orb %cl, %al
636 %a = icmp eq i32 %x, 43
637 %b = icmp eq i32 %y, 45
642 ; PR44136 - fold cmpeq(or(X,Y),X) --> cmpeq(and(~X,Y),0)
644 define i1 @or_cmp_eq_i64(i64 %x, i64 %y) {
645 ; NOBMI-LABEL: or_cmp_eq_i64:
647 ; NOBMI-NEXT: notq %rdi
648 ; NOBMI-NEXT: testq %rsi, %rdi
649 ; NOBMI-NEXT: sete %al
652 ; BMI-LABEL: or_cmp_eq_i64:
654 ; BMI-NEXT: andnq %rsi, %rdi, %rax
658 %c = icmp eq i64 %o, %x
662 define i1 @or_cmp_ne_i32(i32 %x, i32 %y) {
663 ; NOBMI-LABEL: or_cmp_ne_i32:
665 ; NOBMI-NEXT: notl %esi
666 ; NOBMI-NEXT: testl %edi, %esi
667 ; NOBMI-NEXT: setne %al
670 ; BMI-LABEL: or_cmp_ne_i32:
672 ; BMI-NEXT: andnl %edi, %esi, %eax
673 ; BMI-NEXT: setne %al
676 %c = icmp ne i32 %o, %y
680 define i1 @or_cmp_eq_i16(i16 zeroext %x, i16 zeroext %y) {
681 ; NOBMI-LABEL: or_cmp_eq_i16:
683 ; NOBMI-NEXT: notl %edi
684 ; NOBMI-NEXT: testl %esi, %edi
685 ; NOBMI-NEXT: sete %al
688 ; BMI-LABEL: or_cmp_eq_i16:
690 ; BMI-NEXT: andnl %esi, %edi, %eax
694 %c = icmp eq i16 %x, %o
698 define i1 @or_cmp_ne_i8(i8 zeroext %x, i8 zeroext %y) {
699 ; CHECK-LABEL: or_cmp_ne_i8:
701 ; CHECK-NEXT: notb %sil
702 ; CHECK-NEXT: testb %dil, %sil
703 ; CHECK-NEXT: setne %al
706 %c = icmp ne i8 %y, %o
710 ; Don't fold vectors.
711 define <4 x i32> @or_cmp_eq_v4i32(<4 x i32> %x, <4 x i32> %y) {
712 ; CHECK-LABEL: or_cmp_eq_v4i32:
714 ; CHECK-NEXT: por %xmm0, %xmm1
715 ; CHECK-NEXT: pcmpeqd %xmm1, %xmm0
717 %o = or <4 x i32> %x, %y
718 %c = icmp eq <4 x i32> %o, %x
719 %s = sext <4 x i1> %c to <4 x i32>
723 define <16 x i8> @or_cmp_ne_v4i32(<16 x i8> %x, <16 x i8> %y) {
724 ; CHECK-LABEL: or_cmp_ne_v4i32:
726 ; CHECK-NEXT: por %xmm0, %xmm1
727 ; CHECK-NEXT: pcmpeqb %xmm1, %xmm0
728 ; CHECK-NEXT: pcmpeqd %xmm1, %xmm1
729 ; CHECK-NEXT: pxor %xmm1, %xmm0
731 %o = or <16 x i8> %x, %y
732 %c = icmp ne <16 x i8> %o, %x
733 %s = sext <16 x i1> %c to <16 x i8>