[llvm] r198916 - ARM IAS: support #:{lower, upper}16: for GNU compatibility
Saleem Abdulrasool
compnerd at compnerd.org
Thu Jan 9 20:38:40 PST 2014
Author: compnerd
Date: Thu Jan 9 22:38:40 2014
New Revision: 198916
URL: http://llvm.org/viewvc/llvm-project?rev=198916&view=rev
Log:
ARM IAS: support #:{lower,upper}16: for GNU compatibility
The GNU assembler supports prefixing the expression with a '#' to indiciate that
the value that is being moved is infact a constant. This improves the
compatibility of the integrated assembler's parser for this.
Added:
llvm/trunk/test/MC/ARM/target-expressions.s
Modified:
llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
Modified: llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp?rev=198916&r1=198915&r2=198916&view=diff
==============================================================================
--- llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp (original)
+++ llvm/trunk/lib/Target/ARM/AsmParser/ARMAsmParser.cpp Thu Jan 9 22:38:40 2014
@@ -4813,6 +4813,10 @@ bool ARMAsmParser::parseOperand(SmallVec
bool ARMAsmParser::parsePrefix(ARMMCExpr::VariantKind &RefKind) {
RefKind = ARMMCExpr::VK_ARM_None;
+ // consume an optional '#' (GNU compatibility)
+ if (getLexer().is(AsmToken::Hash))
+ Parser.Lex();
+
// :lower16: and :upper16: modifiers
assert(getLexer().is(AsmToken::Colon) && "expected a :");
Parser.Lex(); // Eat ':'
Added: llvm/trunk/test/MC/ARM/target-expressions.s
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/test/MC/ARM/target-expressions.s?rev=198916&view=auto
==============================================================================
--- llvm/trunk/test/MC/ARM/target-expressions.s (added)
+++ llvm/trunk/test/MC/ARM/target-expressions.s Thu Jan 9 22:38:40 2014
@@ -0,0 +1,44 @@
+@ RUN: llvm-mc -triple armv7-eabi -filetype asm -o - %s | FileCheck %s
+
+ .syntax unified
+
+ .type function,%function
+function:
+ bx lr
+
+.set deadbeat, 0xdeadbea7
+
+ .type test,%function
+test:
+ movw r0, :lower16:function
+ movt r0, :upper16:function
+
+ movw r1, #:lower16:function
+ movt r1, #:upper16:function
+
+ movw r2, :lower16:deadbeat
+ movt r2, :upper16:deadbeat
+
+ movw r3, #:lower16:deadbeat
+ movt r3, #:upper16:deadbeat
+
+ movw r4, :lower16:0xD1510D6E
+ movt r4, :upper16:0xD1510D6E
+
+ movw r5, #:lower16:0xD1510D6E
+ movt r5, #:upper16:0xD1510D6E
+
+@ CHECK-LABEL: test:
+@ CHECK: movw r0, :lower16:function
+@ CHECK: movt r0, :upper16:function
+@ CHECK: movw r1, :lower16:function
+@ CHECK: movt r1, :upper16:function
+@ CHECK: movw r2, :lower16:(3735928487)
+@ CHECK: movt r2, :upper16:(3735928487)
+@ CHECK: movw r3, :lower16:(3735928487)
+@ CHECK: movt r3, :upper16:(3735928487)
+@ CHECK: movw r4, :lower16:(3511749998)
+@ CHECK: movt r4, :upper16:(3511749998)
+@ CHECK: movw r5, :lower16:(3511749998)
+@ CHECK: movt r5, :upper16:(3511749998)
+
More information about the llvm-commits
mailing list