[llvm] 106b63d - [InstCombine] Add smulo NumSignBits test from D97170

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 22 02:25:24 PST 2021


Author: Simon Pilgrim
Date: 2021-02-22T10:25:13Z
New Revision: 106b63de3ad19c2765329958ce5632b8a905c73f

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

LOG: [InstCombine] Add smulo NumSignBits test from D97170

Added: 
    

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

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstCombine/with_overflow.ll b/llvm/test/Transforms/InstCombine/with_overflow.ll
index 4553c9f56965..12db6b795293 100644
--- a/llvm/test/Transforms/InstCombine/with_overflow.ll
+++ b/llvm/test/Transforms/InstCombine/with_overflow.ll
@@ -330,6 +330,21 @@ define i1 @overflow_mod_overflow_mul(i32 %v1, i32 %v2) nounwind {
   ret i1 %obit
 }
 
+define i1 @overflow_mod_mul2(i16 %v1, i32 %v2) nounwind {
+; CHECK-LABEL: @overflow_mod_mul2(
+; CHECK-NEXT:    [[A:%.*]] = sext i16 [[V1:%.*]] to i32
+; CHECK-NEXT:    [[REM:%.*]] = srem i32 [[A]], [[V2:%.*]]
+; CHECK-NEXT:    [[T:%.*]] = call { i32, i1 } @llvm.smul.with.overflow.i32(i32 [[REM]], i32 [[REM]])
+; CHECK-NEXT:    [[OBIT:%.*]] = extractvalue { i32, i1 } [[T]], 1
+; CHECK-NEXT:    ret i1 [[OBIT]]
+;
+  %a = sext i16 %v1 to i32
+  %rem = srem i32 %a, %v2
+  %t = call { i32, i1 } @llvm.smul.with.overflow.i32(i32 %rem, i32 %rem)
+  %obit = extractvalue { i32, i1 } %t, 1
+  ret i1 %obit
+}
+
 define { i32, i1 } @ssubtest_reorder(i8 %a) {
 ; CHECK-LABEL: @ssubtest_reorder(
 ; CHECK-NEXT:    [[AA:%.*]] = sext i8 [[A:%.*]] to i32


        


More information about the llvm-commits mailing list