[v2,0/1] RISC-V: Add 'Zicntr' and 'Zihpm' support with compatibility measures

Message ID cover.1697854636.git.research_trasio@irq.a4lg.com
Headers
Series RISC-V: Add 'Zicntr' and 'Zihpm' support with compatibility measures |

Message

Tsukasa OI Oct. 21, 2023, 2:17 a.m. UTC
  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>
PATCH v1 (the implementation is detailed in this cover letter):
<https://sourceware.org/pipermail/binutils/2023-October/130091.html>


PATCH v2 fixes some test failures when compiled with -with-isa-spec=2.2
just like Nelson found some test failures and fixed in the commit
4352c0ac04a6 ("RISC-V: Make sure rv32q conflict won't affect the zfa gas
testcases.").

csr-insns-pseudo-nozicntr.d
    Specified the extension version (without any -misa-spec option)
    to make sure that we test "no subset" behavior on 'I' >= version 2.1.
csr-version-{1p9p1,1p10,1p11,1p12}.d
    Specified the extension versions to make sure that
    we are working on the 'I' >= version 2.1 (also specified the version of
    'Zicsr' but this is only for consistency).
march-imply-i2p0-01.d
    'I' version 2.0 effectively imples 'Zicsr' and 'Zifencei' but should not
    be reflected to the expanded architectural string because features of
    'Zicsr' and 'Zifencei' are parts of 'I' version 2.0.
    This change make sures that we removed the dependency to -misa-spec
    option and the behavior only depends on the version of 'I'
    (despite that -misa-spec=20191213).
march-ok-reorder.d
    Use 'I' version 2.1.  To test ordering of 'Zi*' extensions, PATCH v2
    specifies "zifencei_zicsr" (intentionally reverse of the canonical
    order) to make sure that the expanded architectural string has
    "zicsr2p0_zifencei2p0".

It also fixes a minor grammar error on the commit message.


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.d    |   2 +-
 gas/testsuite/gas/riscv/csr-version-1p10.l    | 256 ++++++++++++++++++
 gas/testsuite/gas/riscv/csr-version-1p11.d    |   2 +-
 gas/testsuite/gas/riscv/csr-version-1p11.l    | 256 ++++++++++++++++++
 gas/testsuite/gas/riscv/csr-version-1p12.d    |   2 +-
 gas/testsuite/gas/riscv/csr-version-1p12.l    | 256 ++++++++++++++++++
 gas/testsuite/gas/riscv/csr-version-1p9p1.d   |   2 +-
 gas/testsuite/gas/riscv/csr-version-1p9p1.l   | 256 ++++++++++++++++++
 gas/testsuite/gas/riscv/march-imply-i2p0-01.d |   2 +-
 gas/testsuite/gas/riscv/march-ok-reorder.d    |   4 +-
 include/opcode/riscv-opc.h                    | 128 ++++-----
 include/opcode/riscv.h                        |   1 +
 opcodes/riscv-opc.c                           |  12 +-
 22 files changed, 1224 insertions(+), 87 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: 0e17d3fc080f543d81e6c2520ba0bd8046ea3a95