@@ -693,6 +693,23 @@ define i1 @orn_and_cmp_1_partial_logical(i37 %a, i37 %b, i1 %y) {
693
693
; CHECK-NEXT: [[OR:%.*]] = select i1 [[X_INV]], i1 true, i1 [[AND]]
694
694
; CHECK-NEXT: ret i1 [[OR]]
695
695
;
696
+ %x = icmp sgt i37 %a , %b
697
+ %x_inv = icmp sle i37 %a , %b
698
+ %and = and i1 %x , %y
699
+ %or = select i1 %x_inv , i1 true , i1 %and
700
+ ret i1 %or
701
+ }
702
+
703
+ define i1 @orn_and_cmp_1_partial_logical_commute (i37 %a , i37 %b ) {
704
+ ; CHECK-LABEL: @orn_and_cmp_1_partial_logical_commute(
705
+ ; CHECK-NEXT: [[Y:%.*]] = call i1 @gen1()
706
+ ; CHECK-NEXT: [[X:%.*]] = icmp sgt i37 [[A:%.*]], [[B:%.*]]
707
+ ; CHECK-NEXT: [[X_INV:%.*]] = icmp sle i37 [[A]], [[B]]
708
+ ; CHECK-NEXT: [[AND:%.*]] = and i1 [[Y]], [[X]]
709
+ ; CHECK-NEXT: [[OR:%.*]] = select i1 [[X_INV]], i1 true, i1 [[AND]]
710
+ ; CHECK-NEXT: ret i1 [[OR]]
711
+ ;
712
+ %y = call i1 @gen1 () ; thwart complexity-based canonicalization
696
713
%x = icmp sgt i37 %a , %b
697
714
%x_inv = icmp sle i37 %a , %b
698
715
%and = and i1 %y , %x
@@ -721,9 +738,37 @@ define i1 @orn_and_cmp_2_partial_logical(i16 %a, i16 %b, i1 %y) {
721
738
; CHECK-NEXT: [[OR:%.*]] = or i1 [[X_INV]], [[Y:%.*]]
722
739
; CHECK-NEXT: ret i1 [[OR]]
723
740
;
741
+ %x = icmp sge i16 %a , %b
742
+ %x_inv = icmp slt i16 %a , %b
743
+ %and = and i1 %x , %y
744
+ %or = select i1 %and , i1 true , i1 %x_inv
745
+ ret i1 %or
746
+ }
747
+
748
+ define i1 @orn_and_cmp_2_partial_logical_commute (i16 %a , i16 %b ) {
749
+ ; CHECK-LABEL: @orn_and_cmp_2_partial_logical_commute(
750
+ ; CHECK-NEXT: [[Y:%.*]] = call i1 @gen1()
751
+ ; CHECK-NEXT: [[X_INV:%.*]] = icmp slt i16 [[A:%.*]], [[B:%.*]]
752
+ ; CHECK-NEXT: [[OR:%.*]] = or i1 [[Y]], [[X_INV]]
753
+ ; CHECK-NEXT: ret i1 [[OR]]
754
+ ;
755
+ %y = call i1 @gen1 () ; thwart complexity-based canonicalization
724
756
%x = icmp sge i16 %a , %b
725
757
%x_inv = icmp slt i16 %a , %b
726
758
%and = and i1 %y , %x
727
759
%or = select i1 %and , i1 true , i1 %x_inv
728
760
ret i1 %or
729
761
}
762
+
763
+ define <2 x i1 > @not_logical_and2 (i1 %b , <2 x i32 > %a ) {
764
+ ; CHECK-LABEL: @not_logical_and2(
765
+ ; CHECK-NEXT: [[IMPLIED:%.*]] = icmp ugt <2 x i32> [[A:%.*]], <i32 1, i32 1>
766
+ ; CHECK-NEXT: [[OR:%.*]] = select i1 [[B:%.*]], <2 x i1> <i1 true, i1 true>, <2 x i1> [[IMPLIED]]
767
+ ; CHECK-NEXT: ret <2 x i1> [[OR]]
768
+ ;
769
+ %cond = icmp ult <2 x i32 > %a , <i32 3 , i32 3 >
770
+ %implied = icmp ugt <2 x i32 > %a , <i32 1 , i32 1 >
771
+ %and = select i1 %b , <2 x i1 > %cond , <2 x i1 > zeroinitializer
772
+ %or = select <2 x i1 > %and , <2 x i1 > <i1 true , i1 true >, <2 x i1 > %implied
773
+ ret <2 x i1 > %or
774
+ }
0 commit comments