[PATCH] D23090: [ARM] Constant Materialize: imms with specific value can be encoded into mov.w
Weiming Zhao via llvm-commits
llvm-commits at lists.llvm.org
Wed Aug 3 10:13:11 PDT 2016
This revision was automatically updated to reflect the committed changes.
Closed by commit rL277610: [ARM] Constant Materialize: imms with specific value can be encoded into mov.w (authored by weimingz).
Changed prior to commit:
https://reviews.llvm.org/D23090?vs=66573&id=66674#toc
Repository:
rL LLVM
https://reviews.llvm.org/D23090
Files:
llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp
llvm/trunk/test/CodeGen/ARM/subtarget-no-movt.ll
Index: llvm/trunk/test/CodeGen/ARM/subtarget-no-movt.ll
===================================================================
--- llvm/trunk/test/CodeGen/ARM/subtarget-no-movt.ll
+++ llvm/trunk/test/CodeGen/ARM/subtarget-no-movt.ll
@@ -42,4 +42,21 @@
ret i32 %1
}
+; NO-OPTION-LABEL: {{_?}}foo2
+; NO-OPTION: mov.w r0, #-536813568
+; NO-OPTION-LABEL-NOT: .long
+
+; USE-MOVT-LABEL: {{_?}}foo2
+; USE-MOVT: mov.w r0, #-536813568
+; USE-MOVT-NOT: .long
+
+; NO-USE-MOVT-LABEL: {{_?}}foo2
+; NO-USE-MOVT: mov.w r0, #-536813568
+; NO-USE-MOVT-NOT: .long
+define i32 @foo2() {
+ %1 = load i32, i32* inttoptr (i32 -536813568 to i32*) ; load from 0xe000e000
+ ret i32 %1
+}
+
+
attributes #0 = { "target-features"="+no-movt" }
Index: llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp
===================================================================
--- llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp
+++ llvm/trunk/lib/Target/ARM/ARMISelDAGToDAG.cpp
@@ -476,7 +476,9 @@
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
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D23090.66674.patch
Type: text/x-patch
Size: 1568 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20160803/f6c1b31a/attachment.bin>
More information about the llvm-commits
mailing list