[Patch, GAS] LDRA, LDRAB assembler mnemonic improvement

Delia Burduv Delia.Burduv@arm.com
Tue Oct 29 16:33:00 GMT 2019


Hi,

I modified the assembler to accept the omission of the immediate 
argument for the writeback form of the ldraa and ldrab mnemonics as a 
shorthand for the immediate argument being 0, as described here 
https://developer.arm.com/docs/ddi0596/latest/base-instructions-alphabetic-order/ldraa-ldrab-load-register-with-pointer-authentication 
. This is because the instructions still have a use with an immediate 
argument of 0, unlike loads without the PAC functionality. Currently, 
the mnemonics are

LDRAA Xt, [Xn, #<simm10>]!
LDRAB Xt, [Xn, #<simm10>]!

After this patch they become

LDRAA Xt, [Xn {, #<simm10>}]!
LDRAB Xt, [Xn {, #<simm10>}]!

Example:
$cat test.s
.text

     ldraa   x1, [x0]!
     ldrab   x2, [x0]!

     ldraa   x1, [x0, #0]!
     ldrab   x2, [x0, #0]!

Assembler without this patch:
$ ./aarch64-none-linux-gnu-as -march=armv8.3-a test.s
test.s: Assembler messages:
test.s:3: Error: missing offset in the pre-indexed address at operand 2 
-- `ldraa x1,[x0]!'
test.s:4: Error: missing offset in the pre-indexed address at operand 2 
-- `ldrab x2,[x0]!'


Assembler and Disassembler with this patch:
$ ./aarch64-none-linux-gnu-as -march=armv8.3-a test.s -o test.o

$ ./aarch64-none-linux-gnu-objdump -d test.o

test.o:     file format elf64-littleaarch64


Disassembly of section .text:

0000000000000000 <.text>:
    0:    f8200c01     ldraa    x1, [x0]!
    4:    f8a00c02     ldrab    x2, [x0]!
    8:    f8200c01     ldraa    x1, [x0]!
    c:    f8a00c02     ldrab    x2, [x0]!

I have tested the patch for aarch64-none-linux-gnu and there was no 
regression. I don't have commit rights, so if this is ok can someone 
please commit it for me?

Thanks,
Delia

gas/ChangeLog
2019-09-13  Delia Burduv  <Delia.Burduv@arm.com>

         * config/tc-aarch64.c (parse_address_main): Accept the omission 
of the immediate
         argument for ldraa and ldrab as a shorthand for the immediate 
being 0.
         * testsuite/gas/aarch64/ldraa-ldrab-no-offset.d: New test.
         * testsuite/gas/aarch64/ldraa-ldrab-no-offset.s: New test.
         * testsuite/gas/aarch64/illegal-ldraa.s: Modified to accept the 
writeback
         form with no offset.
         * testsuite/gas/aarch64/illegal-ldraa.s: Removed missing offset 
error.

opcodes/ChangeLog
2019-09-24  Delia Burduv   <delia.burduv@arm.com>

         * aarch64-opc.c (print_immediate_offset_address): Don't print 
the immediate for
         the writeback form of ldraa/ldrab if it is 0.
         * aarch64-tbl.h: Updated the documentation for ADDR_SIMM10.
         * aarch64-opc-2.c: Regenerated.

-------------- next part --------------
A non-text attachment was scrubbed...
Name: p.patch
Type: text/x-patch
Size: 12492 bytes
Desc: p.patch
URL: <https://sourceware.org/pipermail/binutils/attachments/20191029/bde02ee4/attachment.bin>


More information about the Binutils mailing list