[PATCH 0/1] RISC-V: Add 'Zicntr' and 'Zihpm' support with compatibility measures
Tsukasa OI
research_trasio@irq.a4lg.com
Sat Oct 21 00:45:58 GMT 2023
Hi,
This patch adds support for two extensions, split from the RISC-V
Unprivileged ISA version 2.2:
1. `Zicntr`
Basic hardware performance counters
2. `Zihpm`
Platform-specific configurable hardware performance counters
but the compatibility is vital. This patch set tries to deal with the
compatibility issues as possible.
RFC PATCH v1:
<https://sourceware.org/pipermail/binutils/2023-August/128895.html>
Unlike RFC PATCH v1, this (PATCH v1) tries to resolve most of compatibility
issues by following concepts:
1. Implement 'Zicntr' and 'Zihpm' as in the latest RISC-V ISA Manual
documentation (draft) except...
2. even if a 'Zicntr' pseudoinstruction is used without that extension,
generate a warning instead of an error.
This is much simpler than before (though increases differences in tests)
and almost completely ISA specification agnostic. I hope this patch
resolves most of concerns raised by Nelson.
The hardest part was to move handling of *the ISA version 2.2* to
*the 'I' extension version 2.0 (or less)*. If the 'I' extension version is
2.0 or less and its subset (e.g. 'Zicsr' or 'Zicntr') is being added, it
disables inferring the default version number. If the ISA is either RV32E
or RV64E and 'I' 2.0 subsets (but 'I' itself) are explicitly specified, the
default handling is the same as 'I' >= 2.1 because non-draft 'E' extension
does not have 'I' 2.0 subsets.
Thanks,
Tsukasa
Tsukasa OI (1):
RISC-V: Add 'Zicntr' and 'Zihpm' support with compatibility measures
bfd/elfxx-riscv.c | 52 +++-
gas/config/tc-riscv.c | 25 ++
.../gas/riscv/csr-insns-pseudo-noalias.d | 2 +-
.../gas/riscv/csr-insns-pseudo-nozicntr.d | 37 +++
.../gas/riscv/csr-insns-pseudo-nozicntr.l | 7 +
.../gas/riscv/csr-insns-pseudo-zfinx.d | 2 +-
gas/testsuite/gas/riscv/csr-insns-pseudo.d | 2 +-
gas/testsuite/gas/riscv/csr-insns-pseudo.s | 3 +-
gas/testsuite/gas/riscv/csr-insns-read-only.d | 2 +-
gas/testsuite/gas/riscv/csr-version-1p10.l | 256 ++++++++++++++++++
gas/testsuite/gas/riscv/csr-version-1p11.l | 256 ++++++++++++++++++
gas/testsuite/gas/riscv/csr-version-1p12.l | 256 ++++++++++++++++++
gas/testsuite/gas/riscv/csr-version-1p9p1.l | 256 ++++++++++++++++++
include/opcode/riscv-opc.h | 128 ++++-----
include/opcode/riscv.h | 1 +
opcodes/riscv-opc.c | 12 +-
16 files changed, 1217 insertions(+), 80 deletions(-)
create mode 100644 gas/testsuite/gas/riscv/csr-insns-pseudo-nozicntr.d
create mode 100644 gas/testsuite/gas/riscv/csr-insns-pseudo-nozicntr.l
base-commit: 4a6daabb94982ccc17ea45ebb6f6e8efa8f86399
--
2.42.0
More information about the Binutils
mailing list