summaryrefslogtreecommitdiff
path: root/gas/testsuite/gas
diff options
context:
space:
mode:
authorRichard Sandiford <richard.sandiford@arm.com>2023-03-30 11:09:06 +0100
committerRichard Sandiford <richard.sandiford@arm.com>2023-03-30 11:09:06 +0100
commitb9ca389690810dd03e96a6d11470539f923d03b9 (patch)
treecb2a4c5a7e5c510bd46fb870b0e915ef911cc90f /gas/testsuite/gas
parent30ba1d7e2fe36f6bcddb2aa0693f198c96c735b7 (diff)
downloadbinutils-gdb-b9ca389690810dd03e96a6d11470539f923d03b9.tar.gz
aarch64: Improve errors for malformed register lists
parse_typed_reg is used for parsing both bare registers and registers that occur in lists. If it doesn't see a register, or sees an unexpected kind of register, it queues a default error to report the problem. These default errors have the form "operand N must be an X", where X comes from the operand table. If there are multiple opcode entries that report default errors, GAS tries to pick the most appropriate one, using the opcode table order as a tiebreaker. But this can lead to cases where a syntax error in a register list is reported against an opcode that doesn't accept register lists. For example, the unlikely error: ext z0.b,{,},#0 is reported as: operand 2 must be an SVE vector register -- `ext z0.b,{,},#0' even though operand 2 can be a register list. If we've parsed the opening '{' of a register list, and then see something that isn't remotely register-like, it seems better to report that directly as a syntax error, rather than rely on the default error. The operand won't be a valid list of anything, so there's no need to pick a specific Y in "operand N must be a list of Y".
Diffstat (limited to 'gas/testsuite/gas')
-rw-r--r--gas/testsuite/gas/aarch64/illegal-sve2.l1
-rw-r--r--gas/testsuite/gas/aarch64/illegal-sve2.s1
-rw-r--r--gas/testsuite/gas/aarch64/sme-4-illegal.l16
-rw-r--r--gas/testsuite/gas/aarch64/sve-invalid.l4
-rw-r--r--gas/testsuite/gas/aarch64/sve-invalid.s5
5 files changed, 19 insertions, 8 deletions
diff --git a/gas/testsuite/gas/aarch64/illegal-sve2.l b/gas/testsuite/gas/aarch64/illegal-sve2.l
index 6241de123db..2eab4120331 100644
--- a/gas/testsuite/gas/aarch64/illegal-sve2.l
+++ b/gas/testsuite/gas/aarch64/illegal-sve2.l
@@ -238,6 +238,7 @@
[^ :]+:[0-9]+: Error: operand 1 must be an SVE vector register -- `eortb z32\.h,z0\.h,z0\.h'
[^ :]+:[0-9]+: Error: operand 2 must be an SVE vector register -- `eortb z0\.s,z32\.s,z0\.s'
[^ :]+:[0-9]+: Error: operand 3 must be an SVE vector register -- `eortb z0\.s,z0\.s,z32\.s'
+[^ :]+:[0-9]+: Error: syntax error in register list at operand 2 -- `ext z0\.b,{,},#0'
[^ :]+:[0-9]+: Error: invalid register list at operand 2 -- `ext z0\.b,{z0\.b,z2\.b},#0'
[^ :]+:[0-9]+: Error: operand mismatch -- `ext z0\.h,{z0\.b,z1\.b},#0'
[^ :]+:[0-9]+: Info: did you mean this\?
diff --git a/gas/testsuite/gas/aarch64/illegal-sve2.s b/gas/testsuite/gas/aarch64/illegal-sve2.s
index 3f3602a8474..4b6285c185e 100644
--- a/gas/testsuite/gas/aarch64/illegal-sve2.s
+++ b/gas/testsuite/gas/aarch64/illegal-sve2.s
@@ -166,6 +166,7 @@ eortb z32.h, z0.h, z0.h
eortb z0.s, z32.s, z0.s
eortb z0.s, z0.s, z32.s
+ext z0.b, {,}, #0
ext z0.b, { z0.b, z2.b }, #0
ext z0.h, { z0.b, z1.b }, #0
ext z0.b, { z0.h, z1.b }, #0
diff --git a/gas/testsuite/gas/aarch64/sme-4-illegal.l b/gas/testsuite/gas/aarch64/sme-4-illegal.l
index b61832e4223..72f62667768 100644
--- a/gas/testsuite/gas/aarch64/sme-4-illegal.l
+++ b/gas/testsuite/gas/aarch64/sme-4-illegal.l
@@ -8,16 +8,16 @@
[^:]*:[0-9]+: Error: ZA tile number out of range at operand 1 -- `zero {za0\.d,za3.s,za2.h}'
[^:]*:[0-9]+: Error: ZA tile number out of range at operand 1 -- `zero {za1.b}'
[^:]*:[0-9]+: Error: unexpected comma after the mnemonic name `zero' -- `zero ,'
-[^:]*:[0-9]+: Error: operand 1 must be a list of 64-bit ZA element tiles -- `zero {'
-[^:]*:[0-9]+: Error: operand 1 must be a list of 64-bit ZA element tiles -- `zero {,'
+[^:]*:[0-9]+: Error: syntax error in register list at operand 1 -- `zero {'
+[^:]*:[0-9]+: Error: syntax error in register list at operand 1 -- `zero {,'
[^:]*:[0-9]+: Error: expected '{' at operand 1 -- `zero }'
-[^:]*:[0-9]+: Error: operand 1 must be a list of 64-bit ZA element tiles -- `zero {,}'
-[^:]*:[0-9]+: Error: operand 1 must be a list of 64-bit ZA element tiles -- `zero {,,}'
+[^:]*:[0-9]+: Error: syntax error in register list at operand 1 -- `zero {,}'
+[^:]*:[0-9]+: Error: syntax error in register list at operand 1 -- `zero {,,}'
[^:]*:[0-9]+: Error: missing ZA tile size at operand 1 -- `zero {za0}'
-[^:]*:[0-9]+: Error: operand 1 must be a list of 64-bit ZA element tiles -- `zero {,za0.d}'
-[^:]*:[0-9]+: Error: operand 1 must be a list of 64-bit ZA element tiles -- `zero {za0.d,}'
-[^:]*:[0-9]+: Error: operand 1 must be a list of 64-bit ZA element tiles -- `zero {za0.d,za1.d,}'
-[^:]*:[0-9]+: Error: operand 1 must be a list of 64-bit ZA element tiles -- `zero {za,}'
+[^:]*:[0-9]+: Error: syntax error in register list at operand 1 -- `zero {,za0.d}'
+[^:]*:[0-9]+: Error: syntax error in register list at operand 1 -- `zero {za0.d,}'
+[^:]*:[0-9]+: Error: syntax error in register list at operand 1 -- `zero {za0.d,za1.d,}'
+[^:]*:[0-9]+: Error: syntax error in register list at operand 1 -- `zero {za,}'
[^:]*:[0-9]+: Error: unexpected character `}' in element size at operand 1 -- `zero {za.}'
[^:]*:[0-9]+: Error: expected '}' at operand 1 -- `zero {za-}'
[^:]*:[0-9]+: Error: operand 1 must be a list of 64-bit ZA element tiles -- `zero {za_}'
diff --git a/gas/testsuite/gas/aarch64/sve-invalid.l b/gas/testsuite/gas/aarch64/sve-invalid.l
index 32b7952436f..930d67328e6 100644
--- a/gas/testsuite/gas/aarch64/sve-invalid.l
+++ b/gas/testsuite/gas/aarch64/sve-invalid.l
@@ -1204,3 +1204,7 @@
.*: Error: operand mismatch -- `udot z0\.d,z1\.d,z2\.d\[0\]'
.*: Info: did you mean this\?
.*: Info: udot z0\.s, z1\.b, z2\.b\[0\]
+.*: Error: syntax error in register list at operand 1 -- `ld2b {},p0/z,\[x0\]'
+.*: Error: syntax error in register list at operand 1 -- `ld2b {.b},p0/z,\[x0\]'
+.*: Error: syntax error in register list at operand 1 -- `ld2b {z0.b-},p0/z,\[x0\]'
+.*: Error: syntax error in register list at operand 1 -- `ld2b {z0.b,},p0/z,\[x0\]'
diff --git a/gas/testsuite/gas/aarch64/sve-invalid.s b/gas/testsuite/gas/aarch64/sve-invalid.s
index 204721ee17a..ece2142b072 100644
--- a/gas/testsuite/gas/aarch64/sve-invalid.s
+++ b/gas/testsuite/gas/aarch64/sve-invalid.s
@@ -1324,3 +1324,8 @@
udot z0.h, z1.h, z2.h[0]
udot z0.s, z1.s, z2.s[0]
udot z0.d, z1.d, z2.d[0]
+
+ ld2b {}, p0/z, [x0]
+ ld2b {.b}, p0/z, [x0]
+ ld2b {z0.b-}, p0/z, [x0]
+ ld2b {z0.b,}, p0/z, [x0]