summaryrefslogtreecommitdiff
path: root/test/Transforms/InstCombine/icmp.ll
diff options
context:
space:
mode:
authorNick Lewycky <nicholas@mxc.ca>2011-03-05 04:28:48 +0000
committerNick Lewycky <nicholas@mxc.ca>2011-03-05 04:28:48 +0000
commit9feda1730c225589e144fb1f86a86a8cf3f39c9e (patch)
treee024f109b317ad7d10ff2c005376054d3cfa50e7 /test/Transforms/InstCombine/icmp.ll
parent874be74179b087be36a6e7869f3aa8b70732aca1 (diff)
downloadllvm-9feda1730c225589e144fb1f86a86a8cf3f39c9e.tar.gz
llvm-9feda1730c225589e144fb1f86a86a8cf3f39c9e.tar.bz2
llvm-9feda1730c225589e144fb1f86a86a8cf3f39c9e.tar.xz
Try once again to optimize "icmp (srem X, Y), Y" by turning the comparison into
true/false or "icmp slt/sge Y, 0". git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@127063 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstCombine/icmp.ll')
-rw-r--r--test/Transforms/InstCombine/icmp.ll16
1 files changed, 16 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/icmp.ll b/test/Transforms/InstCombine/icmp.ll
index fba273550b..fb43e59453 100644
--- a/test/Transforms/InstCombine/icmp.ll
+++ b/test/Transforms/InstCombine/icmp.ll
@@ -403,3 +403,19 @@ define i1 @test41(i32 %X, i32 %Y) {
%B = icmp ugt i32 %Y, %A
ret i1 %B
}
+
+; CHECK: @test42
+; CHECK: %B = icmp sgt i32 %Y, -1
+define i1 @test42(i32 %X, i32 %Y) {
+ %A = srem i32 %X, %Y
+ %B = icmp slt i32 %A, %Y
+ ret i1 %B
+}
+
+; CHECK: @test43
+; CHECK: %B = icmp slt i32 %Y, 0
+define i1 @test43(i32 %X, i32 %Y) {
+ %A = srem i32 %X, %Y
+ %B = icmp slt i32 %Y, %A
+ ret i1 %B
+}