aboutsummaryrefslogtreecommitdiffstats
path: root/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
commitb70ebd2aa3b6f4546d4734e7bcdbed2017036b4d (patch)
tree7a1cb693711ee656cedc1b3c67fddc8f6bf61aa0 /test
parente104f1bccbf828dcbe4e82709c8ca97d8bf018d5 (diff)
downloadexternal_llvm-b70ebd2aa3b6f4546d4734e7bcdbed2017036b4d.zip
external_llvm-b70ebd2aa3b6f4546d4734e7bcdbed2017036b4d.tar.gz
external_llvm-b70ebd2aa3b6f4546d4734e7bcdbed2017036b4d.tar.bz2
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@120028 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'test')
-rw-r--r--test/Transforms/InstCombine/shift.ll11
1 files changed, 11 insertions, 0 deletions
diff --git a/test/Transforms/InstCombine/shift.ll b/test/Transforms/InstCombine/shift.ll
index 871e9fe..6bebca9 100644
--- a/test/Transforms/InstCombine/shift.ll
+++ b/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
+}
+