return false;
}
- // If we have a '#', it's an immediate offset, else assume it's a register
- // offset. Be friendly and also accept a plain integer (without a leading
- // hash) for gas compatibility.
+ // If we have a '#' or '$', it's an immediate offset, else assume it's a
+ // register offset. Be friendly and also accept a plain integer or expression
+ // (without a leading hash) for gas compatibility.
if (Parser.getTok().is(AsmToken::Hash) ||
Parser.getTok().is(AsmToken::Dollar) ||
+ Parser.getTok().is(AsmToken::LParen) ||
Parser.getTok().is(AsmToken::Integer)) {
- if (Parser.getTok().isNot(AsmToken::Integer))
- Parser.Lex(); // Eat '#' or '$'.
+ if (Parser.getTok().is(AsmToken::Hash) ||
+ Parser.getTok().is(AsmToken::Dollar))
+ Parser.Lex(); // Eat '#' or '$'
E = Parser.getTok().getLoc();
bool isNegative = getParser().getTok().is(AsmToken::Minus);
--- /dev/null
+@ RUN: llvm-mc -triple=arm-linux-gnueabi < %s | FileCheck %s
+
+@ CHECK: ldr r12, [sp, #15]
+ldr r12, [sp, (15)]
+
+@ CHECK: ldr r12, [sp, #15]
+ldr r12, [sp, #(15)]
+
+@ CHECK: ldr r12, [sp, #15]
+ldr r12, [sp, $(15)]
+
+@ CHECK: ldr r12, [sp, #100]
+ldr r12, [sp, (((15+5)*5))]
+
+@ CHECK: ldr r12, [sp, #100]
+ldr r12, [sp, #(((15+5)*5))]
+
+
+@ CHECK: ldr r12, [sp, #100]
+ldr r12, [sp, $(((15+5)*5))]