[llvm] c2e27ac - [VectorCombine] Add multi-use shl test for D80885

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Wed Jun 3 11:42:32 PDT 2020


Author: Simon Pilgrim
Date: 2020-06-03T19:42:15+01:00
New Revision: c2e27ac1ce3e3141f9cf0c4f6982cd56347bc323

URL: https://github.com/llvm/llvm-project/commit/c2e27ac1ce3e3141f9cf0c4f6982cd56347bc323
DIFF: https://github.com/llvm/llvm-project/commit/c2e27ac1ce3e3141f9cf0c4f6982cd56347bc323.diff

LOG: [VectorCombine] Add multi-use shl test for D80885

Added: 
    

Modified: 
    llvm/test/Transforms/VectorCombine/X86/insert-binop-with-constant.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/VectorCombine/X86/insert-binop-with-constant.ll b/llvm/test/Transforms/VectorCombine/X86/insert-binop-with-constant.ll
index 10c4971c56a1..e0d4623f505f 100644
--- a/llvm/test/Transforms/VectorCombine/X86/insert-binop-with-constant.ll
+++ b/llvm/test/Transforms/VectorCombine/X86/insert-binop-with-constant.ll
@@ -155,6 +155,21 @@ define <2 x i64> @shl_constant_op0_load(i64* %p) {
   ret <2 x i64> %bo
 }
 
+define <4 x i32> @shl_constant_op0_multiuse(i32 %a0, <4 x i32> %a1) {
+; CHECK-LABEL: @shl_constant_op0_multiuse(
+; CHECK-NEXT:    [[INS:%.*]] = insertelement <4 x i32> <i32 undef, i32 1, i32 2, i32 3>, i32 [[A0:%.*]], i32 0
+; CHECK-NEXT:    [[MUL:%.*]] = shl <4 x i32> [[INS]], <i32 3, i32 4, i32 5, i32 6>
+; CHECK-NEXT:    [[AND:%.*]] = and <4 x i32> [[INS]], [[A1:%.*]]
+; CHECK-NEXT:    [[XOR:%.*]] = xor <4 x i32> [[AND]], [[MUL]]
+; CHECK-NEXT:    ret <4 x i32> [[XOR]]
+;
+  %ins = insertelement <4 x i32> <i32 undef, i32 1, i32 2, i32 3>, i32 %a0, i32 0
+  %mul = shl <4 x i32> %ins, <i32 3, i32 4, i32 5, i32 6>
+  %and = and <4 x i32> %ins, %a1
+  %xor = xor <4 x i32> %and, %mul
+  ret <4 x i32> %xor
+}
+
 define <2 x i64> @shl_constant_op1(i64 %x) {
 ; CHECK-LABEL: @shl_constant_op1(
 ; CHECK-NEXT:    [[INS:%.*]] = insertelement <2 x i64> undef, i64 [[X:%.*]], i32 0


        


More information about the llvm-commits mailing list