Skip to content

Commit e3a4785

Browse files
author
Victor Do Nascimento
committed
arch64: Add optional operand register pair support tests
Add tests to cover the full range of behaviors observed around optional register operands for the `tlbip' and `sysp' instructions, namely: * Not all `tlbip' operations take GPR operands. When this is the case, we should check that neither optional operand was supplied. * When a `tlbip' operation is labeled with the `F_HASXT' flag, xzr is not a valid optional operand. In such case, at least the fist optional register needs to be specified with a non-xzr value. * The first operand for both insns should be either xzr or an even-numbered register (n % 2 == 0). In the former scenario, the second operand should default to xzr too, while in the latter, it should default to n + 1.
1 parent 9af8f67 commit e3a4785

File tree

5 files changed

+57
-0
lines changed

5 files changed

+57
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
#name: Illegal optional operand pair use
2+
#as: -mno-verbose-error
3+
#source: illegal-sysp-tlbip-optional.s
4+
#error_output: illegal-sysp-tlbip-optional.l
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
[^:]*: Assembler messages:
2+
[^:]*:5: Error: missing register at operand 2 -- `tlbip vale3nxs'
3+
[^:]*:9: Error: extraneous register at operand 2 -- `tlbip paall,x0'
4+
[^:]*:10: Error: extraneous register at operand 2 -- `tlbip paall,x0,x1'
Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
.arch armv9.4-a+d128
2+
3+
/* TLBIP operands marked with the F_HASXT don not allow xzr to be used
4+
as GPR arguments and so require at least one register to be specified. */
5+
tlbip vale3nxs
6+
7+
/* Conversely, those without the flag do not allow us to specify registers,
8+
so the only accepted alternative is the complete omission of optional ops. */
9+
tlbip paall, x0
10+
tlbip paall, x0, x1
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#objdump: -dr
2+
3+
.*
4+
5+
Disassembly of section \.text:
6+
7+
0+ <\.text>:
8+
[^:]*: d54e97a0 sysp #6, C9, C7, #5, x0, x1
9+
[^:]*: d54e97a0 sysp #6, C9, C7, #5, x0, x1
10+
[^:]*: d54e97a2 sysp #6, C9, C7, #5, x2, x3
11+
[^:]*: d54e97a2 sysp #6, C9, C7, #5, x2, x3
12+
[^:]*: d54e879f sysp #6, C8, C7, #4
13+
[^:]*: d54e97bf sysp #6, C9, C7, #5
14+
[^:]*: d54e97a0 sysp #6, C9, C7, #5, x0, x1
15+
[^:]*: d54e97a0 sysp #6, C9, C7, #5, x0, x1
16+
[^:]*: d54e97a2 sysp #6, C9, C7, #5, x2, x3
17+
[^:]*: d54e97a2 sysp #6, C9, C7, #5, x2, x3
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
.arch armv9.4-a+d128
2+
3+
/* TLBIP operands marked with the F_HASXT don not allow xzr to be used
4+
as GPR arguments and so require at least one register to be specified. */
5+
tlbip vale3nxs, x0
6+
tlbip vale3nxs, x0, x1
7+
tlbip vale3nxs, x2
8+
tlbip vale3nxs, x2, x3
9+
10+
11+
/* Conversely, those without the flag do not allow us to specify registers,
12+
so the only accepted alternative is the complete omission of optional ops. */
13+
tlbip paall
14+
15+
/* No such checking is carried out when the same instruction is issued
16+
directly via the sysp implementation defined maintenance instruction,
17+
such that both GRPs are optional. */
18+
sysp #6, C9, C7, #5
19+
sysp #6, C9, C7, #5, x0
20+
sysp #6, C9, C7, #5, x0, x1
21+
sysp #6, c9, c7, #5, x2
22+
sysp #6, c9, c7, #5, x2, x3

0 commit comments

Comments
 (0)