Optimize some 64-bit multiplication by constants into two lea's or one lea + shl...
authorEvan Cheng <evan.cheng@apple.com>
Sat, 28 Mar 2009 05:57:29 +0000 (05:57 +0000)
committerEvan Cheng <evan.cheng@apple.com>
Sat, 28 Mar 2009 05:57:29 +0000 (05:57 +0000)
commit0b0cd9113af42c422c829563c3b12e6e52bd2d79
tree9b3c7aba0c5687a35d4f494df6b4bc6de48f3f71
parente8b64106ecf1057c7506d44ec8f64b5c83ee51c7
Optimize some 64-bit multiplication by constants into two lea's or one lea + shl since imulq is slow (latency 5). e.g.
x * 40
=>
shlq    $3, %rdi
leaq    (%rdi,%rdi,4), %rax

This has the added benefit of allowing more multiply to be folded into addressing mode. e.g.
a * 24 + b
=>
leaq    (%rdi,%rdi,2), %rax
leaq    (%rsi,%rax,8), %rax

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@67917 91177308-0d34-0410-b5e6-96231b3b80d8
include/llvm/Target/TargetLowering.h
lib/CodeGen/SelectionDAG/DAGCombiner.cpp
lib/Target/X86/X86ISelLowering.cpp
test/CodeGen/X86/imul-lea-2.ll [new file with mode: 0644]