[PATCH 07/10] aarch64: Add support for +mops

Nick Clifton nickc@redhat.com
Thu Dec 2 12:55:43 GMT 2021


Hi Richard,

> I took the perhaps controversial decision to generate the individual
> instruction forms using macros rather than list them out individually.

The problem with using macros like this is that it makes it harder to
search the source code for the definition of a single specific instruction.

Suppose for example that it was discovered that the wrong mask had been used
for the encoding of the cpyfrt instruction, but none of the other copy
instructions.  (I am making this up - I am not suggesting that the code is
actually wrong).  A grep of the source code in the opcodes/ directory would
not show me where cpyfrt is defined, leading to a more difficult debugging
session.


> This becomes useful with a follow-on patch to check that code follows
> the correct P/M/E sequence.

If the full names of the instructions were to be added as a comment where
the macro is invoked, would this cause problems ?  Ie if:

    MOPS_CPY_INSN ("cpyf", 0x19000400, 0xffe0fc00),

were to be changed to:

    MOPS_CPY_INSN ("cpyf", 0x19000400, 0xffe0fc00), /* cpyf, cpyfwt, cpyfrt, cpyft */

would this interfere with your plans for a follow up patch ?

If not then I would ask that you do this as I am sure that it will help
in the future.  (Plus of course similar changes to other lines where the
macros are invoked).


> Tested on aarch64-linux-gnu.  OK to install?


> include/
> 	* opcode/aarch64.h (AARCH64_FEATURE_MOPS): New macro.
> 	(AARCH64_ARCH_V8_8): Make armv8.8-a imply AARCH64_FEATURE_MOPS.
> 	(AARCH64_OPND_MOPS_ADDR_Rd): New aarch64_opnd.
> 	(AARCH64_OPND_MOPS_ADDR_Rs): Likewise.
> 	(AARCH64_OPND_MOPS_WB_Rn): Likewise.
> 
> opcodes/
> 	* aarch64-asm.h (ins_x0_to_x30): New inserter.
> 	* aarch64-asm.c (aarch64_ins_x0_to_x30): New function.
> 	* aarch64-dis.h (ext_x0_to_x30): New extractor.
> 	* aarch64-dis.c (aarch64_ext_x0_to_x30): New function.
> 	* aarch64-tbl.h (aarch64_feature_mops): New feature set.
> 	(aarch64_feature_mops_memtag): Likewise.
> 	(MOPS, MOPS_MEMTAG, MOPS_INSN, MOPS_MEMTAG_INSN)
> 	(MOPS_CPY_OP1_OP2_PME_INSN, MOPS_CPY_OP1_OP2_INSN, MOPS_CPY_OP1_INSN)
> 	(MOPS_CPY_INSN, MOPS_SET_OP1_OP2_PME_INSN, MOPS_SET_OP1_OP2_INSN)
> 	(MOPS_SET_INSN): New macros.
> 	(aarch64_opcode_table): Add MOPS instructions.
> 	(aarch64_opcode_table): Add entries for AARCH64_OPND_MOPS_ADDR_Rd,
> 	AARCH64_OPND_MOPS_ADDR_Rs and AARCH64_OPND_MOPS_WB_Rn.
> 	* aarch64-opc.c (aarch64_print_operand): Handle
> 	AARCH64_OPND_MOPS_ADDR_Rd, AARCH64_OPND_MOPS_ADDR_Rs and
> 	AARCH64_OPND_MOPS_WB_Rn.
> 	(verify_three_different_regs): New function.
> 	* aarch64-asm-2.c: Regenerate.
> 	* aarch64-dis-2.c: Likewise.
> 	* aarch64-opc-2.c: Likewise.
> 
> gas/
> 	* doc/c-aarch64.texi: Document +mops.
> 	* config/tc-aarch64.c (parse_x0_to_x30): New function.
> 	(parse_operands): Handle AARCH64_OPND_MOPS_ADDR_Rd,
> 	AARCH64_OPND_MOPS_ADDR_Rs and AARCH64_OPND_MOPS_WB_Rn.
> 	(aarch64_features): Add "mops".
> 	* testsuite/gas/aarch64/mops.s, testsuite/gas/aarch64/mops.d: New test.
> 	* testsuite/gas/aarch64/mops_invalid.s,
> 	* testsuite/gas/aarch64/mops_invalid.d,
> 	* testsuite/gas/aarch64/mops_invalid.l: Likewise.

Approved - please apply - with the change suggested above if at all possible.

Cheers
   Nick



More information about the Binutils mailing list