Skip to content
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

Extension: Zicntr and Zihpm #102

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

Extension: Zicntr and Zihpm #102

wants to merge 1 commit into from

Conversation

a4lg
Copy link
Owner

@a4lg a4lg commented Feb 7, 2023

@a4lg a4lg added the enhancement New feature or request label Feb 7, 2023
@a4lg a4lg force-pushed the riscv-zicntr-zihpm branch 2 times, most recently from d1cb1d2 to 2d36a44 Compare February 8, 2023 05:34
@a4lg a4lg force-pushed the riscv-zicntr-zihpm branch from 2d36a44 to bd7ed9f Compare February 15, 2023 04:34
@a4lg a4lg force-pushed the riscv-zicntr-zihpm branch from bd7ed9f to c3acf0e Compare March 1, 2023 10:46
@a4lg a4lg force-pushed the riscv-zicntr-zihpm branch from c3acf0e to bf0b50a Compare March 16, 2023 03:02
@a4lg a4lg force-pushed the riscv-zicntr-zihpm branch 5 times, most recently from 88a6a2a to 93a4727 Compare August 3, 2023 05:59
@a4lg a4lg force-pushed the riscv-zicntr-zihpm branch 8 times, most recently from 49246e0 to cc271b4 Compare August 11, 2023 03:56
@a4lg a4lg force-pushed the riscv-zicntr-zihpm branch from cc271b4 to 11d9ed4 Compare August 15, 2023 06:37
@a4lg a4lg force-pushed the riscv-zicntr-zihpm branch from 11d9ed4 to 94c835e Compare August 15, 2023 07:27
@a4lg a4lg force-pushed the riscv-zicntr-zihpm branch 4 times, most recently from 75c034c to ae50984 Compare September 7, 2023 09:35
@a4lg a4lg force-pushed the riscv-zicntr-zihpm branch 4 times, most recently from 1ae2bb7 to f3c2a5c Compare October 19, 2023 07:01
@a4lg a4lg force-pushed the riscv-zicntr-zihpm branch 2 times, most recently from 10fe8f9 to 872554c Compare October 21, 2023 00:44
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 a 'Zicntr' pseudoinstruction is 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.d: Specify versions.
	* testsuite/gas/riscv/csr-version-1p10.d: Likewise.
	* testsuite/gas/riscv/csr-version-1p11.d: Likewise.
	* testsuite/gas/riscv/csr-version-1p12.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/march-imply-i2p0-01.d: 'I' version 2.0
	effectively imples 'Zicsr' and 'Zifencei' but should not be
	reflected to the expanded architectural string.
	* testsuite/gas/riscv/march-ok-reorder.d: Use 'I' version 2.1 and
	use other extensions to test proper ordering.
	* 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.
@a4lg a4lg force-pushed the riscv-zicntr-zihpm branch from 872554c to a155952 Compare October 21, 2023 03:44
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant