aarch64: Try to report invalid variants against the closest match
authorRichard Sandiford <richard.sandiford@arm.com>
Thu, 30 Mar 2023 10:09:08 +0000 (11:09 +0100)
committerRichard Sandiford <richard.sandiford@arm.com>
Thu, 30 Mar 2023 10:09:08 +0000 (11:09 +0100)
commitb5b4f6654515c93e131578045260d2dc8c6caeee
tree12c8e7df6d2170c68664aee74a2ed34d81ed2440
parent8c2216b2773ee9e5a233fa29e12b61d1646af18e
aarch64: Try to report invalid variants against the closest match

If an instruction has invalid qualifiers, GAS would report the
error against the final opcode entry that got to the qualifier-
checking stage.  It seems better to report the error against
the opcode entry that had the closest match, just like we
pick the closest match within an opcode entry for the
"did you mean this?" message.

This patch adds the number of invalid operands as an
argument to AARCH64_OPDE_INVALID_VARIANT and then picks the
AARCH64_OPDE_INVALID_VARIANT with the lowest argument.
gas/config/tc-aarch64.c
gas/testsuite/gas/aarch64/illegal-sve2.l
gas/testsuite/gas/aarch64/sme-illegal.l
gas/testsuite/gas/aarch64/sve-invalid.l
opcodes/aarch64-dis.c
opcodes/aarch64-opc.c
opcodes/aarch64-opc.h