aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorTsukasa OI <research_trasio@irq.a4lg.com>2023-09-03 02:13:14 +0000
committerTsukasa OI <research_trasio@irq.a4lg.com>2023-09-05 03:09:30 +0000
commita303646f1754f9c6178448bedc6100d871f118c0 (patch)
tree160adbf2f71034908931dac1acc0eaa3fe6cf48b /gas
parent9294a13008b0c048c83a880bce9469bccec14d36 (diff)
downloadbinutils-a303646f1754f9c6178448bedc6100d871f118c0.zip
binutils-a303646f1754f9c6178448bedc6100d871f118c0.tar.gz
binutils-a303646f1754f9c6178448bedc6100d871f118c0.tar.bz2
RISC-V: Add 'Smcntrpmf' extension and its CSRs
This commit adds now stable and approved 'Smcntrpmf' extension defined by the RISC-V Cycle and Instret Privilege Mode Filtering specification. Note that, because mcyclecfg and minstretcfg CSRs conflict with the privileged specification version 1.9.1, CSRs for this extension are only enabled on the privileged specification version 1.10 or later. By checking the base privileged specification, we no longer need to change the design of base CSR handling. This is based on the specification version v1.0_rc1 (Frozen): <https://github.com/riscv/riscv-smcntrpmf/commit/32b752c40d59c1b5e95de83399c1f54be6669163> bfd/ChangeLog: * elfxx-riscv.c (riscv_implicit_subsets): Add implication rule from the new 'Smcntrpmf' extension. (riscv_supported_std_s_ext): Add 'Smcntrpmf' to the supported S extension list. gas/ChangeLog: * config/tc-riscv.c (enum riscv_csr_class): Add new CSR classes CSR_CLASS_SMCNTRPMF and CSR_CLASS_SMCNTRPMF_32. (riscv_csr_address): Add handling for new CSR classes. * testsuite/gas/riscv/csr-dw-regnums.s: Add new CSRs. Move "mscounteren" and "mhcounteren" CSRs and note that they are now aliases. * testsuite/gas/riscv/csr-dw-regnums.d: Reflect the change. * testsuite/gas/riscv/csr.s: Add new CSRs. Move "mscounteren" and "mhcounteren" CSRs and note that they are now reused for the 'Smcntrpmf' extension. * testsuite/gas/riscv/csr-version-1p9p1.d: Reflect the changes of csr.s. * testsuite/gas/riscv/csr-version-1p9p1.l: Likewise. * testsuite/gas/riscv/csr-version-1p10.d: Likewise. * testsuite/gas/riscv/csr-version-1p10.l: Likewise. * testsuite/gas/riscv/csr-version-1p11.d: Likewise. * testsuite/gas/riscv/csr-version-1p11.l: Likewise. * testsuite/gas/riscv/csr-version-1p12.d: Likewise. * testsuite/gas/riscv/csr-version-1p12.l: Likewise. include/ChangeLog: * opcode/riscv-opc.h: Add new CSRs noting that this extension is incompatible with the privileged specification version 1.9.1. Move "mscounteren" and "mhcounteren" CSRs, make them aliases and reuse the CSR numbers from the 'Smcntrpmf' extension. (CSR_MSCOUNTEREN, CSR_MHCOUNTEREN) Remove as "mscounteren" and "mhcounteren" are now aliases and new CSR macros are used instead. (CSR_MCYCLECFG, CSR_MINSTRETCFG, CSR_MCYCLECFGH, CSR_MINSTRETCFGH): New CSR macros.
Diffstat (limited to 'gas')
-rw-r--r--gas/config/tc-riscv.c9
-rw-r--r--gas/testsuite/gas/riscv/csr-dw-regnums.d8
-rw-r--r--gas/testsuite/gas/riscv/csr-dw-regnums.s9
-rw-r--r--gas/testsuite/gas/riscv/csr-version-1p10.d16
-rw-r--r--gas/testsuite/gas/riscv/csr-version-1p10.l40
-rw-r--r--gas/testsuite/gas/riscv/csr-version-1p11.d16
-rw-r--r--gas/testsuite/gas/riscv/csr-version-1p11.l40
-rw-r--r--gas/testsuite/gas/riscv/csr-version-1p12.d16
-rw-r--r--gas/testsuite/gas/riscv/csr-version-1p12.l40
-rw-r--r--gas/testsuite/gas/riscv/csr-version-1p9p1.d16
-rw-r--r--gas/testsuite/gas/riscv/csr-version-1p9p1.l40
-rw-r--r--gas/testsuite/gas/riscv/csr.s10
12 files changed, 214 insertions, 46 deletions
diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
index e49b34f..8c67623 100644
--- a/gas/config/tc-riscv.c
+++ b/gas/config/tc-riscv.c
@@ -74,6 +74,8 @@ enum riscv_csr_class
CSR_CLASS_H_32, /* hypervisor, rv32 only */
CSR_CLASS_SMAIA, /* Smaia */
CSR_CLASS_SMAIA_32, /* Smaia, rv32 only */
+ CSR_CLASS_SMCNTRPMF, /* Smcntrpmf */
+ CSR_CLASS_SMCNTRPMF_32, /* Smcntrpmf, rv32 only */
CSR_CLASS_SMSTATEEN, /* Smstateen only */
CSR_CLASS_SMSTATEEN_32, /* Smstateen RV32 only */
CSR_CLASS_SSAIA, /* Ssaia */
@@ -1052,6 +1054,13 @@ riscv_csr_address (const char *csr_name,
case CSR_CLASS_SMAIA:
extension = "smaia";
break;
+ case CSR_CLASS_SMCNTRPMF_32:
+ is_rv32_only = true;
+ /* Fall through. */
+ case CSR_CLASS_SMCNTRPMF:
+ need_check_version = true;
+ extension = "smcntrpmf";
+ break;
case CSR_CLASS_SMSTATEEN_32:
is_rv32_only = true;
/* Fall through. */
diff --git a/gas/testsuite/gas/riscv/csr-dw-regnums.d b/gas/testsuite/gas/riscv/csr-dw-regnums.d
index fd83066..cabb7c7 100644
--- a/gas/testsuite/gas/riscv/csr-dw-regnums.d
+++ b/gas/testsuite/gas/riscv/csr-dw-regnums.d
@@ -324,6 +324,10 @@ Contents of the .* section:
DW_CFA_offset_extended_sf: r4888 \(mvienh\) at cfa\+3168
DW_CFA_offset_extended_sf: r4889 \(mviph\) at cfa\+3172
DW_CFA_offset_extended_sf: r4948 \(miph\) at cfa\+3408
+ DW_CFA_offset_extended_sf: r4897 \(mcyclecfg\) at cfa\+3204
+ DW_CFA_offset_extended_sf: r4898 \(minstretcfg\) at cfa\+3208
+ DW_CFA_offset_extended_sf: r5921 \(mcyclecfgh\) at cfa\+7300
+ DW_CFA_offset_extended_sf: r5922 \(minstretcfgh\) at cfa\+7304
DW_CFA_offset_extended_sf: r4876 \(mstateen0\) at cfa\+3120
DW_CFA_offset_extended_sf: r4877 \(mstateen1\) at cfa\+3124
DW_CFA_offset_extended_sf: r4878 \(mstateen2\) at cfa\+3128
@@ -404,14 +408,14 @@ Contents of the .* section:
DW_CFA_offset_extended_sf: r4480 \(satp\) at cfa\+1536
DW_CFA_offset_extended_sf: r4931 \(mtval\) at cfa\+3340
DW_CFA_offset_extended_sf: r4896 \(mcountinhibit\) at cfa\+3200
+ DW_CFA_offset_extended_sf: r4897 \(mcyclecfg\) at cfa\+3204
+ DW_CFA_offset_extended_sf: r4898 \(minstretcfg\) at cfa\+3208
DW_CFA_offset_extended_sf: r4992 \(mbase\) at cfa\+3584
DW_CFA_offset_extended_sf: r4993 \(mbound\) at cfa\+3588
DW_CFA_offset_extended_sf: r4994 \(mibase\) at cfa\+3592
DW_CFA_offset_extended_sf: r4995 \(mibound\) at cfa\+3596
DW_CFA_offset_extended_sf: r4996 \(mdbase\) at cfa\+3600
DW_CFA_offset_extended_sf: r4997 \(mdbound\) at cfa\+3604
- DW_CFA_offset_extended_sf: r4897 \(mscounteren\) at cfa\+3204
- DW_CFA_offset_extended_sf: r4898 \(mhcounteren\) at cfa\+3208
DW_CFA_offset_extended: r4096 \(ustatus\) at cfa\+0
DW_CFA_offset_extended_sf: r4100 \(uie\) at cfa\+16
DW_CFA_offset_extended_sf: r4101 \(utvec\) at cfa\+20
diff --git a/gas/testsuite/gas/riscv/csr-dw-regnums.s b/gas/testsuite/gas/riscv/csr-dw-regnums.s
index b8b0f79..428d077 100644
--- a/gas/testsuite/gas/riscv/csr-dw-regnums.s
+++ b/gas/testsuite/gas/riscv/csr-dw-regnums.s
@@ -321,6 +321,11 @@ _start:
.cfi_offset mvienh, 3168
.cfi_offset mviph, 3172
.cfi_offset miph, 3408
+ # Smcntrpmf extension
+ .cfi_offset mcyclecfg, 3204
+ .cfi_offset minstretcfg, 3208
+ .cfi_offset mcyclecfgh, 7300
+ .cfi_offset minstretcfgh, 7304
# Smstateen extension
.cfi_offset mstateen0, 3120
.cfi_offset mstateen1, 3124
@@ -406,14 +411,14 @@ _start:
.cfi_offset sptbr, 1536 # aliases
.cfi_offset mbadaddr, 3340 # aliases
.cfi_offset mucounteren, 3200 # aliases
+ .cfi_offset mscounteren, 3204 # aliases
+ .cfi_offset mhcounteren, 3208 # aliases
.cfi_offset mbase, 3584
.cfi_offset mbound, 3588
.cfi_offset mibase, 3592
.cfi_offset mibound, 3596
.cfi_offset mdbase, 3600
.cfi_offset mdbound, 3604
- .cfi_offset mscounteren, 3204
- .cfi_offset mhcounteren, 3208
.cfi_offset ustatus, 0
.cfi_offset uie, 16
.cfi_offset utvec, 20
diff --git a/gas/testsuite/gas/riscv/csr-version-1p10.d b/gas/testsuite/gas/riscv/csr-version-1p10.d
index ee41e10..dbdc077 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p10.d
+++ b/gas/testsuite/gas/riscv/csr-version-1p10.d
@@ -623,6 +623,14 @@ Disassembly of section .text:
[ ]+[0-9a-f]+:[ ]+31959073[ ]+csrw[ ]+mviph,a1
[ ]+[0-9a-f]+:[ ]+35402573[ ]+csrr[ ]+a0,miph
[ ]+[0-9a-f]+:[ ]+35459073[ ]+csrw[ ]+miph,a1
+[ ]+[0-9a-f]+:[ ]+32102573[ ]+csrr[ ]+a0,mcyclecfg
+[ ]+[0-9a-f]+:[ ]+32159073[ ]+csrw[ ]+mcyclecfg,a1
+[ ]+[0-9a-f]+:[ ]+32202573[ ]+csrr[ ]+a0,minstretcfg
+[ ]+[0-9a-f]+:[ ]+32259073[ ]+csrw[ ]+minstretcfg,a1
+[ ]+[0-9a-f]+:[ ]+72102573[ ]+csrr[ ]+a0,mcyclecfgh
+[ ]+[0-9a-f]+:[ ]+72159073[ ]+csrw[ ]+mcyclecfgh,a1
+[ ]+[0-9a-f]+:[ ]+72202573[ ]+csrr[ ]+a0,minstretcfgh
+[ ]+[0-9a-f]+:[ ]+72259073[ ]+csrw[ ]+minstretcfgh,a1
[ ]+[0-9a-f]+:[ ]+30c02573[ ]+csrr[ ]+a0,mstateen0
[ ]+[0-9a-f]+:[ ]+30c59073[ ]+csrw[ ]+mstateen0,a1
[ ]+[0-9a-f]+:[ ]+30d02573[ ]+csrr[ ]+a0,mstateen1
@@ -783,6 +791,10 @@ Disassembly of section .text:
[ ]+[0-9a-f]+:[ ]+34359073[ ]+csrw[ ]+mtval,a1
[ ]+[0-9a-f]+:[ ]+32002573[ ]+csrr[ ]+a0,0x320
[ ]+[0-9a-f]+:[ ]+32059073[ ]+csrw[ ]+0x320,a1
+[ ]+[0-9a-f]+:[ ]+32102573[ ]+csrr[ ]+a0,mcyclecfg
+[ ]+[0-9a-f]+:[ ]+32159073[ ]+csrw[ ]+mcyclecfg,a1
+[ ]+[0-9a-f]+:[ ]+32202573[ ]+csrr[ ]+a0,minstretcfg
+[ ]+[0-9a-f]+:[ ]+32259073[ ]+csrw[ ]+minstretcfg,a1
[ ]+[0-9a-f]+:[ ]+38002573[ ]+csrr[ ]+a0,0x380
[ ]+[0-9a-f]+:[ ]+38059073[ ]+csrw[ ]+0x380,a1
[ ]+[0-9a-f]+:[ ]+38102573[ ]+csrr[ ]+a0,0x381
@@ -795,10 +807,6 @@ Disassembly of section .text:
[ ]+[0-9a-f]+:[ ]+38459073[ ]+csrw[ ]+0x384,a1
[ ]+[0-9a-f]+:[ ]+38502573[ ]+csrr[ ]+a0,0x385
[ ]+[0-9a-f]+:[ ]+38559073[ ]+csrw[ ]+0x385,a1
-[ ]+[0-9a-f]+:[ ]+32102573[ ]+csrr[ ]+a0,0x321
-[ ]+[0-9a-f]+:[ ]+32159073[ ]+csrw[ ]+0x321,a1
-[ ]+[0-9a-f]+:[ ]+32202573[ ]+csrr[ ]+a0,0x322
-[ ]+[0-9a-f]+:[ ]+32259073[ ]+csrw[ ]+0x322,a1
[ ]+[0-9a-f]+:[ ]+00002573[ ]+csrr[ ]+a0,ustatus
[ ]+[0-9a-f]+:[ ]+00059073[ ]+csrw[ ]+ustatus,a1
[ ]+[0-9a-f]+:[ ]+00402573[ ]+csrr[ ]+a0,uie
diff --git a/gas/testsuite/gas/riscv/csr-version-1p10.l b/gas/testsuite/gas/riscv/csr-version-1p10.l
index 27bdc80..054179a 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p10.l
+++ b/gas/testsuite/gas/riscv/csr-version-1p10.l
@@ -889,6 +889,30 @@
.*Info: macro .*
.*Warning: invalid CSR `miph', needs `smaia' extension
.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs `smcntrpmf' extension
+.*Info: macro .*
.*Warning: invalid CSR `mstateen0', needs `smstateen' extension
.*Info: macro .*
.*Warning: invalid CSR `mstateen0', needs `smstateen' extension
@@ -1507,6 +1531,14 @@
.*Info: macro .*
.*Warning: invalid CSR `mucounteren' for the privileged spec `1.10'
.*Info: macro .*
+.*Warning: invalid CSR `mscounteren' for the privileged spec `1.10'
+.*Info: macro .*
+.*Warning: invalid CSR `mscounteren' for the privileged spec `1.10'
+.*Info: macro .*
+.*Warning: invalid CSR `mhcounteren' for the privileged spec `1.10'
+.*Info: macro .*
+.*Warning: invalid CSR `mhcounteren' for the privileged spec `1.10'
+.*Info: macro .*
.*Warning: invalid CSR `mbase' for the privileged spec `1.10'
.*Info: macro .*
.*Warning: invalid CSR `mbase' for the privileged spec `1.10'
@@ -1531,14 +1563,6 @@
.*Info: macro .*
.*Warning: invalid CSR `mdbound' for the privileged spec `1.10'
.*Info: macro .*
-.*Warning: invalid CSR `mscounteren' for the privileged spec `1.10'
-.*Info: macro .*
-.*Warning: invalid CSR `mscounteren' for the privileged spec `1.10'
-.*Info: macro .*
-.*Warning: invalid CSR `mhcounteren' for the privileged spec `1.10'
-.*Info: macro .*
-.*Warning: invalid CSR `mhcounteren' for the privileged spec `1.10'
-.*Info: macro .*
.*Warning: invalid CSR `fflags', needs `f' extension
.*Info: macro .*
.*Warning: invalid CSR `fflags', needs `f' extension
diff --git a/gas/testsuite/gas/riscv/csr-version-1p11.d b/gas/testsuite/gas/riscv/csr-version-1p11.d
index a83b1bf..7ba88b6 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p11.d
+++ b/gas/testsuite/gas/riscv/csr-version-1p11.d
@@ -623,6 +623,14 @@ Disassembly of section .text:
[ ]+[0-9a-f]+:[ ]+31959073[ ]+csrw[ ]+mviph,a1
[ ]+[0-9a-f]+:[ ]+35402573[ ]+csrr[ ]+a0,miph
[ ]+[0-9a-f]+:[ ]+35459073[ ]+csrw[ ]+miph,a1
+[ ]+[0-9a-f]+:[ ]+32102573[ ]+csrr[ ]+a0,mcyclecfg
+[ ]+[0-9a-f]+:[ ]+32159073[ ]+csrw[ ]+mcyclecfg,a1
+[ ]+[0-9a-f]+:[ ]+32202573[ ]+csrr[ ]+a0,minstretcfg
+[ ]+[0-9a-f]+:[ ]+32259073[ ]+csrw[ ]+minstretcfg,a1
+[ ]+[0-9a-f]+:[ ]+72102573[ ]+csrr[ ]+a0,mcyclecfgh
+[ ]+[0-9a-f]+:[ ]+72159073[ ]+csrw[ ]+mcyclecfgh,a1
+[ ]+[0-9a-f]+:[ ]+72202573[ ]+csrr[ ]+a0,minstretcfgh
+[ ]+[0-9a-f]+:[ ]+72259073[ ]+csrw[ ]+minstretcfgh,a1
[ ]+[0-9a-f]+:[ ]+30c02573[ ]+csrr[ ]+a0,mstateen0
[ ]+[0-9a-f]+:[ ]+30c59073[ ]+csrw[ ]+mstateen0,a1
[ ]+[0-9a-f]+:[ ]+30d02573[ ]+csrr[ ]+a0,mstateen1
@@ -783,6 +791,10 @@ Disassembly of section .text:
[ ]+[0-9a-f]+:[ ]+34359073[ ]+csrw[ ]+mtval,a1
[ ]+[0-9a-f]+:[ ]+32002573[ ]+csrr[ ]+a0,mcountinhibit
[ ]+[0-9a-f]+:[ ]+32059073[ ]+csrw[ ]+mcountinhibit,a1
+[ ]+[0-9a-f]+:[ ]+32102573[ ]+csrr[ ]+a0,mcyclecfg
+[ ]+[0-9a-f]+:[ ]+32159073[ ]+csrw[ ]+mcyclecfg,a1
+[ ]+[0-9a-f]+:[ ]+32202573[ ]+csrr[ ]+a0,minstretcfg
+[ ]+[0-9a-f]+:[ ]+32259073[ ]+csrw[ ]+minstretcfg,a1
[ ]+[0-9a-f]+:[ ]+38002573[ ]+csrr[ ]+a0,0x380
[ ]+[0-9a-f]+:[ ]+38059073[ ]+csrw[ ]+0x380,a1
[ ]+[0-9a-f]+:[ ]+38102573[ ]+csrr[ ]+a0,0x381
@@ -795,10 +807,6 @@ Disassembly of section .text:
[ ]+[0-9a-f]+:[ ]+38459073[ ]+csrw[ ]+0x384,a1
[ ]+[0-9a-f]+:[ ]+38502573[ ]+csrr[ ]+a0,0x385
[ ]+[0-9a-f]+:[ ]+38559073[ ]+csrw[ ]+0x385,a1
-[ ]+[0-9a-f]+:[ ]+32102573[ ]+csrr[ ]+a0,0x321
-[ ]+[0-9a-f]+:[ ]+32159073[ ]+csrw[ ]+0x321,a1
-[ ]+[0-9a-f]+:[ ]+32202573[ ]+csrr[ ]+a0,0x322
-[ ]+[0-9a-f]+:[ ]+32259073[ ]+csrw[ ]+0x322,a1
[ ]+[0-9a-f]+:[ ]+00002573[ ]+csrr[ ]+a0,ustatus
[ ]+[0-9a-f]+:[ ]+00059073[ ]+csrw[ ]+ustatus,a1
[ ]+[0-9a-f]+:[ ]+00402573[ ]+csrr[ ]+a0,uie
diff --git a/gas/testsuite/gas/riscv/csr-version-1p11.l b/gas/testsuite/gas/riscv/csr-version-1p11.l
index ba49722..cc365f1 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p11.l
+++ b/gas/testsuite/gas/riscv/csr-version-1p11.l
@@ -885,6 +885,30 @@
.*Info: macro .*
.*Warning: invalid CSR `miph', needs `smaia' extension
.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs `smcntrpmf' extension
+.*Info: macro .*
.*Warning: invalid CSR `mstateen0', needs `smstateen' extension
.*Info: macro .*
.*Warning: invalid CSR `mstateen0', needs `smstateen' extension
@@ -1503,6 +1527,14 @@
.*Info: macro .*
.*Warning: invalid CSR `mucounteren' for the privileged spec `1.11'
.*Info: macro .*
+.*Warning: invalid CSR `mscounteren' for the privileged spec `1.11'
+.*Info: macro .*
+.*Warning: invalid CSR `mscounteren' for the privileged spec `1.11'
+.*Info: macro .*
+.*Warning: invalid CSR `mhcounteren' for the privileged spec `1.11'
+.*Info: macro .*
+.*Warning: invalid CSR `mhcounteren' for the privileged spec `1.11'
+.*Info: macro .*
.*Warning: invalid CSR `mbase' for the privileged spec `1.11'
.*Info: macro .*
.*Warning: invalid CSR `mbase' for the privileged spec `1.11'
@@ -1527,14 +1559,6 @@
.*Info: macro .*
.*Warning: invalid CSR `mdbound' for the privileged spec `1.11'
.*Info: macro .*
-.*Warning: invalid CSR `mscounteren' for the privileged spec `1.11'
-.*Info: macro .*
-.*Warning: invalid CSR `mscounteren' for the privileged spec `1.11'
-.*Info: macro .*
-.*Warning: invalid CSR `mhcounteren' for the privileged spec `1.11'
-.*Info: macro .*
-.*Warning: invalid CSR `mhcounteren' for the privileged spec `1.11'
-.*Info: macro .*
.*Warning: invalid CSR `fflags', needs `f' extension
.*Info: macro .*
.*Warning: invalid CSR `fflags', needs `f' extension
diff --git a/gas/testsuite/gas/riscv/csr-version-1p12.d b/gas/testsuite/gas/riscv/csr-version-1p12.d
index 612aac2..677820b 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p12.d
+++ b/gas/testsuite/gas/riscv/csr-version-1p12.d
@@ -623,6 +623,14 @@ Disassembly of section .text:
[ ]+[0-9a-f]+:[ ]+31959073[ ]+csrw[ ]+mviph,a1
[ ]+[0-9a-f]+:[ ]+35402573[ ]+csrr[ ]+a0,miph
[ ]+[0-9a-f]+:[ ]+35459073[ ]+csrw[ ]+miph,a1
+[ ]+[0-9a-f]+:[ ]+32102573[ ]+csrr[ ]+a0,mcyclecfg
+[ ]+[0-9a-f]+:[ ]+32159073[ ]+csrw[ ]+mcyclecfg,a1
+[ ]+[0-9a-f]+:[ ]+32202573[ ]+csrr[ ]+a0,minstretcfg
+[ ]+[0-9a-f]+:[ ]+32259073[ ]+csrw[ ]+minstretcfg,a1
+[ ]+[0-9a-f]+:[ ]+72102573[ ]+csrr[ ]+a0,mcyclecfgh
+[ ]+[0-9a-f]+:[ ]+72159073[ ]+csrw[ ]+mcyclecfgh,a1
+[ ]+[0-9a-f]+:[ ]+72202573[ ]+csrr[ ]+a0,minstretcfgh
+[ ]+[0-9a-f]+:[ ]+72259073[ ]+csrw[ ]+minstretcfgh,a1
[ ]+[0-9a-f]+:[ ]+30c02573[ ]+csrr[ ]+a0,mstateen0
[ ]+[0-9a-f]+:[ ]+30c59073[ ]+csrw[ ]+mstateen0,a1
[ ]+[0-9a-f]+:[ ]+30d02573[ ]+csrr[ ]+a0,mstateen1
@@ -783,6 +791,10 @@ Disassembly of section .text:
[ ]+[0-9a-f]+:[ ]+34359073[ ]+csrw[ ]+mtval,a1
[ ]+[0-9a-f]+:[ ]+32002573[ ]+csrr[ ]+a0,mcountinhibit
[ ]+[0-9a-f]+:[ ]+32059073[ ]+csrw[ ]+mcountinhibit,a1
+[ ]+[0-9a-f]+:[ ]+32102573[ ]+csrr[ ]+a0,mcyclecfg
+[ ]+[0-9a-f]+:[ ]+32159073[ ]+csrw[ ]+mcyclecfg,a1
+[ ]+[0-9a-f]+:[ ]+32202573[ ]+csrr[ ]+a0,minstretcfg
+[ ]+[0-9a-f]+:[ ]+32259073[ ]+csrw[ ]+minstretcfg,a1
[ ]+[0-9a-f]+:[ ]+38002573[ ]+csrr[ ]+a0,0x380
[ ]+[0-9a-f]+:[ ]+38059073[ ]+csrw[ ]+0x380,a1
[ ]+[0-9a-f]+:[ ]+38102573[ ]+csrr[ ]+a0,0x381
@@ -795,10 +807,6 @@ Disassembly of section .text:
[ ]+[0-9a-f]+:[ ]+38459073[ ]+csrw[ ]+0x384,a1
[ ]+[0-9a-f]+:[ ]+38502573[ ]+csrr[ ]+a0,0x385
[ ]+[0-9a-f]+:[ ]+38559073[ ]+csrw[ ]+0x385,a1
-[ ]+[0-9a-f]+:[ ]+32102573[ ]+csrr[ ]+a0,0x321
-[ ]+[0-9a-f]+:[ ]+32159073[ ]+csrw[ ]+0x321,a1
-[ ]+[0-9a-f]+:[ ]+32202573[ ]+csrr[ ]+a0,0x322
-[ ]+[0-9a-f]+:[ ]+32259073[ ]+csrw[ ]+0x322,a1
[ ]+[0-9a-f]+:[ ]+00002573[ ]+csrr[ ]+a0,0x0
[ ]+[0-9a-f]+:[ ]+00059073[ ]+csrw[ ]+0x0,a1
[ ]+[0-9a-f]+:[ ]+00402573[ ]+csrr[ ]+a0,0x4
diff --git a/gas/testsuite/gas/riscv/csr-version-1p12.l b/gas/testsuite/gas/riscv/csr-version-1p12.l
index bdebea2..7a7f5f7 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p12.l
+++ b/gas/testsuite/gas/riscv/csr-version-1p12.l
@@ -609,6 +609,30 @@
.*Info: macro .*
.*Warning: invalid CSR `miph', needs `smaia' extension
.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs `smcntrpmf' extension
+.*Info: macro .*
.*Warning: invalid CSR `mstateen0', needs `smstateen' extension
.*Info: macro .*
.*Warning: invalid CSR `mstateen0', needs `smstateen' extension
@@ -1227,6 +1251,14 @@
.*Info: macro .*
.*Warning: invalid CSR `mucounteren' for the privileged spec `1.12'
.*Info: macro .*
+.*Warning: invalid CSR `mscounteren' for the privileged spec `1.12'
+.*Info: macro .*
+.*Warning: invalid CSR `mscounteren' for the privileged spec `1.12'
+.*Info: macro .*
+.*Warning: invalid CSR `mhcounteren' for the privileged spec `1.12'
+.*Info: macro .*
+.*Warning: invalid CSR `mhcounteren' for the privileged spec `1.12'
+.*Info: macro .*
.*Warning: invalid CSR `mbase' for the privileged spec `1.12'
.*Info: macro .*
.*Warning: invalid CSR `mbase' for the privileged spec `1.12'
@@ -1251,14 +1283,6 @@
.*Info: macro .*
.*Warning: invalid CSR `mdbound' for the privileged spec `1.12'
.*Info: macro .*
-.*Warning: invalid CSR `mscounteren' for the privileged spec `1.12'
-.*Info: macro .*
-.*Warning: invalid CSR `mscounteren' for the privileged spec `1.12'
-.*Info: macro .*
-.*Warning: invalid CSR `mhcounteren' for the privileged spec `1.12'
-.*Info: macro .*
-.*Warning: invalid CSR `mhcounteren' for the privileged spec `1.12'
-.*Info: macro .*
.*Warning: invalid CSR `ustatus' for the privileged spec `1.12'
.*Info: macro .*
.*Warning: invalid CSR `ustatus' for the privileged spec `1.12'
diff --git a/gas/testsuite/gas/riscv/csr-version-1p9p1.d b/gas/testsuite/gas/riscv/csr-version-1p9p1.d
index 0fe849c..f4d2b04 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p9p1.d
+++ b/gas/testsuite/gas/riscv/csr-version-1p9p1.d
@@ -623,6 +623,14 @@ Disassembly of section .text:
[ ]+[0-9a-f]+:[ ]+31959073[ ]+csrw[ ]+mviph,a1
[ ]+[0-9a-f]+:[ ]+35402573[ ]+csrr[ ]+a0,miph
[ ]+[0-9a-f]+:[ ]+35459073[ ]+csrw[ ]+miph,a1
+[ ]+[0-9a-f]+:[ ]+32102573[ ]+csrr[ ]+a0,mscounteren
+[ ]+[0-9a-f]+:[ ]+32159073[ ]+csrw[ ]+mscounteren,a1
+[ ]+[0-9a-f]+:[ ]+32202573[ ]+csrr[ ]+a0,mhcounteren
+[ ]+[0-9a-f]+:[ ]+32259073[ ]+csrw[ ]+mhcounteren,a1
+[ ]+[0-9a-f]+:[ ]+72102573[ ]+csrr[ ]+a0,0x721
+[ ]+[0-9a-f]+:[ ]+72159073[ ]+csrw[ ]+0x721,a1
+[ ]+[0-9a-f]+:[ ]+72202573[ ]+csrr[ ]+a0,0x722
+[ ]+[0-9a-f]+:[ ]+72259073[ ]+csrw[ ]+0x722,a1
[ ]+[0-9a-f]+:[ ]+30c02573[ ]+csrr[ ]+a0,mstateen0
[ ]+[0-9a-f]+:[ ]+30c59073[ ]+csrw[ ]+mstateen0,a1
[ ]+[0-9a-f]+:[ ]+30d02573[ ]+csrr[ ]+a0,mstateen1
@@ -783,6 +791,10 @@ Disassembly of section .text:
[ ]+[0-9a-f]+:[ ]+34359073[ ]+csrw[ ]+mbadaddr,a1
[ ]+[0-9a-f]+:[ ]+32002573[ ]+csrr[ ]+a0,mucounteren
[ ]+[0-9a-f]+:[ ]+32059073[ ]+csrw[ ]+mucounteren,a1
+[ ]+[0-9a-f]+:[ ]+32102573[ ]+csrr[ ]+a0,mscounteren
+[ ]+[0-9a-f]+:[ ]+32159073[ ]+csrw[ ]+mscounteren,a1
+[ ]+[0-9a-f]+:[ ]+32202573[ ]+csrr[ ]+a0,mhcounteren
+[ ]+[0-9a-f]+:[ ]+32259073[ ]+csrw[ ]+mhcounteren,a1
[ ]+[0-9a-f]+:[ ]+38002573[ ]+csrr[ ]+a0,mbase
[ ]+[0-9a-f]+:[ ]+38059073[ ]+csrw[ ]+mbase,a1
[ ]+[0-9a-f]+:[ ]+38102573[ ]+csrr[ ]+a0,mbound
@@ -795,10 +807,6 @@ Disassembly of section .text:
[ ]+[0-9a-f]+:[ ]+38459073[ ]+csrw[ ]+mdbase,a1
[ ]+[0-9a-f]+:[ ]+38502573[ ]+csrr[ ]+a0,mdbound
[ ]+[0-9a-f]+:[ ]+38559073[ ]+csrw[ ]+mdbound,a1
-[ ]+[0-9a-f]+:[ ]+32102573[ ]+csrr[ ]+a0,mscounteren
-[ ]+[0-9a-f]+:[ ]+32159073[ ]+csrw[ ]+mscounteren,a1
-[ ]+[0-9a-f]+:[ ]+32202573[ ]+csrr[ ]+a0,mhcounteren
-[ ]+[0-9a-f]+:[ ]+32259073[ ]+csrw[ ]+mhcounteren,a1
[ ]+[0-9a-f]+:[ ]+00002573[ ]+csrr[ ]+a0,ustatus
[ ]+[0-9a-f]+:[ ]+00059073[ ]+csrw[ ]+ustatus,a1
[ ]+[0-9a-f]+:[ ]+00402573[ ]+csrr[ ]+a0,uie
diff --git a/gas/testsuite/gas/riscv/csr-version-1p9p1.l b/gas/testsuite/gas/riscv/csr-version-1p9p1.l
index 49bd959..7fcd73a 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p9p1.l
+++ b/gas/testsuite/gas/riscv/csr-version-1p9p1.l
@@ -989,6 +989,46 @@
.*Info: macro .*
.*Warning: invalid CSR `miph', needs `smaia' extension
.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfg' for the privileged spec `1.9.1'
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfg' for the privileged spec `1.9.1'
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfg' for the privileged spec `1.9.1'
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfg', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfg' for the privileged spec `1.9.1'
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh' for the privileged spec `1.9.1'
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `mcyclecfgh' for the privileged spec `1.9.1'
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh' for the privileged spec `1.9.1'
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs rv32i extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh', needs `smcntrpmf' extension
+.*Info: macro .*
+.*Warning: invalid CSR `minstretcfgh' for the privileged spec `1.9.1'
+.*Info: macro .*
.*Warning: invalid CSR `mstateen0', needs `smstateen' extension
.*Info: macro .*
.*Warning: invalid CSR `mstateen0', needs `smstateen' extension
diff --git a/gas/testsuite/gas/riscv/csr.s b/gas/testsuite/gas/riscv/csr.s
index c7406ce..6457436 100644
--- a/gas/testsuite/gas/riscv/csr.s
+++ b/gas/testsuite/gas/riscv/csr.s
@@ -350,6 +350,12 @@
csr mviph
csr miph
+ # Smcntrpmf extension
+ csr mcyclecfg
+ csr minstretcfg
+ csr mcyclecfgh
+ csr minstretcfgh
+
# Smstateen/Ssstateen extensions
csr mstateen0
csr mstateen1
@@ -440,14 +446,14 @@
csr sptbr # 0x180 in 1.9.1, but the value is satp since 1.10
csr mbadaddr # 0x343 in 1.9.1, but the value is mtval since 1.10
csr mucounteren # 0x320 in 1.9.1, dropped in 1.10, but the value is mcountinhibit since 1.11
+ csr mscounteren # 0x321 in 1.9.1, dropped in 1.10, but the value is mcyclecfg for Smcntrpmf extension
+ csr mhcounteren # 0x322 in 1.9.1, dropped in 1.10, but the value is mcyclecfg for Smcntrpmf extension
csr mbase # 0x380 in 1.9.1, dropped in 1.10
csr mbound # 0x381 in 1.9.1, dropped in 1.10
csr mibase # 0x382 in 1.9.1, dropped in 1.10
csr mibound # 0x383 in 1.9.1, dropped in 1.10
csr mdbase # 0x384 in 1.9.1, dropped in 1.10
csr mdbound # 0x385 in 1.9.1, dropped in 1.10
- csr mscounteren # 0x321 in 1.9.1, dropped in 1.10
- csr mhcounteren # 0x322 in 1.9.1, dropped in 1.10
csr ustatus # 0x0 in 1.9.1, dropped in 1.12
csr uie # 0x4 in 1.9.1, dropped in 1.12
csr utvec # 0x5 in 1.9.1, dropped in 1.12