[PATCH] D80028: [AArch64] Support expression results as immediate values in mov

Eli Friedman via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Wed May 27 14:43:11 PDT 2020


efriedma added inline comments.


================
Comment at: llvm/test/MC/AArch64/mov-invalid-expression-as-immediate.s:9
+// CHECK: mov x0, 1b - 0b
+// CHECK: ^
----------------
jcai19 wrote:
> efriedma wrote:
> > Please also add a testcase for something like `mov x0, 0b`, where the value can't be resolved in the assembler.
> This is actually interesting.  GAS assembled the following code 
> 
> 0:
> .skip 4
> 1:
> mov x0, 1b
> 
> into 
> 
> mov	x0, #0x4 
> 
> With the proposed change, IAS would calculate the offset (4) correctly but discard it as it considers the expression 1b unresolved, and generate the following code.
> 
> mov	x0, #0x0
> 
> What's the expected outcome here? Is subtraction between two symbols the only valid expressions we should accept? Thanks.
Converting the address of a label to constant without a relocation is clearly a bug; we shouldn't try to reproduce that behavior.

I think I'd prefer to be conservative and forbid expressions that would require a relocation in the object file, at least for now.  (The user can spell it out with movz/movk if the actually want a relocation.)


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D80028/new/

https://reviews.llvm.org/D80028





More information about the llvm-commits mailing list