[llvm] 793bb70 - [InstCombine] add test for trunc-shl-trunc ; NFC

Chenbing Zheng via llvm-commits llvm-commits at lists.llvm.org
Tue May 24 19:13:53 PDT 2022


Author: Chenbing Zheng
Date: 2022-05-25T10:13:34+08:00
New Revision: 793bb7049db012df4fe3ff6e8abc320677845400

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

LOG: [InstCombine] add test for trunc-shl-trunc ; NFC

Added: 
    

Modified: 
    llvm/test/Transforms/InstCombine/trunc-shift-trunc.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/trunc-shift-trunc.ll b/llvm/test/Transforms/InstCombine/trunc-shift-trunc.ll
index 756f5dcf2b27..e578b604c9d6 100644
--- a/llvm/test/Transforms/InstCombine/trunc-shift-trunc.ll
+++ b/llvm/test/Transforms/InstCombine/trunc-shift-trunc.ll
@@ -19,6 +19,19 @@ define i8 @trunc_lshr_trunc(i64 %a) {
   ret i8 %d
 }
 
+define <2 x i8> @trunc_shl_trunc(<2 x i64> %a) {
+; CHECK-LABEL: @trunc_shl_trunc(
+; CHECK-NEXT:    [[B:%.*]] = trunc <2 x i64> [[A:%.*]] to <2 x i32>
+; CHECK-NEXT:    [[C:%.*]] = shl <2 x i32> [[B]], <i32 9, i32 7>
+; CHECK-NEXT:    [[D:%.*]] = trunc <2 x i32> [[C]] to <2 x i8>
+; CHECK-NEXT:    ret <2 x i8> [[D]]
+;
+  %b = trunc <2 x i64> %a to <2 x i32>
+  %c = shl <2 x i32> %b, <i32 9, i32 7>
+  %d = trunc <2 x i32> %c to <2 x i8>
+  ret <2 x i8> %d
+}
+
 define <2 x i8> @trunc_lshr_trunc_uniform(<2 x i64> %a) {
 ; CHECK-LABEL: @trunc_lshr_trunc_uniform(
 ; CHECK-NEXT:    [[C1:%.*]] = lshr <2 x i64> [[A:%.*]], <i64 8, i64 8>


        


More information about the llvm-commits mailing list