diff --git a/llvm/test/Transforms/InstCombine/icmp-logical.ll b/llvm/test/Transforms/InstCombine/icmp-logical.ll --- a/llvm/test/Transforms/InstCombine/icmp-logical.ll +++ b/llvm/test/Transforms/InstCombine/icmp-logical.ll @@ -377,6 +377,36 @@ ret i1 %t4 } +define <2 x i1> @nomask_splat_and_B_allones(<2 x i32> %A) { +; CHECK-LABEL: @nomask_and_B_allones_splat( +; CHECK-NEXT: [[TST1:%.*]] = icmp slt <2 x i32> [[A:%.*]], +; CHECK-NEXT: [[MASK2:%.*]] = and <2 x i32> [[A]], +; CHECK-NEXT: [[TST2:%.*]] = icmp eq <2 x i32> [[MASK2]], +; CHECK-NEXT: [[RES:%.*]] = and <2 x i1> [[TST1]], [[TST2]] +; CHECK-NEXT: ret <2 x i1> [[RES]] +; + %tst1 = icmp slt <2 x i32> %A, + %mask2 = and <2 x i32> %A, + %tst2 = icmp eq <2 x i32> %mask2, + %res = and <2 x i1> %tst1, %tst2 + ret <2 x i1> %res +} + +define <2 x i1> @nomask_splat_and_B_mixed(<2 x i32> %A) { +; CHECK-LABEL: @nomask_and_B_mixed_splat( +; CHECK-NEXT: [[TST1:%.*]] = icmp sgt <2 x i32> [[A:%.*]], +; CHECK-NEXT: [[MASK2:%.*]] = and <2 x i32> [[A]], +; CHECK-NEXT: [[TST2:%.*]] = icmp eq <2 x i32> [[MASK2]], +; CHECK-NEXT: [[RES:%.*]] = and <2 x i1> [[TST1]], [[TST2]] +; CHECK-NEXT: ret <2 x i1> [[RES]] +; + %tst1 = icmp sgt <2 x i32> %A, + %mask2 = and <2 x i32> %A, + %tst2 = icmp eq <2 x i32> %mask2, + %res = and <2 x i1> %tst1, %tst2 + ret <2 x i1> %res +} + ; PR32401 - https://bugs.llvm.org/show_bug.cgi?id=32401 define i1 @cmpeq_bitwise(i8 %a, i8 %b, i8 %c, i8 %d) {