@@ -494,8 +494,9 @@ define i1 @test_select_inverse_samesign_true_arm(i64 %x, i64 %y, i1 %cond) {
494494
495495define i1 @test_select_inverse_samesign_false_arm (i64 %x , i64 %y , i1 %cond ) {
496496; CHECK-LABEL: @test_select_inverse_samesign_false_arm(
497- ; CHECK-NEXT: [[CMP2:%.*]] = icmp samesign uge i64 [[X:%.*]], [[Y:%.*]]
498- ; CHECK-NEXT: [[SEL:%.*]] = xor i1 [[COND:%.*]], [[CMP2]]
497+ ; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i64 [[X:%.*]], [[Y:%.*]]
498+ ; CHECK-NEXT: [[CMP2:%.*]] = icmp samesign uge i64 [[X]], [[Y]]
499+ ; CHECK-NEXT: [[SEL:%.*]] = select i1 [[COND:%.*]], i1 [[CMP1]], i1 [[CMP2]]
499500; CHECK-NEXT: ret i1 [[SEL]]
500501;
501502 %cmp1 = icmp ult i64 %x , %y
@@ -518,8 +519,9 @@ define i1 @test_select_inverse_samesign_both(i64 %x, i64 %y, i1 %cond) {
518519
519520define i1 @test_select_inverse_samesign_false_arm_rhsc_same_sign (i64 %x , i64 %y , i1 %cond ) {
520521; CHECK-LABEL: @test_select_inverse_samesign_false_arm_rhsc_same_sign(
521- ; CHECK-NEXT: [[CMP2:%.*]] = icmp samesign ugt i64 [[X:%.*]], 10
522- ; CHECK-NEXT: [[SEL:%.*]] = xor i1 [[COND:%.*]], [[CMP2]]
522+ ; CHECK-NEXT: [[CMP1:%.*]] = icmp ult i64 [[X:%.*]], 11
523+ ; CHECK-NEXT: [[CMP2:%.*]] = icmp samesign ugt i64 [[X]], 10
524+ ; CHECK-NEXT: [[SEL:%.*]] = select i1 [[COND:%.*]], i1 [[CMP1]], i1 [[CMP2]]
523525; CHECK-NEXT: ret i1 [[SEL]]
524526;
525527 %cmp1 = icmp ult i64 %x , 11
@@ -554,8 +556,9 @@ define i1 @test_select_inverse_samesign_both_rhsc_same_sign(i64 %x, i64 %y, i1 %
554556
555557define i1 @test_select_inverse_samesign_both_rhsc_diff_sign (i64 %x , i64 %y , i1 %cond ) {
556558; CHECK-LABEL: @test_select_inverse_samesign_both_rhsc_diff_sign(
557- ; CHECK-NEXT: [[CMP2:%.*]] = icmp samesign sgt i64 [[X:%.*]], -1
558- ; CHECK-NEXT: [[SEL:%.*]] = xor i1 [[COND:%.*]], [[CMP2]]
559+ ; CHECK-NEXT: [[CMP1:%.*]] = icmp samesign slt i64 [[X:%.*]], 0
560+ ; CHECK-NEXT: [[CMP2:%.*]] = icmp samesign sgt i64 [[X]], -1
561+ ; CHECK-NEXT: [[SEL:%.*]] = select i1 [[COND:%.*]], i1 [[CMP1]], i1 [[CMP2]]
559562; CHECK-NEXT: ret i1 [[SEL]]
560563;
561564 %cmp1 = icmp samesign slt i64 %x , 0
0 commit comments