@@ -4564,7 +4564,7 @@ define i32 @src_no_trans_select_xor_eq0_or_xor(i32 %x, i32 %y) {
45644564 ret i32 %cond
45654565}
45664566
4567- define i32 @src_no_trans_select_xor_eqc_and_disjoint_or_and_notc (i32 noundef %x , i32 noundef %y , i32 %c ) {
4567+ define i32 @src_no_trans_select_xor_eqc_and_disjoint_or_and_notc (i32 %x , i32 %y , i32 %c ) {
45684568; CHECK-LABEL: @src_no_trans_select_xor_eqc_and_disjoint_or_and_notc(
45694569; CHECK-NEXT: entry:
45704570; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[Y:%.*]], [[X:%.*]]
@@ -4587,6 +4587,61 @@ entry:
45874587 ret i32 %cond
45884588}
45894589
4590+ define i32 @negative_inner_disjoint_or2 (i32 %x , i32 %y , i32 %c ) {
4591+ ; CHECK-LABEL: @negative_inner_disjoint_or2(
4592+ ; CHECK-NEXT: entry:
4593+ ; CHECK-NEXT: [[XOR:%.*]] = xor i32 [[Y:%.*]], [[X:%.*]]
4594+ ; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[XOR]], [[C:%.*]]
4595+ ; CHECK-NEXT: [[AND:%.*]] = and i32 [[X]], [[Y]]
4596+ ; CHECK-NEXT: [[OR:%.*]] = or disjoint i32 [[Y]], [[X]]
4597+ ; CHECK-NEXT: [[AND1:%.*]] = xor i32 [[OR]], [[C]]
4598+ ; CHECK-NEXT: [[COND:%.*]] = select i1 [[CMP]], i32 [[AND]], i32 [[AND1]]
4599+ ; CHECK-NEXT: ret i32 [[COND]]
4600+ ;
4601+ entry:
4602+ %xor = xor i32 %y , %x
4603+ %cmp = icmp eq i32 %xor , %c
4604+ %and = and i32 %x , %y
4605+ %or = or disjoint i32 %y , %x
4606+ %and1 = xor i32 %or , %c
4607+ %cond = select i1 %cmp , i32 %and , i32 %and1
4608+ ret i32 %cond
4609+ }
4610+
4611+ define i32 @positive_outer_disjoint_or1 (i32 %x , i32 %y , i32 %c ) {
4612+ ; CHECK-LABEL: @positive_outer_disjoint_or1(
4613+ ; CHECK-NEXT: entry:
4614+ ; CHECK-NEXT: [[AND:%.*]] = xor i32 [[Y:%.*]], [[X:%.*]]
4615+ ; CHECK-NEXT: [[OR1:%.*]] = or disjoint i32 [[AND]], [[C:%.*]]
4616+ ; CHECK-NEXT: ret i32 [[OR1]]
4617+ ;
4618+ entry:
4619+ %xor = and i32 %y , %x
4620+ %cmp = icmp eq i32 %xor , %c
4621+ %or = or i32 %y , %x
4622+ %and = xor i32 %y , %x
4623+ %or1 = or disjoint i32 %and , %c
4624+ %cond = select i1 %cmp , i32 %or , i32 %or1
4625+ ret i32 %cond
4626+ }
4627+
4628+ define i32 @positive_outer_disjoint_or2 (i32 %x , i32 %y , i32 %c ) {
4629+ ; CHECK-LABEL: @positive_outer_disjoint_or2(
4630+ ; CHECK-NEXT: entry:
4631+ ; CHECK-NEXT: [[AND:%.*]] = and i32 [[Y:%.*]], [[X:%.*]]
4632+ ; CHECK-NEXT: [[OR1:%.*]] = or disjoint i32 [[AND]], [[C:%.*]]
4633+ ; CHECK-NEXT: ret i32 [[OR1]]
4634+ ;
4635+ entry:
4636+ %xor = xor i32 %y , %x
4637+ %cmp = icmp eq i32 %xor , %c
4638+ %or = or i32 %y , %x
4639+ %and = and i32 %y , %x
4640+ %or1 = or disjoint i32 %and , %c
4641+ %cond = select i1 %cmp , i32 %or , i32 %or1
4642+ ret i32 %cond
4643+ }
4644+
45904645; (X == C) ? X : Y -> (X == C) ? C : Y
45914646; Fixed #77553
45924647define i32 @src_select_xxory_eq0_xorxy_y (i32 %x , i32 %y ) {
0 commit comments