summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorWeiming Zhao <weimingz@codeaurora.org>2016-08-03 17:05:23 +0000
committerWeiming Zhao <weimingz@codeaurora.org>2016-08-03 17:05:23 +0000
commit57dc4cf0e1dc149f05569aee7c5dd8fec04f81b4 (patch)
treeb556506ad1ad97783d201353a01b6c686411b92a /llvm/lib
parent8cf51c340dcb0c150a5dcb8c820c758c781404d9 (diff)
downloadbcm5719-llvm-57dc4cf0e1dc149f05569aee7c5dd8fec04f81b4.tar.gz
bcm5719-llvm-57dc4cf0e1dc149f05569aee7c5dd8fec04f81b4.zip
[ARM] Constant Materialize: imms with specific value can be encoded into mov.w
Summary: Thumb2 supports encoding immediates with specific patterns into mov.w by splatting the low 8 bits into other bytes. Reviewers: john.brawn, jmolloy Subscribers: jmolloy, aemerson, rengolin, samparker, llvm-commits Differential Revision: https://reviews.llvm.org/D23090 llvm-svn: 277610
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp b/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp
index d11de555fa3..01b4e19940d 100644
--- a/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp
+++ b/llvm/lib/Target/ARM/ARMISelDAGToDAG.cpp
@@ -476,7 +476,9 @@ bool ARMDAGToDAGISel::isShifterOpProfitable(const SDValue &Shift,
unsigned ARMDAGToDAGISel::ConstantMaterializationCost(unsigned Val) const {
if (Subtarget->isThumb()) {
if (Val <= 255) return 1; // MOV
- if (Subtarget->hasV6T2Ops() && Val <= 0xffff) return 1; // MOVW
+ if (Subtarget->hasV6T2Ops() &&
+ (Val <= 0xffff || ARM_AM::getT2SOImmValSplatVal(Val) != -1))
+ return 1; // MOVW
if (Val <= 510) return 2; // MOV + ADDi8
if (~Val <= 255) return 2; // MOV + MVN
if (ARM_AM::isThumbImmShiftedVal(Val)) return 2; // MOV + LSL
OpenPOWER on IntegriCloud