diff options
author | Nick Lewycky <nicholas@mxc.ca> | 2011-03-04 10:06:52 +0000 |
---|---|---|
committer | Nick Lewycky <nicholas@mxc.ca> | 2011-03-04 10:06:52 +0000 |
commit | 786792784e898f29febb3e7270d54b0e21e3c904 (patch) | |
tree | f78e6e1fe0cbd54096297b2eb788daf50719d749 /test/Transforms/InstSimplify/compare.ll | |
parent | 3a73e343d02ba3a00adf03311183cc0ccc960978 (diff) |
Fold "icmp pred (srem X, Y), Y" like we do for urem. Handle signed comparisons
in the urem case, though not the other way around. This is enough to get #3 from
PR9343!
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@126991 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test/Transforms/InstSimplify/compare.ll')
-rw-r--r-- | test/Transforms/InstSimplify/compare.ll | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/test/Transforms/InstSimplify/compare.ll b/test/Transforms/InstSimplify/compare.ll index 44c678c6f1..11295b7072 100644 --- a/test/Transforms/InstSimplify/compare.ll +++ b/test/Transforms/InstSimplify/compare.ll @@ -236,6 +236,15 @@ define i1 @urem4(i32 %X) { ; CHECK: ret i1 %B } +define i1 @urem5(i16 %X, i32 %Y) { +; CHECK: @urem5 + %A = zext i16 %X to i32 + %B = urem i32 %A, %Y + %C = icmp slt i32 %B, %Y + ret i1 %C +; CHECK: ret i1 true +} + define i1 @srem1(i32 %X) { ; CHECK: @srem1 %A = srem i32 %X, -5 @@ -244,6 +253,15 @@ define i1 @srem1(i32 %X) { ; CHECK: ret i1 false } +define i1 @srem2(i32 %X, i32 %Y) { +; CHECK: @srem2 + %neg = sub i32 %Y, 0 + %A = srem i32 %X, %Y + %B = icmp slt i32 %A, %neg + ret i1 %B +; CHECK: ret i1 true +} + define i1 @udiv1(i32 %X) { ; CHECK: @udiv1 %A = udiv i32 %X, 1000000 |