-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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 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.
- Loading branch information
Showing
22 changed files
with
1,224 additions
and
87 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
#source: csr-insns-pseudo.s | ||
#as: -march=rv32i2p1_f2p2 | ||
#warning_output: csr-insns-pseudo-nozicntr.l | ||
#objdump: -dr | ||
|
||
.*:[ ]+file format .* | ||
|
||
|
||
Disassembly of section .text: | ||
|
||
0+000 <pseudo_csr_insn>: | ||
[ ]+[0-9a-f]+:[ ]+000022f3[ ]+csrr[ ]+t0,ust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]+fsflags[ ]+t0,t1 | ||
[ ]+[0-9a-f]+:[ ]+00131073[ ]+fsflags[ ]+t1 | ||
[ ]+[0-9a-f]+:[ ]+001fd2f3[ ]+fsflagsi[ ]+t0,31 | ||
[ ]+[0-9a-f]+:[ ]+001fd073[ ]+fsflagsi[ ]+zero,31 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
.*Assembler messages: | ||
.*Warning: `rdcycle' needs `zicntr' extension | ||
.*Warning: `rdtime' needs `zicntr' extension | ||
.*Warning: `rdinstret' needs `zicntr' extension | ||
.*Warning: `rdcycleh' needs `zicntr' extension | ||
.*Warning: `rdtimeh' needs `zicntr' extension | ||
.*Warning: `rdinstreth' needs `zicntr' extension |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
#source: csr-insns-pseudo.s | ||
#as: -march=rv32if | ||
#as: -march=rv32if_zicntr | ||
#objdump: -dr | ||
|
||
.*:[ ]+file format .* | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,3 @@ | ||
#as: -march=rv32if -mcsr-check -mpriv-spec=1.11 | ||
#as: -march=rv32if_zicntr -mcsr-check -mpriv-spec=1.11 | ||
#source: csr-insns-read-only.s | ||
#warning_output: csr-insns-read-only.l |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.