@@ -1526,7 +1526,7 @@ define i1 @test_logical_and_icmp_samesign(i8 %x) {
15261526; CHECK-LABEL: @test_logical_and_icmp_samesign(
15271527; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i8 [[X:%.*]], 9
15281528; CHECK-NEXT: [[CMP2:%.*]] = icmp samesign ult i8 [[X]], 11
1529- ; CHECK-NEXT: [[AND:%.*]] = select i1 [[CMP1]], i1 [[CMP2]], i1 false
1529+ ; CHECK-NEXT: [[AND:%.*]] = and i1 [[CMP1]], [[CMP2]]
15301530; CHECK-NEXT: ret i1 [[AND]]
15311531;
15321532 %cmp1 = icmp ne i8 %x , 9
@@ -1539,7 +1539,7 @@ define i1 @test_logical_or_icmp_samesign(i8 %x) {
15391539; CHECK-LABEL: @test_logical_or_icmp_samesign(
15401540; CHECK-NEXT: [[CMP1:%.*]] = icmp eq i8 [[X:%.*]], -9
15411541; CHECK-NEXT: [[CMP2:%.*]] = icmp samesign ult i8 [[X]], -11
1542- ; CHECK-NEXT: [[OR:%.*]] = select i1 [[CMP1]], i1 true, i1 [[CMP2]]
1542+ ; CHECK-NEXT: [[OR:%.*]] = or i1 [[CMP1]], [[CMP2]]
15431543; CHECK-NEXT: ret i1 [[OR]]
15441544;
15451545 %cmp1 = icmp eq i8 %x , -9
@@ -1550,10 +1550,8 @@ define i1 @test_logical_or_icmp_samesign(i8 %x) {
15501550
15511551define i1 @test_double_logical_and_icmp_samesign1 (i1 %cond , i32 %y ) {
15521552; CHECK-LABEL: @test_double_logical_and_icmp_samesign1(
1553- ; CHECK-NEXT: [[CMP1:%.*]] = icmp ne i32 [[Y:%.*]], 5
1554- ; CHECK-NEXT: [[SEL1:%.*]] = select i1 [[COND:%.*]], i1 [[CMP1]], i1 false
1555- ; CHECK-NEXT: [[CMP2:%.*]] = icmp samesign ult i32 [[Y]], 4
1556- ; CHECK-NEXT: [[SEL2:%.*]] = select i1 [[SEL1]], i1 [[CMP2]], i1 false
1553+ ; CHECK-NEXT: [[CMP2:%.*]] = icmp samesign ult i32 [[Y:%.*]], 4
1554+ ; CHECK-NEXT: [[SEL2:%.*]] = select i1 [[SEL1:%.*]], i1 [[CMP2]], i1 false
15571555; CHECK-NEXT: ret i1 [[SEL2]]
15581556;
15591557 %cmp1 = icmp ne i32 %y , 5
@@ -1565,10 +1563,9 @@ define i1 @test_double_logical_and_icmp_samesign1(i1 %cond, i32 %y) {
15651563
15661564define i1 @test_double_logical_and_icmp_samesign2 (i1 %cond , i32 %y ) {
15671565; CHECK-LABEL: @test_double_logical_and_icmp_samesign2(
1568- ; CHECK-NEXT: [[CMP1:%.*]] = icmp samesign ugt i32 [[Y:%.*]], 65535
1569- ; CHECK-NEXT: [[SEL1:%.*]] = select i1 [[COND:%.*]], i1 [[CMP1]], i1 false
1570- ; CHECK-NEXT: [[CMP2:%.*]] = icmp samesign ult i32 [[Y]], 1114112
1571- ; CHECK-NEXT: [[SEL2:%.*]] = select i1 [[SEL1]], i1 [[CMP2]], i1 false
1566+ ; CHECK-NEXT: [[TMP1:%.*]] = add i32 [[Y:%.*]], -65536
1567+ ; CHECK-NEXT: [[CMP2:%.*]] = icmp ult i32 [[TMP1]], 1048576
1568+ ; CHECK-NEXT: [[SEL2:%.*]] = select i1 [[SEL1:%.*]], i1 [[CMP2]], i1 false
15721569; CHECK-NEXT: ret i1 [[SEL2]]
15731570;
15741571 %cmp1 = icmp samesign ugt i32 %y , 65535
@@ -1582,7 +1579,7 @@ define <2 x i1> @test_logical_and_icmp_samesign_vec(<2 x i8> %x) {
15821579; CHECK-LABEL: @test_logical_and_icmp_samesign_vec(
15831580; CHECK-NEXT: [[CMP1:%.*]] = icmp ne <2 x i8> [[X:%.*]], splat (i8 9)
15841581; CHECK-NEXT: [[CMP2:%.*]] = icmp samesign ult <2 x i8> [[X]], splat (i8 11)
1585- ; CHECK-NEXT: [[AND:%.*]] = select <2 x i1> [[CMP1]], <2 x i1> [[CMP2]], <2 x i1> zeroinitializer
1582+ ; CHECK-NEXT: [[AND:%.*]] = and <2 x i1> [[CMP1]], [[CMP2]]
15861583; CHECK-NEXT: ret <2 x i1> [[AND]]
15871584;
15881585 %cmp1 = icmp ne <2 x i8 > %x , splat(i8 9 )
@@ -1595,7 +1592,7 @@ define <2 x i1> @test_logical_and_icmp_samesign_vec_with_poison_cond(<2 x i8> %x
15951592; CHECK-LABEL: @test_logical_and_icmp_samesign_vec_with_poison_cond(
15961593; CHECK-NEXT: [[CMP1:%.*]] = icmp ne <2 x i8> [[X:%.*]], <i8 9, i8 poison>
15971594; CHECK-NEXT: [[CMP2:%.*]] = icmp samesign ult <2 x i8> [[X]], splat (i8 11)
1598- ; CHECK-NEXT: [[AND:%.*]] = select <2 x i1> [[CMP1]], <2 x i1> [[CMP2]], <2 x i1> zeroinitializer
1595+ ; CHECK-NEXT: [[AND:%.*]] = and <2 x i1> [[CMP1]], [[CMP2]]
15991596; CHECK-NEXT: ret <2 x i1> [[AND]]
16001597;
16011598 %cmp1 = icmp ne <2 x i8 > %x , <i8 9 , i8 poison>
0 commit comments