[llvm] 15f29c4 - [InstCombine] Add more pre-commit tests for PR57328. NFC.
Yingwei Zheng via llvm-commits
llvm-commits at lists.llvm.org
Sun Sep 24 09:41:29 PDT 2023
Author: Yingwei Zheng
Date: 2023-09-25T00:40:06+08:00
New Revision: 15f29c482b74664c41e35582b3f0088469484f01
URL: https://github.com/llvm/llvm-project/commit/15f29c482b74664c41e35582b3f0088469484f01
DIFF: https://github.com/llvm/llvm-project/commit/15f29c482b74664c41e35582b3f0088469484f01.diff
LOG: [InstCombine] Add more pre-commit tests for PR57328. NFC.
Added:
Modified:
llvm/test/Transforms/InstCombine/ispow2.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/ispow2.ll b/llvm/test/Transforms/InstCombine/ispow2.ll
index bbd693b11b388ad..356f23e1a01d3ff 100644
--- a/llvm/test/Transforms/InstCombine/ispow2.ll
+++ b/llvm/test/Transforms/InstCombine/ispow2.ll
@@ -193,8 +193,8 @@ define i1 @is_pow2_ctpop(i32 %x) {
}
; tests from PR57328
-define i1 @is_pow2_non_zero(i32 %x) {
-; CHECK-LABEL: @is_pow2_non_zero(
+define i1 @is_pow2_non_zero_ult_2(i32 %x) {
+; CHECK-LABEL: @is_pow2_non_zero_ult_2(
; CHECK-NEXT: [[NOTZERO:%.*]] = icmp ne i32 [[X:%.*]], 0
; CHECK-NEXT: call void @llvm.assume(i1 [[NOTZERO]])
; CHECK-NEXT: [[T0:%.*]] = tail call i32 @llvm.ctpop.i32(i32 [[X]]), !range [[RNG0]]
@@ -208,6 +208,21 @@ define i1 @is_pow2_non_zero(i32 %x) {
ret i1 %cmp
}
+define i1 @is_pow2_non_zero_eq_1(i32 %x) {
+; CHECK-LABEL: @is_pow2_non_zero_eq_1(
+; CHECK-NEXT: [[NOTZERO:%.*]] = icmp ne i32 [[X:%.*]], 0
+; CHECK-NEXT: call void @llvm.assume(i1 [[NOTZERO]])
+; CHECK-NEXT: [[T0:%.*]] = tail call i32 @llvm.ctpop.i32(i32 [[X]]), !range [[RNG0]]
+; CHECK-NEXT: [[CMP:%.*]] = icmp eq i32 [[T0]], 1
+; CHECK-NEXT: ret i1 [[CMP]]
+;
+ %notzero = icmp ne i32 %x, 0
+ call void @llvm.assume(i1 %notzero)
+ %t0 = tail call i32 @llvm.ctpop.i32(i32 %x)
+ %cmp = icmp eq i32 %t0, 1
+ ret i1 %cmp
+}
+
define i1 @is_pow2_ctpop_logical(i32 %x) {
; CHECK-LABEL: @is_pow2_ctpop_logical(
; CHECK-NEXT: [[T0:%.*]] = tail call i32 @llvm.ctpop.i32(i32 [[X:%.*]]), !range [[RNG0]]
More information about the llvm-commits
mailing list