[llvm] 53069de - [InstCombine] precommit tests for D124590

Chenbing Zheng via llvm-commits llvm-commits at lists.llvm.org
Thu May 5 19:55:52 PDT 2022


Author: Chenbing Zheng
Date: 2022-05-06T10:53:12+08:00
New Revision: 53069de6aa4ce1e130aa58fc36b4be08a53d3aba

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

LOG: [InstCombine] precommit tests for D124590

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/sext.ll b/llvm/test/Transforms/InstCombine/sext.ll
index b24ac62ae149..2e5735f1c133 100644
--- a/llvm/test/Transforms/InstCombine/sext.ll
+++ b/llvm/test/Transforms/InstCombine/sext.ll
@@ -395,3 +395,33 @@ define i16 @smear_set_bit_
diff erent_dest_type(i32 %x) {
   %s = sext i8 %a to i16
   ret i16 %s
 }
+
+; negative test - extra use
+
+define i16 @smear_set_bit_
diff erent_dest_type_extra_use(i32 %x) {
+; CHECK-LABEL: @smear_set_bit_
diff erent_dest_type_extra_use(
+; CHECK-NEXT:    [[T:%.*]] = trunc i32 [[X:%.*]] to i8
+; CHECK-NEXT:    call void @use(i8 [[T]])
+; CHECK-NEXT:    [[A:%.*]] = ashr i8 [[T]], 7
+; CHECK-NEXT:    [[S:%.*]] = sext i8 [[A]] to i16
+; CHECK-NEXT:    ret i16 [[S]]
+;
+  %t = trunc i32 %x to i8
+  call void @use(i8 %t)
+  %a = ashr i8 %t, 7
+  %s = sext i8 %a to i16
+  ret i16 %s
+}
+
+define i64 @smear_set_bit_
diff erent_dest_type_wider_dst(i32 %x) {
+; CHECK-LABEL: @smear_set_bit_
diff erent_dest_type_wider_dst(
+; CHECK-NEXT:    [[T:%.*]] = trunc i32 [[X:%.*]] to i8
+; CHECK-NEXT:    [[A:%.*]] = ashr i8 [[T]], 7
+; CHECK-NEXT:    [[S:%.*]] = sext i8 [[A]] to i64
+; CHECK-NEXT:    ret i64 [[S]]
+;
+  %t = trunc i32 %x to i8
+  %a = ashr i8 %t, 7
+  %s = sext i8 %a to i64
+  ret i64 %s
+}


        


More information about the llvm-commits mailing list