-
Notifications
You must be signed in to change notification settings - Fork 184
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use of pseudo instructions in compliance tests. #106
Comments
IMO, this is only one step away from suggesting the compliance tests shouldn't rely on the assembler at all, and should instead rewrite its own. Inconsistencies in the documentation and implementation of pseudoinstructions should be rectified, but that's a bad reason to stop using them. |
@aswaterman I agree that the documentation/implementation should be fixed, but that wasn't really the point I was making. It was just what brought it to my attention. Compliance is (amongst other things), checking that he instructions of the machine behave as the standard says they should. So I think it is better to be explicit about the instructions that are being tested. |
@jeremybennett when you're testing |
I think it is wrong to use pseudo instructions in compliance tests and is unnecessary and it should be mandated that compliance tests DO NOT use pseudos.
Compliance testing is about the hardware and not the software tools...
Also - use of pseudo instructions causes trouble for log/dissembler based functional coverage tools used to test compliance coverage which either report wrong coverage or have to convert all pseudos to real instructions.
Just to be clear - I would support mandating that all compliance tests do not use pseudo instructions.
thanks
Simon
…________________________________
From: Jeremy Bennett <notifications@github.com>
Sent: 22 April 2020 08:39
To: riscv/riscv-compliance <riscv-compliance@noreply.github.com>
Cc: Subscribed <subscribed@noreply.github.com>
Subject: [riscv/riscv-compliance] Use of pseudo instructions in compliance tests. (#106)
This is a discussion point - I am not clear what the correct answer is.
In issue #105<#105>, I note that the regression tests use one of the assembler pseudo instructions, la, in a non-standard way.
la rd, symbol
is a shorthand for
auipc rd, symbol[31:12]
addi rd, rd, symbol[11:0]
This issue is to raise the question of whether the compliance tests should use pseudo instructions at all. RISC-V is perhaps unusual in having quite so many pseudo instructions (I think there are 47 at present). As issue #105<#105> shows, not all are reliably implemented. In part they are a legacy of the attempt to bring up a compiler tool chain very quickly nearly a decade ago.
Pseudo instructions are inherently opaque, and can potentially change (for example choice of insturction for nop), although this seems less likely for RISC-V, since they form part of the standard.
As we discussed in the early days of the compliance standard, having to use an assembler at all is already a compromise. We are testing compliance of implementations of the architecture, not compliance of the assembler, and as we see this is an area where assemblers differ.
I propose that the compliance test suite should use no pseudo instructions and stick strictly to plain assembler opcodes.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub<#106>, or unsubscribe<https://github.com/notifications/unsubscribe-auth/AA3V7ZFM4VO6IGMLMVJXJILRN2UM5ANCNFSM4MN6X2WQ>.
|
@simon5656 why use assembler mnemonics at all? Why use a linker? Why not just emit binary code directly? (The linker remark is not just a flippant comment; it also deletes instructions and replaces some instructions with others, kind of like the thing you're expressing concern over.) |
I would tend to agree. It is one thing to insist that the assembler not
optimize code (e.g. replace an op with a compressed version, or optimize
away completely if the arguments make it a noop).
But most of the uses are benign: e.g. "j label" vs "jal x0, label".
The specific "la" case is usually pretty harmless as long as the assembler
doesn't optimize away either of the two ops that make it up (and we stick
to the standards).
I'm a bit more concerned if the offset is >32 bits (in RVV64; It can even
happen in RV32 with 34b physical addressing ) - I'm not sure if it tries to
do a load from a constant table, or just fails.
…On Wed, Apr 22, 2020 at 1:46 AM Andrew Waterman ***@***.***> wrote:
This issue is to raise the question of whether the compliance tests should
use pseudo instructions at all.
IMO, this is only one step away from suggesting the compliance tests
shouldn't rely on the assembler at all, and should instead rewrite its own.
Inconsistencies in the documentation and implementation of
pseudoinstructions should be rectified, but that's a bad reason to stop
using them.
—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
<#106 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AHPXVJXBYZ6VCGA52FI5EVDRN2VHFANCNFSM4MN6X2WQ>
.
|
FWIW, the linker can, and will, optimize away some of those addressing
instructions. But that behavior can be suppressed with the —no-relax flag.
On Wed, Apr 22, 2020 at 11:58 AM Allen Baum <notifications@github.com>
wrote:
… I would tend to agree. It is one thing to insist that the assembler not
optimize code (e.g. replace an op with a compressed version, or optimize
away completely if the arguments make it a noop).
But most of the uses are benign: e.g. "j label" vs "jal x0, label".
The specific "la" case is usually pretty harmless as long as the assembler
doesn't optimize away either of the two ops that make it up (and we stick
to the standards).
I'm a bit more concerned if the offset is >32 bits (in RVV64; It can even
happen in RV32 with 34b physical addressing ) - I'm not sure if it tries to
do a load from a constant table, or just fails.
On Wed, Apr 22, 2020 at 1:46 AM Andrew Waterman ***@***.***>
wrote:
> This issue is to raise the question of whether the compliance tests
should
> use pseudo instructions at all.
>
> IMO, this is only one step away from suggesting the compliance tests
> shouldn't rely on the assembler at all, and should instead rewrite its
own.
>
> Inconsistencies in the documentation and implementation of
> pseudoinstructions should be rectified, but that's a bad reason to stop
> using them.
>
> —
> You are receiving this because you are subscribed to this thread.
> Reply to this email directly, view it on GitHub
> <
#106 (comment)
>,
> or unsubscribe
> <
https://github.com/notifications/unsubscribe-auth/AHPXVJXBYZ6VCGA52FI5EVDRN2VHFANCNFSM4MN6X2WQ
>
> .
>
—
You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
<#106 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAH3XQW3B3RS6J5D6WZCNVDRN4453ANCNFSM4MN6X2WQ>
.
|
I actually don't know that how practical it is to remove LA or LI specifically. If we were doing that, I'd
|
I think the decision has been made to do precisely what is proposed above (except for the name of the LAX/LIX macros, perhaps). This will be reflected in the next merge of new tests, and a change to the test format spec. |
Do |
The prohibition of pseudo instruction in tests is intended to be in just the code in actual .S assembly language tests themselves, and not in supporting code, or directives - if that answers the question. The rationale for this is that if different toolchains generate different expansions, it may mess up how things get loaded between models - and then we've lost PC relative synch points we are depending on. The fear may be an overreaction, but - it wasn't that hard to do. |
The current tests (and not any initialization or trap handling code - just the .S files in the riscv-test-suite/RV32* and /RV64* directories now use constant length LI and LA macros to replace li and la pseudo ops, so closing this one. |
This patch improves compatibility with GNU assembler by adding support for constant immediate in la and lla pseudo instruction, and expanding it in the same way as we currently expands li pseudo instruction. Links to discussion related to the above issue in the community - riscv-non-isa/riscv-arch-test#105 riscv-non-isa/riscv-arch-test#108 riscv-non-isa/riscv-arch-test#106 Reviewed By: craig.topper Differential Revision: https://reviews.llvm.org/D150133
This is a discussion point - I am not clear what the correct answer is.
In issue #105, I note that the regression tests use one of the assembler pseudo instructions,
la
, in a non-standard way.is a shorthand for
This issue is to raise the question of whether the compliance tests should use pseudo instructions at all. RISC-V is perhaps unusual in having quite so many pseudo instructions (I think there are 47 at present). As issue #105 shows, not all are reliably implemented. In part they are a legacy of the attempt to bring up a compiler tool chain very quickly nearly a decade ago.
Pseudo instructions are inherently opaque, and can potentially change (for example choice of insturction for
nop
), although this seems less likely for RISC-V, since they form part of the standard.As we discussed in the early days of the compliance standard, having to use an assembler at all is already a compromise. We are testing compliance of implementations of the architecture, not compliance of the assembler, and as we see this is an area where assemblers differ.
I propose that the compliance test suite should use no pseudo instructions and stick strictly to plain assembler opcodes.
The text was updated successfully, but these errors were encountered: