summaryrefslogtreecommitdiffstats
path: root/llvm/test
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2010-11-23 18:52:42 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2010-11-23 18:52:42 +0000
commitb5afa65b0a426ef8ce7b4602952b5c3b106071e7 (patch)
tree19b8f73545bb7dbdbfc2c625bd1f119edcd0be1d /llvm/test
parente3120ed1bfc0b8163186732efce14f3b5d9ecf5f (diff)
downloadbcm5719-llvm-b5afa65b0a426ef8ce7b4602952b5c3b106071e7.tar.gz
bcm5719-llvm-b5afa65b0a426ef8ce7b4602952b5c3b106071e7.zip
InstCombine: Reduce "X shift (A srem B)" to "X shift (A urem B)" iff B is positive.
This allows to transform the rem in "1 << ((int)x % 8);" to an and. llvm-svn: 120028
Diffstat (limited to 'llvm/test')
-rw-r--r--llvm/test/Transforms/InstCombine/shift.ll11
1 files changed, 11 insertions, 0 deletions
diff --git a/llvm/test/Transforms/InstCombine/shift.ll b/llvm/test/Transforms/InstCombine/shift.ll
index 871e9fe070e..6bebca9cc85 100644
--- a/llvm/test/Transforms/InstCombine/shift.ll
+++ b/llvm/test/Transforms/InstCombine/shift.ll
@@ -441,3 +441,14 @@ entry:
; CHECK: %ins = or i128 %tmp23, %A
; CHECK: %tmp46 = trunc i128 %ins to i64
}
+
+define i32 @test38(i32 %x) nounwind readnone {
+entry:
+ %rem = srem i32 %x, 32
+ %shl = shl i32 1, %rem
+ ret i32 %shl
+; CHECK: @test38
+; CHECK-NOT: srem
+; CHECK: ret i32
+}
+
OpenPOWER on IntegriCloud