From 73bb11994064f5172bf454c3dae523b9661642a8 Mon Sep 17 00:00:00 2001 From: Sanjay Patel Date: Thu, 1 Nov 2018 16:57:54 +0000 Subject: [PATCH] [InstCombine] add test for ComputeNumSignBits on 2-input shuffle; NFC llvm-svn: 345852 --- llvm/test/Transforms/InstCombine/logical-select.ll | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) diff --git a/llvm/test/Transforms/InstCombine/logical-select.ll b/llvm/test/Transforms/InstCombine/logical-select.ll index b4260af..888c6a5 100644 --- a/llvm/test/Transforms/InstCombine/logical-select.ll +++ b/llvm/test/Transforms/InstCombine/logical-select.ll @@ -616,3 +616,24 @@ define <4 x i32> @computesignbits_through_shuffles(<4 x float> %x, <4 x float> % ret <4 x i32> %sel } +define <4 x i32> @computesignbits_through_two_input_shuffle(<4 x i32> %x, <4 x i32> %y, <4 x i1> %cond1, <4 x i1> %cond2) { +; CHECK-LABEL: @computesignbits_through_two_input_shuffle( +; CHECK-NEXT: [[SEXT1:%.*]] = sext <4 x i1> [[COND1:%.*]] to <4 x i32> +; CHECK-NEXT: [[SEXT2:%.*]] = sext <4 x i1> [[COND2:%.*]] to <4 x i32> +; CHECK-NEXT: [[COND:%.*]] = shufflevector <4 x i32> [[SEXT1]], <4 x i32> [[SEXT2]], <4 x i32> +; CHECK-NEXT: [[NOTCOND:%.*]] = xor <4 x i32> [[COND]], +; CHECK-NEXT: [[AND1:%.*]] = and <4 x i32> [[NOTCOND]], [[X:%.*]] +; CHECK-NEXT: [[AND2:%.*]] = and <4 x i32> [[COND]], [[Y:%.*]] +; CHECK-NEXT: [[SEL:%.*]] = or <4 x i32> [[AND1]], [[AND2]] +; CHECK-NEXT: ret <4 x i32> [[SEL]] +; + %sext1 = sext <4 x i1> %cond1 to <4 x i32> + %sext2 = sext <4 x i1> %cond2 to <4 x i32> + %cond = shufflevector <4 x i32> %sext1, <4 x i32> %sext2, <4 x i32> + %notcond = xor <4 x i32> %cond, + %and1 = and <4 x i32> %notcond, %x + %and2 = and <4 x i32> %cond, %y + %sel = or <4 x i32> %and1, %and2 + ret <4 x i32> %sel +} + -- 2.7.4