[ARM] Extract shifts out of multiply-by-constant
authorJohn Brawn <john.brawn@arm.com>
Mon, 14 Sep 2015 15:19:41 +0000 (15:19 +0000)
committerJohn Brawn <john.brawn@arm.com>
Mon, 14 Sep 2015 15:19:41 +0000 (15:19 +0000)
commite50e6f3e3d15a274f4eb065e51e6fc7a9d673843
tree47d8eb74697c4e76b6ad2902cdc043d52703cee1
parent74e437e7b1e30e86d453fb2317800b418d0290fd
[ARM] Extract shifts out of multiply-by-constant

Turning (op x (mul y k)) into (op x (lsl (mul y k>>n) n)) is beneficial when
we can do the lsl as a shifted operand and the resulting multiply constant is
simpler to generate.

Do this by doing the transformation when trying to select a shifted operand,
as that ensures that it actually turns out better (the alternative would be to
do it in PreprocessISelDAG, but we don't know for sure there if extracting the
shift would allow a shifted operand to be used).

Differential Revision: http://reviews.llvm.org/D12196

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@247569 91177308-0d34-0410-b5e6-96231b3b80d8
lib/Target/ARM/ARMISelDAGToDAG.cpp
test/CodeGen/ARM/shifter_operand.ll