]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gas/config/tc-aarch64.c
Accept alternative-base LDRS[BHW] as an alias of LDURS[BHW]
authorRichard Sandiford <richard.sandiford@arm.com>
Thu, 3 Mar 2022 09:55:41 +0000 (09:55 +0000)
committerRichard Sandiford <richard.sandiford@arm.com>
Wed, 30 Mar 2022 10:21:11 +0000 (11:21 +0100)
commitbef6900eeff94e5b1eb7281def33589f78d6911a
tree9a5e64dcf09b1c59e6d09544060cd0f58344a265
parentdd0ed54c1a4e459f6f1a8331499eb63520d31a75
Accept alternative-base LDRS[BHW] as an alias of LDURS[BHW]

Many load instructions have two forms: LDR<x> that takes either:

- a register index or
- an unsigned scaled immediate offset

and LDUR<x> that takes:

- a signed unscaled immediate offset in the range [-256, 255]

The assembler usually maps out-of-range LDR<x> offsets to LDUR<x>
where possible.  GAS does this using matching OP_* codes; see
try_to_encode_as_unscaled_ldst in gas/config/tc-aarch64.c.

Some alternative-base Morello instructions also come in these
LDR/LDUR pairs, so we can use the same approach for them.

However, the alternative-base forms of LDRS[BHW] only support a
register index.  They do not have a register+unsigned scaled form.
There is therefore no OP_* pair linking alternative-base LDRS[BHW]
and LDURS[BHW] instructions.

This patch therefore treats immediate LDRS[BHW] as a straight alias
of LDURS[BHW].  Following existing practice, LDURS[BHW] is still the
preferred disassembly, so the patch uses F_P1 to force LDURS[BHW] to
be chosen ahead of LDRS[BHW].

Following the general preference for using immediate forms where
possible:

   ldrsb x0, [c0]

is treated as:

   ldursb x0, [c0, #0]

rather than:

   ldrsb x0, [c0, xzr]

Co-Authored-By: Stam Markianos-Wright <stam.markianos-wright@arm.com>
gas/config/tc-aarch64.c
gas/testsuite/gas/aarch64/morello_ldst-c64.d
gas/testsuite/gas/aarch64/morello_ldst.d
gas/testsuite/gas/aarch64/morello_ldst.s
include/opcode/aarch64.h
opcodes/aarch64-asm-2.c
opcodes/aarch64-dis-2.c
opcodes/aarch64-opc-2.c
opcodes/aarch64-tbl.h