]> git.ipfire.org Git - thirdparty/binutils-gdb.git/commit - gas/config/tc-aarch64.c
aarch64: Fix SVE2 register/immediate distinction
authorRichard Sandiford <richard.sandiford@arm.com>
Thu, 30 Mar 2023 10:09:02 +0000 (11:09 +0100)
committerRichard Sandiford <richard.sandiford@arm.com>
Thu, 30 Mar 2023 10:09:02 +0000 (11:09 +0100)
commiteee2ecccdaa37d6c5d283d6346f70897ba27166b
treeec16043f0edcdd0b02104b064b4a9b75773ccc9e
parent89f55b440abdffea9046e225918b5ceb6a57ab85
aarch64: Fix SVE2 register/immediate distinction

GAS refuses to interpret register names like x0 as unadorned
immediates, due to the obvious potential for confusion with
register operands.  (An explicit #x0 is OK.)

For compatibility reasons, we can't extend the set of registers
that GAS rejects for existing instructions.  For example:

   mov x0, z0

was valid code before SVE was added, so it needs to stay valid
code even when SVE is enabled.  But we can make GAS reject newer
registers in newer instructions.  The SVE instruction:

   and z0.s, z0.s, z0.h

is therefore invalid, rather than z0.h being an immediate.

This patch extends the SVE behaviour to SVE2.  The old call
to AARCH64_CPU_HAS_FEATURE was technically the wrong way around,
although it didn't matter in practice for base SVE instructions
since their avariants only set SVE.
gas/config/tc-aarch64.c
gas/testsuite/gas/aarch64/illegal-sve2.l
gas/testsuite/gas/aarch64/illegal-sve2.s