summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoman Lebedev <lebedev.ri@gmail.com>2019-07-21 09:05:49 +0000
committerRoman Lebedev <lebedev.ri@gmail.com>2019-07-21 09:05:49 +0000
commit8a431874e995b3ff3c4c99a23cfed0429cc9f117 (patch)
tree0af4cc548f8fbb00c04b42803b395eb5c16b9008
parentfe1b8a09113db0a1b3894c80f0e214d8489d0241 (diff)
downloadbcm5719-llvm-8a431874e995b3ff3c4c99a23cfed0429cc9f117.tar.gz
bcm5719-llvm-8a431874e995b3ff3c4c99a23cfed0429cc9f117.zip
[NFC][InstCombine] Add a few extra srem-by-power-of-two tests - extra uses
llvm-svn: 366652
-rw-r--r--llvm/test/Transforms/InstCombine/rem.ll37
1 files changed, 37 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/rem.ll b/llvm/test/Transforms/InstCombine/rem.ll
index c5adeb77e53..ea95072e8c1 100644
--- a/llvm/test/Transforms/InstCombine/rem.ll
+++ b/llvm/test/Transforms/InstCombine/rem.ll
@@ -701,6 +701,43 @@ define <2 x i1> @test25_vec(<2 x i32> %A) {
ret <2 x i1> %C
}
+define i1 @test26(i32 %A, i32 %B) {
+; CHECK-LABEL: @test26(
+; CHECK-NEXT: [[C:%.*]] = shl nuw i32 1, [[B:%.*]]
+; CHECK-NEXT: [[D:%.*]] = srem i32 [[A:%.*]], [[C]]
+; CHECK-NEXT: [[E:%.*]] = icmp ne i32 [[D]], 0
+; CHECK-NEXT: ret i1 [[E]]
+;
+ %C = shl i32 1, %B ; not a constant
+ %D = srem i32 %A, %C
+ %E = icmp ne i32 %D, 0
+ ret i1 %E
+}
+
+define i1 @test27(i32 %A, i32* %remdst) {
+; CHECK-LABEL: @test27(
+; CHECK-NEXT: [[B:%.*]] = srem i32 [[A:%.*]], -2147483648
+; CHECK-NEXT: store i32 [[B]], i32* [[REMDST:%.*]], align 1
+; CHECK-NEXT: [[C:%.*]] = icmp ne i32 [[B]], 0
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %B = srem i32 %A, 2147483648 ; signbit
+ store i32 %B, i32* %remdst, align 1 ; extra use of rem
+ %C = icmp ne i32 %B, 0
+ ret i1 %C
+}
+
+define i1 @test28(i32 %A) {
+; CHECK-LABEL: @test28(
+; CHECK-NEXT: [[B:%.*]] = srem i32 [[A:%.*]], -2147483648
+; CHECK-NEXT: [[C:%.*]] = icmp eq i32 [[B]], 0
+; CHECK-NEXT: ret i1 [[C]]
+;
+ %B = srem i32 %A, 2147483648 ; signbit
+ %C = icmp eq i32 %B, 0 ; another equality predicate
+ ret i1 %C
+}
+
; FP division-by-zero is not UB.
define double @PR34870(i1 %cond, double %x, double %y) {
OpenPOWER on IntegriCloud