[llvm] 859e1f4 - [InstSimplify] add tests for ctlz-of-shift-constant; NFC

Sanjay Patel via llvm-commits llvm-commits at lists.llvm.org
Wed Apr 21 11:24:02 PDT 2021


Author: Sanjay Patel
Date: 2021-04-21T14:23:55-04:00
New Revision: 859e1f420d3a8328215b9f45849eadbfb3362727

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

LOG: [InstSimplify] add tests for ctlz-of-shift-constant; NFC

Added: 
    

Modified: 
    llvm/test/Transforms/InstSimplify/call.ll

Removed: 
    


################################################################################
diff  --git a/llvm/test/Transforms/InstSimplify/call.ll b/llvm/test/Transforms/InstSimplify/call.ll
index 77cd0bcd0ad18..6245a9be92f51 100644
--- a/llvm/test/Transforms/InstSimplify/call.ll
+++ b/llvm/test/Transforms/InstSimplify/call.ll
@@ -1406,6 +1406,17 @@ define i32 @ctlz_lshr_sign_bit(i32 %x) {
   ret i32 %r
 }
 
+define i32 @ctlz_lshr_negative(i32 %x) {
+; CHECK-LABEL: @ctlz_lshr_negative(
+; CHECK-NEXT:    [[S:%.*]] = lshr i32 -42, [[X:%.*]]
+; CHECK-NEXT:    [[R:%.*]] = call i32 @llvm.ctlz.i32(i32 [[S]], i1 true)
+; CHECK-NEXT:    ret i32 [[R]]
+;
+  %s = lshr i32 -42, %x
+  %r = call i32 @llvm.ctlz.i32(i32 %s, i1 true)
+  ret i32 %r
+}
+
 define <3 x i33> @ctlz_lshr_sign_bit_vec(<3 x i33> %x) {
 ; CHECK-LABEL: @ctlz_lshr_sign_bit_vec(
 ; CHECK-NEXT:    ret <3 x i33> [[X:%.*]]
@@ -1441,6 +1452,17 @@ define i32 @ctlz_ashr_sign_bit(i32 %x) {
   ret i32 %r
 }
 
+define i32 @ctlz_ashr_negative(i32 %x) {
+; CHECK-LABEL: @ctlz_ashr_negative(
+; CHECK-NEXT:    [[S:%.*]] = ashr i32 -42, [[X:%.*]]
+; CHECK-NEXT:    [[R:%.*]] = call i32 @llvm.ctlz.i32(i32 [[S]], i1 false)
+; CHECK-NEXT:    ret i32 [[R]]
+;
+  %s = ashr i32 -42, %x
+  %r = call i32 @llvm.ctlz.i32(i32 %s, i1 false)
+  ret i32 %r
+}
+
 define <3 x i33> @ctlz_ashr_sign_bit_vec(<3 x i33> %x) {
 ; CHECK-LABEL: @ctlz_ashr_sign_bit_vec(
 ; CHECK-NEXT:    [[S:%.*]] = ashr <3 x i33> <i33 -4294967296, i33 undef, i33 -4294967296>, [[X:%.*]]


        


More information about the llvm-commits mailing list