From: Sanjay Patel Date: Thu, 29 Dec 2022 19:51:30 +0000 (-0500) Subject: [InstSimplify] add tests for select-of-bool; NFC X-Git-Tag: upstream/17.0.6~22444 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=94944f800c1242e0375b4a658820a366445e7bc1;p=platform%2Fupstream%2Fllvm.git [InstSimplify] add tests for select-of-bool; NFC --- diff --git a/llvm/test/Transforms/InstSimplify/select-logical.ll b/llvm/test/Transforms/InstSimplify/select-logical.ll index 70e5a55..1d1ee58 100644 --- a/llvm/test/Transforms/InstSimplify/select-logical.ll +++ b/llvm/test/Transforms/InstSimplify/select-logical.ll @@ -553,3 +553,39 @@ define i1 @select_and_same_op_negative(i1 %x, i1 %y, i1 %z) { %r = select i1 %a, i1 %x, i1 %z ret i1 %r } + +define i1 @and_same_op(i1 %x) { +; CHECK-LABEL: @and_same_op( +; CHECK-NEXT: [[R:%.*]] = select i1 [[X:%.*]], i1 [[X]], i1 false +; CHECK-NEXT: ret i1 [[R]] +; + %r = select i1 %x, i1 %x, i1 false + ret i1 %r +} + +define <2 x i1> @or_same_op(<2 x i1> %x) { +; CHECK-LABEL: @or_same_op( +; CHECK-NEXT: [[R:%.*]] = select <2 x i1> [[X:%.*]], <2 x i1> , <2 x i1> [[X]] +; CHECK-NEXT: ret <2 x i1> [[R]] +; + %r = select <2 x i1> %x, <2 x i1> , <2 x i1> %x + ret <2 x i1> %r +} + +define <2 x i1> @always_true_same_op(<2 x i1> %x) { +; CHECK-LABEL: @always_true_same_op( +; CHECK-NEXT: [[R:%.*]] = select <2 x i1> [[X:%.*]], <2 x i1> [[X]], <2 x i1> +; CHECK-NEXT: ret <2 x i1> [[R]] +; + %r = select <2 x i1> %x, <2 x i1> %x, <2 x i1> + ret <2 x i1> %r +} + +define i1 @always_false_same_op(i1 %x) { +; CHECK-LABEL: @always_false_same_op( +; CHECK-NEXT: [[R:%.*]] = select i1 [[X:%.*]], i1 false, i1 [[X]] +; CHECK-NEXT: ret i1 [[R]] +; + %r = select i1 %x, i1 false, i1 %x + ret i1 %r +}