summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ARM/AsmParser
diff options
context:
space:
mode:
authorKevin Enderby <enderby@apple.com>2012-12-14 23:04:25 +0000
committerKevin Enderby <enderby@apple.com>2012-12-14 23:04:25 +0000
commit06aa3eb8cebb2878a862f30638f6279c40c1a719 (patch)
tree30cf0acc019ebd18858cf86ac09e579901a2aafd /llvm/lib/Target/ARM/AsmParser
parent1fb2e7dfe1d42d302315d3684945f3af1600e00a (diff)
downloadbcm5719-llvm-06aa3eb8cebb2878a862f30638f6279c40c1a719.tar.gz
bcm5719-llvm-06aa3eb8cebb2878a862f30638f6279c40c1a719.zip
Make sure the alternate PC+imm syntax of LDR instruction with a small
immediate generates the narrow version. Needed when doing round-trip assemble/disassemble testing using the alternate syntax that specifies 'pc' directly. llvm-svn: 170255
Diffstat (limited to 'llvm/lib/Target/ARM/AsmParser')
-rw-r--r--llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
index 4685b1d193c..6b42239747e 100644
--- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
+++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
@@ -5723,7 +5723,12 @@ processInstruction(MCInst &Inst,
}
// Aliases for alternate PC+imm syntax of LDR instructions.
case ARM::t2LDRpcrel:
- Inst.setOpcode(ARM::t2LDRpci);
+ // Select the narrow version if the immediate will fit.
+ if (Inst.getOperand(1).getImm() > 0 &&
+ Inst.getOperand(1).getImm() <= 0xff)
+ Inst.setOpcode(ARM::tLDRpci);
+ else
+ Inst.setOpcode(ARM::t2LDRpci);
return true;
case ARM::t2LDRBpcrel:
Inst.setOpcode(ARM::t2LDRBpci);
OpenPOWER on IntegriCloud