binutils-gdb/include/opcode
Victor Do Nascimento 459784def0 gas: Implement categorization of Morello-specific instructions
While the concept of a core instruction relates to the idea of
instructions that are available irrespective of the presence of
architectural extensions, this concept breaks down with the
introduction of the Morello architecture.

Rather, what is observed in Morello is that when PSTATE.C64 == 1,
the A64C_INSN variant becomes the ONLY valid aarch64_opcode variant,
with the CORE_INSN variant becoming illegal.  Therefore, some way of
ruling out the use of such CORE_INSNs is needed.

Similarly, some A64C_INSN instructions are only valid for
PSTATE.C64 == 1 and are not valid when compiling for Morello A64
mode.

At the assembly level, the CORE_INSN and A64C_INSN variants share the
same mnemonic, differing only by whether they are passed a general-
purpose register argument or its capability counterpart, e.g.

  * CORE_INSN: adr x0, #0
  * A64C_INSN: adr c0, #0

This makes the prospect of combining both insn variants in binutils
into a single insn entry in aarch64_opcode_table[], resolving the
appropriate operand code (e.g. AARCH64_OPND_Can versus
AARCH64_OPND_Rn) at compile time by analyzing the -march and -mabi
flags.

This approach falls short when dealing with instructions such as `bl'
where the core and morello instructions share the same mnemonic but
have distinct encodings.

A more flexible approach is therefore presented here.  Special
restrictions to instructions are encoded in the FLAGS field, which
can then be used in checks carried out in `md_assemble'.

This fixes two issues:
  1. Wrong fix suggestions in `output_operand_error_record':
     - attempting to assemble `adr w0, #0' at present, for example,
     results in a suggestion that `w0' be changed to `x0' as opposed
     to `c0'.
  2. Purecap only instructions being accepted when assembling without
  the C64 extension:
     - `adr c0, #0' is currently accepted when assembling for
     Hybrid mode.

This patch defines the F_NONC64 and F_C64ONLY flags for labellig these
instructions in aarch64_opcode.flags, such that unavailable instructions
could be identified by cross-referencing this field along with whether
C64 is set in the `cpu_variant' aarch64_feature_set variable.  When
the conditions set by the flag is not met by `cpu_variant', the
instruction can be attributed a AARCH64_OPDE_SYNTAX_ERROR, allowing
for correct error handling in md_assemble.

ChangeLog:
  * include/opcode/aarch64.h (F_NONC64): New flag.
  * include/opcode/aarch64.h (F_C64ONLY): Likewise.

opcodes/ChangeLog:
  * aarch64-tbl.h (aarch64_opcode_table): Add F_NONC64 and F_C64ONLY
  to relevant aarch64_opcodes

gas/ChangeLog:
  * config/tc-aarch64.c (validate_opcode_for_feature): New.
  (md_assemble): Use `validate_opcode_for_feature' in template
  selection.
  * gas/testsuite/gas/aarch64/morello-exclude.l: New testcase.
  * gas/testsuite/gas/aarch64/morello-exclude.s: Likewise.
  * gas/testsuite/gas/aarch64/morello-exclude.l: Likewise.
  * gas/testsuite/gas/aarch64/morello_insn.s: Fix hybrid codegen.
2023-05-17 12:44:32 +01:00
..
aarch64.h gas: Implement categorization of Morello-specific instructions 2023-05-17 12:44:32 +01:00
alpha.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
arc-attrs.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
arc-func.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
arc.h [ARC] Add finer details for LLOCK and SCOND 2020-01-07 15:25:34 +02:00
arm.h Fix the ARM assembler to generate a Realtime profile for armv8-r. 2020-05-19 12:45:42 +01:00
avr.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
bfin.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
cgen.h opcodes: discriminate endianness and insn-endianness in CGEN ports 2020-06-04 16:17:42 +02:00
ChangeLog-0415 binutils ChangeLog rotation 2016-01-01 22:59:17 +10:30
ChangeLog-9103 Add copyright notices 2012-12-10 12:48:03 +00:00
convex.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
cr16.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
cris.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
crx.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
csky.h CSKY: Change ISA flag's type to bfd_uint64_t and fix build error. 2020-09-12 00:56:01 +08:00
d10v.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
d30v.h ubsan: d30v: negation of -2147483648 2020-02-04 14:10:40 +10:30
dlx.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
ft32.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
h8300.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
hppa.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
i386.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
ia64.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
m68hc11.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
m68k.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
metag.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
mips.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
mmix.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
mn10200.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
mn10300.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
moxie.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
msp430-decode.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
msp430.h MSP430: Fix relocation overflow when using #lo(EXP) macro 2020-01-15 13:23:06 +00:00
nds32.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
nfp.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
nios2.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
nios2r1.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
nios2r2.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
np1.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
ns32k.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
pdp11.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
pj.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
pn.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
ppc.h Power10 Reduced precision outer product operations 2020-05-11 21:08:37 +09:30
pru.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
pyr.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
riscv-opc.h RISC-V: Support debug and float CSR as the unprivileged ones. 2020-06-30 09:54:55 +08:00
riscv.h PR26493 UBSAN: elfnn-riscv.c left shift of negative value 2020-08-31 20:28:10 +09:30
rl78.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
rx.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
s12z.h Enable building the s12z target on Solaris hosts where REG_Y is defined in system header files. 2020-01-02 12:04:40 +00:00
s390.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
score-datadep.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
score-inst.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
sparc.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
spu-insns.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
spu.h ubsan: spu: left shift of negative value 2020-01-10 17:32:33 +10:30
tic4x.h tic4x: sign extension using shifts 2020-01-13 12:12:05 +10:30
tic6x-control-registers.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
tic6x-insn-formats.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
tic6x-opcode-table.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
tic6x.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
tic30.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
tic54x.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
tilegx.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
tilepro.h PR26044, Some targets can't be compiled with GCC 10 (tilepro) 2020-05-28 21:11:51 +09:30
v850.h ubsan: v850-opc.c:412 left shift cannot be represented 2020-09-02 16:30:44 +09:30
vax.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
visium.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
wasm.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30
xgate.h Update year range in copyright notice of binutils files 2020-01-01 18:42:54 +10:30