summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target
diff options
context:
space:
mode:
authorDavid Green <david.green@arm.com>2018-02-20 11:07:35 +0000
committerDavid Green <david.green@arm.com>2018-02-20 11:07:35 +0000
commit056476497eae191c8e275f0a7a9547f1c1c87feb (patch)
tree5407b4741783c33ed8e095bbb53f0934fec30eb3 /llvm/lib/Target
parent76e5023dd3cbad6be47944b7fe8d075a148e11ef (diff)
downloadbcm5719-llvm-056476497eae191c8e275f0a7a9547f1c1c87feb.tar.gz
bcm5719-llvm-056476497eae191c8e275f0a7a9547f1c1c87feb.zip
[ARM] Mark -1 as cheap in xor's for thumb1
We can always convert xor %a, -1 into MVN, even in thumb 1 where the -1 would not otherwise be considered a cheap constant. This prevents the -1's from being pulled out into constants and potentially hoisted. Differential Revision: https://reviews.llvm.org/D43451 llvm-svn: 325573
Diffstat (limited to 'llvm/lib/Target')
-rw-r--r--llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp b/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
index 43d7888075b..02c6eb925ca 100644
--- a/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
+++ b/llvm/lib/Target/ARM/ARMTargetTransformInfo.cpp
@@ -126,6 +126,13 @@ int ARMTTIImpl::getIntImmCost(unsigned Opcode, unsigned Idx, const APInt &Imm,
return 0;
}
+ // xor a, -1 can always be folded to MVN
+ if (Opcode == Instruction::Xor) {
+ int64_t NegImm = Imm.getSExtValue();
+ if (NegImm == -1)
+ return 0;
+ }
+
return getIntImmCost(Imm, Ty);
}
OpenPOWER on IntegriCloud