summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
diff options
context:
space:
mode:
authorOwen Anderson <resistor@mac.com>2011-08-29 19:36:44 +0000
committerOwen Anderson <resistor@mac.com>2011-08-29 19:36:44 +0000
commit967674d26ceb2604ef829eba848e0b4097091cc3 (patch)
treee09e604ab1f9c03a9286c7a6cb34f38c83c6f597 /llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
parentd62d51c84d17d192a52959d2b5a3d843ed2c46e6 (diff)
downloadbcm5719-llvm-967674d26ceb2604ef829eba848e0b4097091cc3.tar.gz
bcm5719-llvm-967674d26ceb2604ef829eba848e0b4097091cc3.zip
Improve handling of #-0 offsets for many more pre-indexed addressing modes.
llvm-svn: 138754
Diffstat (limited to 'llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp')
-rw-r--r--llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp13
1 files changed, 9 insertions, 4 deletions
diff --git a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
index 2c7accd61c7..443e54481a0 100644
--- a/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
+++ b/llvm/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
@@ -638,7 +638,8 @@ public:
// Immediate offset in range [-1020, 1020] and a multiple of 4.
if (!Mem.OffsetImm) return true;
int64_t Val = Mem.OffsetImm->getValue();
- return Val >= -1020 && Val <= 1020 && ((Val & 3) == 0);
+ return (Val >= -1020 && Val <= 1020 && ((Val & 3) == 0)) ||
+ Val == INT32_MIN;
}
bool isMemRegOffset() const {
if (Kind != Memory || !Mem.OffsetRegNum)
@@ -709,7 +710,7 @@ public:
// Immediate offset in range [-4095, 4095].
if (!Mem.OffsetImm) return true;
int64_t Val = Mem.OffsetImm->getValue();
- return Val > -4096 && Val < 4096;
+ return (Val > -4096 && Val < 4096) || (Val == INT32_MIN);
}
bool isPostIdxImm8() const {
if (Kind != Immediate)
@@ -2565,8 +2566,7 @@ parseMemory(SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
Parser.Lex(); // Eat the '#'.
E = Parser.getTok().getLoc();
- // FIXME: Special case #-0 so we can correctly set the U bit.
-
+ bool isNegative = getParser().getTok().is(AsmToken::Minus);
const MCExpr *Offset;
if (getParser().ParseExpression(Offset))
return true;
@@ -2578,6 +2578,11 @@ parseMemory(SmallVectorImpl<MCParsedAsmOperand*> &Operands) {
if (!CE)
return Error (E, "constant expression expected");
+ // If the constant was #-0, represent it as INT32_MIN.
+ int32_t Val = CE->getValue();
+ if (isNegative && Val == 0)
+ CE = MCConstantExpr::Create(INT32_MIN, getContext());
+
// Now we should have the closing ']'
E = Parser.getTok().getLoc();
if (Parser.getTok().isNot(AsmToken::RBrac))
OpenPOWER on IntegriCloud