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.
To preserve maximum compatibility, this commit implements as follows:
* For RISC-V ISA version 20191213 or less (all current non-draft ones),
imply counter extensions from 'I' and DO NOT imply the 'Zicsr' extension
from counter extensions. We also suppress outputting the existence of
counter extensions unless the version number is explicitly specified.
* For future ratified ISAs, leave two options (each require minor edits):
* Continue previous behaviors or
* DO NOT imply counter extensions from 'I'. DO imply the 'Zicsr'
extension from counter extensions. DO NOT suppress outputting the
existence of such counter extensions by having a known
version number (version 2.0 or [though unlikely] later).
Make small changes to the disassembler to keep compatibility when
disassembling old files.
bfd/ChangeLog:
* elfxx-riscv.c (check_implicit_compat_counter_from_i): New function
for counter compatibility from 'I' to counter extensions.
(check_implicit_compat_counter_to_zicsr): New function for counter
compatibility from counter extensions to the 'Zicsr' extension.
(riscv_implicit_subsets): Add implications related to counter
extensions with compatibility measures.
(riscv_supported_std_z_ext): Add 'Zicntr' and 'Zihpm' extensions.
But make version "unknown" to suppress outputting implicit
dependencies on older ISAs.
(riscv_parse_add_subset): Add "zicntr" and "zihpm" to exceptions
to recognize on older ISAs if there's no version number.
(riscv_multi_subset_supports): Add support for 'Zicntr'.
(riscv_multi_subset_supports_ext): Likewise.
gas/ChangeLog:
* config/tc-riscv.c (enum riscv_csr_class): Add CSR classes for
'Zicntr' and 'Zihpm' extensions.
(riscv_csr_address): Add handling for new CSR classes.
* testsuite/gas/riscv/march-imply-i.s: Add 'Zicntr' instructions.
include/ChangeLog:
* opcode/riscv-opc.h: Change CSR classes for 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