[llvm] 911cfcd - [InstCombine][NFC] Add baseline tests for folds of srem(X, PowerOf2) == C
Alexander Shaposhnikov via llvm-commits
llvm-commits at lists.llvm.org
Sat Apr 2 20:28:22 PDT 2022
Author: Alexander Shaposhnikov
Date: 2022-04-03T03:26:47Z
New Revision: 911cfcd7f591b945369de3fca37dace71ae6054d
URL: https://github.com/llvm/llvm-project/commit/911cfcd7f591b945369de3fca37dace71ae6054d
DIFF: https://github.com/llvm/llvm-project/commit/911cfcd7f591b945369de3fca37dace71ae6054d.diff
LOG: [InstCombine][NFC] Add baseline tests for folds of srem(X, PowerOf2) == C
Extracted from: https://reviews.llvm.org/D122942
Test plan: make check-all
Added:
Modified:
llvm/test/Transforms/InstCombine/rem.ll
Removed:
################################################################################
diff --git a/llvm/test/Transforms/InstCombine/rem.ll b/llvm/test/Transforms/InstCombine/rem.ll
index f9439b2dab32f..b52803ae5da42 100644
--- a/llvm/test/Transforms/InstCombine/rem.ll
+++ b/llvm/test/Transforms/InstCombine/rem.ll
@@ -740,8 +740,8 @@ define i1 @test28(i32 %A) {
ret i1 %C
}
-define i1 @positive_and_odd(i32 %A) {
-; CHECK-LABEL: @positive_and_odd(
+define i1 @positive_and_odd_eq(i32 %A) {
+; CHECK-LABEL: @positive_and_odd_eq(
; CHECK-NEXT: [[B:%.*]] = srem i32 [[A:%.*]], 2
; CHECK-NEXT: [[C:%.*]] = icmp eq i32 [[B]], 1
; CHECK-NEXT: ret i1 [[C]]
@@ -751,8 +751,8 @@ define i1 @positive_and_odd(i32 %A) {
ret i1 %C
}
-define i1 @negative_and_odd(i32 %A) {
-; CHECK-LABEL: @negative_and_odd(
+define i1 @negative_and_odd_eq(i32 %A) {
+; CHECK-LABEL: @negative_and_odd_eq(
; CHECK-NEXT: [[B:%.*]] = srem i32 [[A:%.*]], 2
; CHECK-NEXT: [[C:%.*]] = icmp eq i32 [[B]], -1
; CHECK-NEXT: ret i1 [[C]]
@@ -762,6 +762,28 @@ define i1 @negative_and_odd(i32 %A) {
ret i1 %C
}
+define i1 @positive_and_odd_ne(i32 %A) {
+; CHECK-LABEL: @positive_and_odd_ne(
+; CHECK-NEXT: [[B:%.*]] = srem i32 [[A:%.*]], 2
+; CHECK-NEXT: [[C:%.*]] = icmp ne i32 [[B]], 1
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %B = srem i32 %A, 2
+ %C = icmp ne i32 %B, 1
+ ret i1 %C
+}
+
+define i1 @negative_and_odd_ne(i32 %A) {
+; CHECK-LABEL: @negative_and_odd_ne(
+; CHECK-NEXT: [[B:%.*]] = srem i32 [[A:%.*]], 2
+; CHECK-NEXT: [[C:%.*]] = icmp ne i32 [[B]], -1
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %B = srem i32 %A, 2
+ %C = icmp ne i32 %B, -1
+ ret i1 %C
+}
+
; FP division-by-zero is not UB.
define double @PR34870(i1 %cond, double %x, double %y) {
More information about the llvm-commits
mailing list