[PATCH] D57327: [ARM] Thumb2: ConstantMaterializationCost
Sjoerd Meijer via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Jan 29 01:25:49 PST 2019
SjoerdMeijer updated this revision to Diff 184034.
SjoerdMeijer added a comment.
Addressed comments.
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D57327/new/
https://reviews.llvm.org/D57327
Files:
lib/Target/ARM/ARMISelDAGToDAG.cpp
test/CodeGen/ARM/shifter_operand.ll
Index: test/CodeGen/ARM/shifter_operand.ll
===================================================================
--- test/CodeGen/ARM/shifter_operand.ll
+++ test/CodeGen/ARM/shifter_operand.ll
@@ -256,3 +256,26 @@
ret { i32, i32 } %ret
}
+
+declare dso_local i32 @eat_const(i32)
+
+define hidden i32 @no_litpool() minsize optsize {
+; CHECK-LABEL: no_litpool:
+; CHECK: mov{{.*}} r0, #65536
+; CHECK: mov{{.*}} r0, #-134217728
+; CHECK: mvn r0, #-134217728
+entry:
+ %call0 = tail call i32 @eat_const(i32 65536)
+ %call1 = tail call i32 @eat_const(i32 -134217728)
+ %call2 = tail call i32 @eat_const(i32 134217727)
+ ret i32 %call2
+}
+
+define hidden i32 @litpool() minsize optsize {
+; CHECK-LABEL: litpool:
+; CHECK: ldr r0, {{.*}}LCPI{{.*}}
+; CHECK-NEXT: b {{.*}}eat_const
+entry:
+ %call1 = tail call i32 @eat_const(i32 8388601)
+ ret i32 %call1
+}
Index: lib/Target/ARM/ARMISelDAGToDAG.cpp
===================================================================
--- lib/Target/ARM/ARMISelDAGToDAG.cpp
+++ lib/Target/ARM/ARMISelDAGToDAG.cpp
@@ -451,8 +451,9 @@
if (Subtarget->isThumb()) {
if (Val <= 255) return 1; // MOV
if (Subtarget->hasV6T2Ops() &&
- (Val <= 0xffff || ARM_AM::getT2SOImmValSplatVal(Val) != -1))
- return 1; // MOVW
+ (Val <= 0xffff || ARM_AM::getT2SOImmVal(Val) != -1 || // MOV + MOVW
+ ARM_AM::getT2SOImmVal(~Val) != -1)) // MVN
+ return 1;
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: D57327.184034.patch
Type: text/x-patch
Size: 1723 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20190129/abed7dbe/attachment.bin>
More information about the llvm-commits
mailing list