[llvm] 087e721 - [InstCombine] add test for mul with shl; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Tue Nov 1 06:50:03 PDT 2022


Author: Sanjay Patel
Date: 2022-11-01T09:48:30-04:00
New Revision: 087e721dd8a7bf447b55bb041e5e85c587b6d22e

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

LOG: [InstCombine] add test for mul with shl; NFC

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/mul.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/mul.ll b/llvm/test/Transforms/InstCombine/mul.ll
index 29508e5e5d2ce..5f0e6ceac449d 100644
--- a/llvm/test/Transforms/InstCombine/mul.ll
+++ b/llvm/test/Transforms/InstCombine/mul.ll
@@ -296,6 +296,19 @@ define i32 @shl1_decrement_use(i32 %x, i32 %y) {
   ret i32 %m
 }
 
+define <2 x i8> @shl1_decrement_vec(<2 x i8> %x) {
+; CHECK-LABEL: @shl1_decrement_vec(
+; CHECK-NEXT:    [[POW2X:%.*]] = shl <2 x i8> <i8 -1, i8 -1>, [[X:%.*]]
+; CHECK-NEXT:    [[X1:%.*]] = xor <2 x i8> [[POW2X]], <i8 -1, i8 -1>
+; CHECK-NEXT:    [[M:%.*]] = mul <2 x i8> [[X1]], <i8 42, i8 -3>
+; CHECK-NEXT:    ret <2 x i8> [[M]]
+;
+  %pow2x = shl <2 x i8> <i8 -1, i8 -1>, %x
+  %x1 = xor <2 x i8> %pow2x, <i8 -1, i8 -1>
+  %m = mul <2 x i8> %x1, <i8 42, i8 -3>
+  ret <2 x i8> %m
+}
+
 ; X * Y (when Y is a boolean) --> Y ? X : 0
 
 define i32 @mul_bool(i32 %x, i1 %y) {


        


More information about the llvm-commits mailing list