You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
RISC-V: Add 'Zicntr' and 'Zihpm' support with compatibility measures
This commit adds support for 'Zicntr' and 'Zihpm' extensions (version 2.0).
However, because GNU Binutils handled those as a part of 'I' and there was
a time when a ratified specification did split counters from the 'I'
extension without separate extension names, we need to take care of
possible compatibility issues.
So, if 'Zicntr' pseudoinstructions are used without that extension,
it generates not an error but a warning.
bfd/ChangeLog:
* elfxx-riscv.c (riscv_implicit_subsets): Add implications related
to counter extensions.
(riscv_supported_std_z_ext): Add 'Zicntr' and 'Zihpm' extensions.
Define default versions of 'Zicsr' and 'Zifencei' on the draft ISA
because they might be used on the 'E' extension handling.
(riscv_is_subset_of_i_2p0): New function.
(riscv_parse_add_subset): If a subset of the 'I' extension version
2.0 is being added, check the version of 'I' and allow its version
unknown when the 'I' extension version is less than 2.1.
(riscv_multi_subset_supports, riscv_multi_subset_supports_ext):
Add support for the 'Zicntr' extension with compatibility measure.
gas/ChangeLog:
* config/tc-riscv.c (enum riscv_csr_class): Add new CSR classes
corresponding 'Zicntr' and 'Zihpm' extensions.
(riscv_csr_address): Add handling for new CSR classes.
(riscv_ip): Raise a warning if a 'Zicntr' pseudoinstruction is
used without that extension.
* testsuite/gas/riscv/csr-insns-pseudo.s: Rename section names
to indicate that the extension 'Zicntr' is needed.
* testsuite/gas/riscv/csr-insns-pseudo.d: Add "zicntr" to arch.
* testsuite/gas/riscv/csr-insns-pseudo-noalias.d: Likewise.
* testsuite/gas/riscv/csr-insns-pseudo-zfinx.d: Likewise.
* testsuite/gas/riscv/csr-insns-read-only.d: Likewise.
* testsuite/gas/riscv/csr-version-1p9p1.l: Add warnings regarding
'Zicntr' and 'Zihpm' extension recategorization.
* testsuite/gas/riscv/csr-version-1p10.l: Likewise.
* testsuite/gas/riscv/csr-version-1p11.l: Likewise.
* testsuite/gas/riscv/csr-version-1p12.l: Likewise.
* testsuite/gas/riscv/csr-insns-pseudo-nozicntr.d: New test to
see warnings are generated when the 'Zicntr' extension is not
specified.
* testsuite/gas/riscv/csr-insns-pseudo-nozicntr.l: Likewise.
include/ChangeLog:
* opcode/riscv-opc.h: Recategorize user counter CSRs.
* opcode/riscv.h (enum riscv_insn_class): Add INSN_CLASS_ZICNTR
for 'Zicntr' pseudoinstructions.
opcodes/ChangeLog:
* riscv-opc.c (riscv_opcodes): Recategorize counter
pseudoinstructions to the 'Zicntr' extension.
0 commit comments