aboutsummaryrefslogtreecommitdiffstats
path: root/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
commita827a47923700c16256036ca0bda8c0ff6108fdb (patch)
tree803f5867742dc1b3334802ebe66bd47df6158c62 /lib/Target/ARM/AsmParser
parent07acee7a09c4895904f827bf56cf15f6bf8ef9f6 (diff)
downloadexternal_llvm-a827a47923700c16256036ca0bda8c0ff6108fdb.zip
external_llvm-a827a47923700c16256036ca0bda8c0ff6108fdb.tar.gz
external_llvm-a827a47923700c16256036ca0bda8c0ff6108fdb.tar.bz2
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. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@170255 91177308-0d34-0410-b5e6-96231b3b80d8
Diffstat (limited to 'lib/Target/ARM/AsmParser')
-rw-r--r--lib/Target/ARM/AsmParser/ARMAsmParser.cpp7
1 files changed, 6 insertions, 1 deletions
diff --git a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
index 4685b1d..6b42239 100644
--- a/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
+++ b/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);