summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJim Grosbach <grosbach@apple.com>2011-12-05 22:16:39 +0000
committerJim Grosbach <grosbach@apple.com>2011-12-05 22:16:39 +0000
commite489babf9bdac926a27a4895bcc1f557e4598e13 (patch)
treeb0aacba71c6d60b13ca999f8d961e9c1e8b1018c
parent1a10f29b2f5716167bef90496c0b5683fdf71e90 (diff)
downloadbcm5719-llvm-e489babf9bdac926a27a4895bcc1f557e4598e13.tar.gz
bcm5719-llvm-e489babf9bdac926a27a4895bcc1f557e4598e13.zip
Thumb2 prefer ADD register encoding T2 to T3 when possible.
rdar://10529664 llvm-svn: 145860
-rw-r--r--llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp20
1 files changed, 20 insertions, 0 deletions
diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
index cd6752a241c..c1a745216e8 100644
--- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
+++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
@@ -5238,6 +5238,26 @@ processInstruction(MCInst &Inst,
return true;
}
break;
+ case ARM::t2ADDrr: {
+ // If the destination and first source operand are the same, and
+ // there's no setting of the flags, use encoding T2 instead of T3.
+ // Note that this is only for ADD, not SUB. This mirrors the system
+ // 'as' behaviour. Make sure the wide encoding wasn't explicit.
+ if (Inst.getOperand(0).getReg() != Inst.getOperand(1).getReg() ||
+ Inst.getOperand(5).getReg() != 0 ||
+ (static_cast<ARMOperand*>(Operands[2])->isToken() &&
+ static_cast<ARMOperand*>(Operands[2])->getToken() == ".w"))
+ break;
+ MCInst TmpInst;
+ TmpInst.setOpcode(ARM::tADDhirr);
+ TmpInst.addOperand(Inst.getOperand(0));
+ TmpInst.addOperand(Inst.getOperand(0));
+ TmpInst.addOperand(Inst.getOperand(2));
+ TmpInst.addOperand(Inst.getOperand(3));
+ TmpInst.addOperand(Inst.getOperand(4));
+ Inst = TmpInst;
+ return true;
+ }
case ARM::tB:
// A Thumb conditional branch outside of an IT block is a tBcc.
if (Inst.getOperand(1).getImm() != ARMCC::AL && !inITBlock()) {
OpenPOWER on IntegriCloud