summaryrefslogtreecommitdiffstats
path: root/llvm/test/CodeGen/X86/shift-combine.ll
diff options
context:
space:
mode:
authorBenjamin Kramer <benny.kra@googlemail.com>2015-06-26 14:51:49 +0000
committerBenjamin Kramer <benny.kra@googlemail.com>2015-06-26 14:51:49 +0000
commitc2ae76737753a55f18a290f1e64f8bca60423449 (patch)
treefdcb984129d8ef3720dfbdc54a2793c5510fe65a /llvm/test/CodeGen/X86/shift-combine.ll
parent07e70b4fa4d6e2504fcd3d6c0b0415e378b937eb (diff)
downloadbcm5719-llvm-c2ae76737753a55f18a290f1e64f8bca60423449.tar.gz
bcm5719-llvm-c2ae76737753a55f18a290f1e64f8bca60423449.zip
[DAGCombiner] Preserve the exact bit when simplifying SRA to SRL.
Allows more aggressive folding of ashr/shl pairs. llvm-svn: 240788
Diffstat (limited to 'llvm/test/CodeGen/X86/shift-combine.ll')
-rw-r--r--llvm/test/CodeGen/X86/shift-combine.ll10
1 files changed, 10 insertions, 0 deletions
diff --git a/llvm/test/CodeGen/X86/shift-combine.ll b/llvm/test/CodeGen/X86/shift-combine.ll
index 7fb19a6cad0..43301041a0b 100644
--- a/llvm/test/CodeGen/X86/shift-combine.ll
+++ b/llvm/test/CodeGen/X86/shift-combine.ll
@@ -37,6 +37,16 @@ define i32* @test_exact2(i32 %a, i32 %b, i32* %x) {
ret i32* %gep
}
+define i32* @test_exact3(i32 %a, i32 %b, i32* %x) {
+; CHECK-LABEL: test_exact3:
+; CHECK-NOT: sarl
+
+ %sub = sub i32 %b, %a
+ %shr = ashr exact i32 %sub, 2
+ %gep = getelementptr inbounds i32, i32* %x, i32 %shr
+ ret i32* %gep
+}
+
define i32* @test_exact4(i32 %a, i32 %b, i32* %x) {
; CHECK-LABEL: test_exact4:
; CHECK: shrl %
OpenPOWER on IntegriCloud