aboutsummaryrefslogtreecommitdiff
path: root/gas
diff options
context:
space:
mode:
authorTsukasa OI <research_trasio@irq.a4lg.com>2022-06-24 11:51:54 +0900
committerNelson Chu <nelson.chu@sifive.com>2022-06-28 09:07:25 +0800
commit6af47b081ec0e93ad1d79c47a7f093db88f7653d (patch)
treecee5bc3a880fd78d463af261d85d978c6fad499d /gas
parent39590abd658b9d7322ed8c54b784f00aca749e03 (diff)
downloadgdb-6af47b081ec0e93ad1d79c47a7f093db88f7653d.zip
gdb-6af47b081ec0e93ad1d79c47a7f093db88f7653d.tar.gz
gdb-6af47b081ec0e93ad1d79c47a7f093db88f7653d.tar.bz2
RISC-V: Add 'Smstateen' extension and its CSRs
This commit adds State Enable Extension (Smstateen) and its CSRs. bfd/ChangeLog: * elfxx-riscv.c (riscv_supported_std_s_ext): Add 'Smstateen' extension to valid 'S' extension list. gas/ChangeLog: * config/tc-riscv.c (enum riscv_csr_class): Add CSR classes for 'Smstateen' extension. (riscv_csr_address): Add handling for new CSR classes. * testsuite/gas/riscv/csr-dw-regnums.s: Add new CSRs. * testsuite/gas/riscv/csr-dw-regnums.d: Likewise. * testsuite/gas/riscv/csr.s: Add new CSRs. * testsuite/gas/riscv/csr-version-1p9p1.d: Likewise. * 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 (CSR_MSTATEEN0, CSR_MSTATEEN1, CSR_MSTATEEN2, CSR_MSTATEEN3, CSR_SSTATEEN0, CSR_SSTATEEN1, CSR_SSTATEEN2, CSR_SSTATEEN3, CSR_HSTATEEN0, CSR_HSTATEEN1, CSR_HSTATEEN2, CSR_HSTATEEN3, CSR_MSTATEEN0H, CSR_MSTATEEN1H, CSR_MSTATEEN2H, CSR_MSTATEEN3H, CSR_HSTATEEN0H, CSR_HSTATEEN1H, CSR_HSTATEEN2H, CSR_HSTATEEN3H): New CSR macros.
Diffstat (limited to 'gas')
-rw-r--r--gas/config/tc-riscv.c14
-rw-r--r--gas/testsuite/gas/riscv/csr-dw-regnums.d20
-rw-r--r--gas/testsuite/gas/riscv/csr-dw-regnums.s21
-rw-r--r--gas/testsuite/gas/riscv/csr-version-1p10.d40
-rw-r--r--gas/testsuite/gas/riscv/csr-version-1p10.l72
-rw-r--r--gas/testsuite/gas/riscv/csr-version-1p11.d40
-rw-r--r--gas/testsuite/gas/riscv/csr-version-1p11.l72
-rw-r--r--gas/testsuite/gas/riscv/csr-version-1p12.d40
-rw-r--r--gas/testsuite/gas/riscv/csr-version-1p12.l72
-rw-r--r--gas/testsuite/gas/riscv/csr-version-1p9p1.d40
-rw-r--r--gas/testsuite/gas/riscv/csr-version-1p9p1.l72
-rw-r--r--gas/testsuite/gas/riscv/csr.s22
12 files changed, 525 insertions, 0 deletions
diff --git a/gas/config/tc-riscv.c b/gas/config/tc-riscv.c
index 6c5938b..660b2dd 100644
--- a/gas/config/tc-riscv.c
+++ b/gas/config/tc-riscv.c
@@ -68,6 +68,10 @@ enum riscv_csr_class
CSR_CLASS_DEBUG, /* debug CSR */
CSR_CLASS_H, /* hypervisor */
CSR_CLASS_H_32, /* hypervisor, rv32 only */
+ CSR_CLASS_SMSTATEEN, /* Smstateen only */
+ CSR_CLASS_SMSTATEEN_AND_H, /* Smstateen only (with H) */
+ CSR_CLASS_SMSTATEEN_32, /* Smstateen RV32 only */
+ CSR_CLASS_SMSTATEEN_AND_H_32, /* Smstateen RV32 only (with H) */
};
/* This structure holds all restricted conditions for a CSR. */
@@ -927,6 +931,16 @@ riscv_csr_address (const char *csr_name,
case CSR_CLASS_V:
extension = "v";
break;
+ case CSR_CLASS_SMSTATEEN:
+ case CSR_CLASS_SMSTATEEN_AND_H:
+ case CSR_CLASS_SMSTATEEN_32:
+ case CSR_CLASS_SMSTATEEN_AND_H_32:
+ is_rv32_only = (csr_class == CSR_CLASS_SMSTATEEN_32
+ || csr_class == CSR_CLASS_SMSTATEEN_AND_H_32);
+ is_h_required = (csr_class == CSR_CLASS_SMSTATEEN_AND_H
+ || csr_class == CSR_CLASS_SMSTATEEN_AND_H_32);
+ extension = "smstateen";
+ break;
case CSR_CLASS_DEBUG:
break;
default:
diff --git a/gas/testsuite/gas/riscv/csr-dw-regnums.d b/gas/testsuite/gas/riscv/csr-dw-regnums.d
index 23ceba1..0c9ec6e 100644
--- a/gas/testsuite/gas/riscv/csr-dw-regnums.d
+++ b/gas/testsuite/gas/riscv/csr-dw-regnums.d
@@ -313,6 +313,26 @@ Contents of the .* section:
DW_CFA_offset_extended_sf: r4675 \(vstval\) at cfa\+2316
DW_CFA_offset_extended_sf: r4676 \(vsip\) at cfa\+2320
DW_CFA_offset_extended_sf: r4736 \(vsatp\) at cfa\+2560
+ 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
+ DW_CFA_offset_extended_sf: r4879 \(mstateen3\) at cfa\+3132
+ DW_CFA_offset_extended_sf: r4364 \(sstateen0\) at cfa\+1072
+ DW_CFA_offset_extended_sf: r4365 \(sstateen1\) at cfa\+1076
+ DW_CFA_offset_extended_sf: r4366 \(sstateen2\) at cfa\+1080
+ DW_CFA_offset_extended_sf: r4367 \(sstateen3\) at cfa\+1084
+ DW_CFA_offset_extended_sf: r5644 \(hstateen0\) at cfa\+6192
+ DW_CFA_offset_extended_sf: r5645 \(hstateen1\) at cfa\+6196
+ DW_CFA_offset_extended_sf: r5646 \(hstateen2\) at cfa\+6200
+ DW_CFA_offset_extended_sf: r5647 \(hstateen3\) at cfa\+6204
+ DW_CFA_offset_extended_sf: r4892 \(mstateen0h\) at cfa\+3184
+ DW_CFA_offset_extended_sf: r4893 \(mstateen1h\) at cfa\+3188
+ DW_CFA_offset_extended_sf: r4894 \(mstateen2h\) at cfa\+3192
+ DW_CFA_offset_extended_sf: r4895 \(mstateen3h\) at cfa\+3196
+ DW_CFA_offset_extended_sf: r5660 \(hstateen0h\) at cfa\+6256
+ DW_CFA_offset_extended_sf: r5661 \(hstateen1h\) at cfa\+6260
+ DW_CFA_offset_extended_sf: r5662 \(hstateen2h\) at cfa\+6264
+ DW_CFA_offset_extended_sf: r5663 \(hstateen3h\) at cfa\+6268
DW_CFA_offset_extended_sf: r4163 \(utval\) at cfa\+268
DW_CFA_offset_extended_sf: r4419 \(stval\) at cfa\+1292
DW_CFA_offset_extended_sf: r4480 \(satp\) at cfa\+1536
diff --git a/gas/testsuite/gas/riscv/csr-dw-regnums.s b/gas/testsuite/gas/riscv/csr-dw-regnums.s
index 4a243ad..2afadac 100644
--- a/gas/testsuite/gas/riscv/csr-dw-regnums.s
+++ b/gas/testsuite/gas/riscv/csr-dw-regnums.s
@@ -307,6 +307,27 @@ _start:
.cfi_offset vstval, 2316
.cfi_offset vsip, 2320
.cfi_offset vsatp, 2560
+ # Smstateen extension
+ .cfi_offset mstateen0, 3120
+ .cfi_offset mstateen1, 3124
+ .cfi_offset mstateen2, 3128
+ .cfi_offset mstateen3, 3132
+ .cfi_offset sstateen0, 1072
+ .cfi_offset sstateen1, 1076
+ .cfi_offset sstateen2, 1080
+ .cfi_offset sstateen3, 1084
+ .cfi_offset hstateen0, 6192
+ .cfi_offset hstateen1, 6196
+ .cfi_offset hstateen2, 6200
+ .cfi_offset hstateen3, 6204
+ .cfi_offset mstateen0h, 3184
+ .cfi_offset mstateen1h, 3188
+ .cfi_offset mstateen2h, 3192
+ .cfi_offset mstateen3h, 3196
+ .cfi_offset hstateen0h, 6256
+ .cfi_offset hstateen1h, 6260
+ .cfi_offset hstateen2h, 6264
+ .cfi_offset hstateen3h, 6268
# dropped
.cfi_offset ubadaddr, 268 # aliases
.cfi_offset sbadaddr, 1292 # aliases
diff --git a/gas/testsuite/gas/riscv/csr-version-1p10.d b/gas/testsuite/gas/riscv/csr-version-1p10.d
index c39cbf3..65b370b 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p10.d
+++ b/gas/testsuite/gas/riscv/csr-version-1p10.d
@@ -601,6 +601,46 @@ Disassembly of section .text:
[ ]+[0-9a-f]+:[ ]+24459073[ ]+csrw[ ]+vsip,a1
[ ]+[0-9a-f]+:[ ]+28002573[ ]+csrr[ ]+a0,vsatp
[ ]+[0-9a-f]+:[ ]+28059073[ ]+csrw[ ]+vsatp,a1
+[ ]+[0-9a-f]+:[ ]+30c02573[ ]+csrr[ ]+a0,mstateen0
+[ ]+[0-9a-f]+:[ ]+30c59073[ ]+csrw[ ]+mstateen0,a1
+[ ]+[0-9a-f]+:[ ]+30d02573[ ]+csrr[ ]+a0,mstateen1
+[ ]+[0-9a-f]+:[ ]+30d59073[ ]+csrw[ ]+mstateen1,a1
+[ ]+[0-9a-f]+:[ ]+30e02573[ ]+csrr[ ]+a0,mstateen2
+[ ]+[0-9a-f]+:[ ]+30e59073[ ]+csrw[ ]+mstateen2,a1
+[ ]+[0-9a-f]+:[ ]+30f02573[ ]+csrr[ ]+a0,mstateen3
+[ ]+[0-9a-f]+:[ ]+30f59073[ ]+csrw[ ]+mstateen3,a1
+[ ]+[0-9a-f]+:[ ]+10c02573[ ]+csrr[ ]+a0,sstateen0
+[ ]+[0-9a-f]+:[ ]+10c59073[ ]+csrw[ ]+sstateen0,a1
+[ ]+[0-9a-f]+:[ ]+10d02573[ ]+csrr[ ]+a0,sstateen1
+[ ]+[0-9a-f]+:[ ]+10d59073[ ]+csrw[ ]+sstateen1,a1
+[ ]+[0-9a-f]+:[ ]+10e02573[ ]+csrr[ ]+a0,sstateen2
+[ ]+[0-9a-f]+:[ ]+10e59073[ ]+csrw[ ]+sstateen2,a1
+[ ]+[0-9a-f]+:[ ]+10f02573[ ]+csrr[ ]+a0,sstateen3
+[ ]+[0-9a-f]+:[ ]+10f59073[ ]+csrw[ ]+sstateen3,a1
+[ ]+[0-9a-f]+:[ ]+60c02573[ ]+csrr[ ]+a0,hstateen0
+[ ]+[0-9a-f]+:[ ]+60c59073[ ]+csrw[ ]+hstateen0,a1
+[ ]+[0-9a-f]+:[ ]+60d02573[ ]+csrr[ ]+a0,hstateen1
+[ ]+[0-9a-f]+:[ ]+60d59073[ ]+csrw[ ]+hstateen1,a1
+[ ]+[0-9a-f]+:[ ]+60e02573[ ]+csrr[ ]+a0,hstateen2
+[ ]+[0-9a-f]+:[ ]+60e59073[ ]+csrw[ ]+hstateen2,a1
+[ ]+[0-9a-f]+:[ ]+60f02573[ ]+csrr[ ]+a0,hstateen3
+[ ]+[0-9a-f]+:[ ]+60f59073[ ]+csrw[ ]+hstateen3,a1
+[ ]+[0-9a-f]+:[ ]+31c02573[ ]+csrr[ ]+a0,mstateen0h
+[ ]+[0-9a-f]+:[ ]+31c59073[ ]+csrw[ ]+mstateen0h,a1
+[ ]+[0-9a-f]+:[ ]+31d02573[ ]+csrr[ ]+a0,mstateen1h
+[ ]+[0-9a-f]+:[ ]+31d59073[ ]+csrw[ ]+mstateen1h,a1
+[ ]+[0-9a-f]+:[ ]+31e02573[ ]+csrr[ ]+a0,mstateen2h
+[ ]+[0-9a-f]+:[ ]+31e59073[ ]+csrw[ ]+mstateen2h,a1
+[ ]+[0-9a-f]+:[ ]+31f02573[ ]+csrr[ ]+a0,mstateen3h
+[ ]+[0-9a-f]+:[ ]+31f59073[ ]+csrw[ ]+mstateen3h,a1
+[ ]+[0-9a-f]+:[ ]+61c02573[ ]+csrr[ ]+a0,hstateen0h
+[ ]+[0-9a-f]+:[ ]+61c59073[ ]+csrw[ ]+hstateen0h,a1
+[ ]+[0-9a-f]+:[ ]+61d02573[ ]+csrr[ ]+a0,hstateen1h
+[ ]+[0-9a-f]+:[ ]+61d59073[ ]+csrw[ ]+hstateen1h,a1
+[ ]+[0-9a-f]+:[ ]+61e02573[ ]+csrr[ ]+a0,hstateen2h
+[ ]+[0-9a-f]+:[ ]+61e59073[ ]+csrw[ ]+hstateen2h,a1
+[ ]+[0-9a-f]+:[ ]+61f02573[ ]+csrr[ ]+a0,hstateen3h
+[ ]+[0-9a-f]+:[ ]+61f59073[ ]+csrw[ ]+hstateen3h,a1
[ ]+[0-9a-f]+:[ ]+04302573[ ]+csrr[ ]+a0,utval
[ ]+[0-9a-f]+:[ ]+04359073[ ]+csrw[ ]+utval,a1
[ ]+[0-9a-f]+:[ ]+14302573[ ]+csrr[ ]+a0,stval
diff --git a/gas/testsuite/gas/riscv/csr-version-1p10.l b/gas/testsuite/gas/riscv/csr-version-1p10.l
index d00bce8..b1e4226 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p10.l
+++ b/gas/testsuite/gas/riscv/csr-version-1p10.l
@@ -411,6 +411,78 @@
.*Warning: invalid CSR `vsip', needs `h' extension
.*Warning: invalid CSR `vsatp', needs `h' extension
.*Warning: invalid CSR `vsatp', needs `h' extension
+.*Warning: invalid CSR `mstateen0', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen0', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen1', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen1', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen2', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen2', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen3', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen3', needs `smstateen' extension
+.*Warning: invalid CSR `sstateen0', needs `smstateen' extension
+.*Warning: invalid CSR `sstateen0', needs `smstateen' extension
+.*Warning: invalid CSR `sstateen1', needs `smstateen' extension
+.*Warning: invalid CSR `sstateen1', needs `smstateen' extension
+.*Warning: invalid CSR `sstateen2', needs `smstateen' extension
+.*Warning: invalid CSR `sstateen2', needs `smstateen' extension
+.*Warning: invalid CSR `sstateen3', needs `smstateen' extension
+.*Warning: invalid CSR `sstateen3', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen0', needs `h' extension
+.*Warning: invalid CSR `hstateen0', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen0', needs `h' extension
+.*Warning: invalid CSR `hstateen0', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen1', needs `h' extension
+.*Warning: invalid CSR `hstateen1', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen1', needs `h' extension
+.*Warning: invalid CSR `hstateen1', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen2', needs `h' extension
+.*Warning: invalid CSR `hstateen2', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen2', needs `h' extension
+.*Warning: invalid CSR `hstateen2', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen3', needs `h' extension
+.*Warning: invalid CSR `hstateen3', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen3', needs `h' extension
+.*Warning: invalid CSR `hstateen3', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen0h', needs rv32i extension
+.*Warning: invalid CSR `mstateen0h', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen0h', needs rv32i extension
+.*Warning: invalid CSR `mstateen0h', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen1h', needs rv32i extension
+.*Warning: invalid CSR `mstateen1h', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen1h', needs rv32i extension
+.*Warning: invalid CSR `mstateen1h', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen2h', needs rv32i extension
+.*Warning: invalid CSR `mstateen2h', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen2h', needs rv32i extension
+.*Warning: invalid CSR `mstateen2h', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen3h', needs rv32i extension
+.*Warning: invalid CSR `mstateen3h', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen3h', needs rv32i extension
+.*Warning: invalid CSR `mstateen3h', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen0h', needs rv32i extension
+.*Warning: invalid CSR `hstateen0h', needs `h' extension
+.*Warning: invalid CSR `hstateen0h', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen0h', needs rv32i extension
+.*Warning: invalid CSR `hstateen0h', needs `h' extension
+.*Warning: invalid CSR `hstateen0h', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen1h', needs rv32i extension
+.*Warning: invalid CSR `hstateen1h', needs `h' extension
+.*Warning: invalid CSR `hstateen1h', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen1h', needs rv32i extension
+.*Warning: invalid CSR `hstateen1h', needs `h' extension
+.*Warning: invalid CSR `hstateen1h', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen2h', needs rv32i extension
+.*Warning: invalid CSR `hstateen2h', needs `h' extension
+.*Warning: invalid CSR `hstateen2h', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen2h', needs rv32i extension
+.*Warning: invalid CSR `hstateen2h', needs `h' extension
+.*Warning: invalid CSR `hstateen2h', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen3h', needs rv32i extension
+.*Warning: invalid CSR `hstateen3h', needs `h' extension
+.*Warning: invalid CSR `hstateen3h', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen3h', needs rv32i extension
+.*Warning: invalid CSR `hstateen3h', needs `h' extension
+.*Warning: invalid CSR `hstateen3h', needs `smstateen' extension
.*Warning: invalid CSR `ubadaddr' for the privileged spec `1.10'
.*Warning: invalid CSR `ubadaddr' for the privileged spec `1.10'
.*Warning: invalid CSR `sbadaddr' for the privileged spec `1.10'
diff --git a/gas/testsuite/gas/riscv/csr-version-1p11.d b/gas/testsuite/gas/riscv/csr-version-1p11.d
index cfcec35..29a659a 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p11.d
+++ b/gas/testsuite/gas/riscv/csr-version-1p11.d
@@ -601,6 +601,46 @@ Disassembly of section .text:
[ ]+[0-9a-f]+:[ ]+24459073[ ]+csrw[ ]+vsip,a1
[ ]+[0-9a-f]+:[ ]+28002573[ ]+csrr[ ]+a0,vsatp
[ ]+[0-9a-f]+:[ ]+28059073[ ]+csrw[ ]+vsatp,a1
+[ ]+[0-9a-f]+:[ ]+30c02573[ ]+csrr[ ]+a0,mstateen0
+[ ]+[0-9a-f]+:[ ]+30c59073[ ]+csrw[ ]+mstateen0,a1
+[ ]+[0-9a-f]+:[ ]+30d02573[ ]+csrr[ ]+a0,mstateen1
+[ ]+[0-9a-f]+:[ ]+30d59073[ ]+csrw[ ]+mstateen1,a1
+[ ]+[0-9a-f]+:[ ]+30e02573[ ]+csrr[ ]+a0,mstateen2
+[ ]+[0-9a-f]+:[ ]+30e59073[ ]+csrw[ ]+mstateen2,a1
+[ ]+[0-9a-f]+:[ ]+30f02573[ ]+csrr[ ]+a0,mstateen3
+[ ]+[0-9a-f]+:[ ]+30f59073[ ]+csrw[ ]+mstateen3,a1
+[ ]+[0-9a-f]+:[ ]+10c02573[ ]+csrr[ ]+a0,sstateen0
+[ ]+[0-9a-f]+:[ ]+10c59073[ ]+csrw[ ]+sstateen0,a1
+[ ]+[0-9a-f]+:[ ]+10d02573[ ]+csrr[ ]+a0,sstateen1
+[ ]+[0-9a-f]+:[ ]+10d59073[ ]+csrw[ ]+sstateen1,a1
+[ ]+[0-9a-f]+:[ ]+10e02573[ ]+csrr[ ]+a0,sstateen2
+[ ]+[0-9a-f]+:[ ]+10e59073[ ]+csrw[ ]+sstateen2,a1
+[ ]+[0-9a-f]+:[ ]+10f02573[ ]+csrr[ ]+a0,sstateen3
+[ ]+[0-9a-f]+:[ ]+10f59073[ ]+csrw[ ]+sstateen3,a1
+[ ]+[0-9a-f]+:[ ]+60c02573[ ]+csrr[ ]+a0,hstateen0
+[ ]+[0-9a-f]+:[ ]+60c59073[ ]+csrw[ ]+hstateen0,a1
+[ ]+[0-9a-f]+:[ ]+60d02573[ ]+csrr[ ]+a0,hstateen1
+[ ]+[0-9a-f]+:[ ]+60d59073[ ]+csrw[ ]+hstateen1,a1
+[ ]+[0-9a-f]+:[ ]+60e02573[ ]+csrr[ ]+a0,hstateen2
+[ ]+[0-9a-f]+:[ ]+60e59073[ ]+csrw[ ]+hstateen2,a1
+[ ]+[0-9a-f]+:[ ]+60f02573[ ]+csrr[ ]+a0,hstateen3
+[ ]+[0-9a-f]+:[ ]+60f59073[ ]+csrw[ ]+hstateen3,a1
+[ ]+[0-9a-f]+:[ ]+31c02573[ ]+csrr[ ]+a0,mstateen0h
+[ ]+[0-9a-f]+:[ ]+31c59073[ ]+csrw[ ]+mstateen0h,a1
+[ ]+[0-9a-f]+:[ ]+31d02573[ ]+csrr[ ]+a0,mstateen1h
+[ ]+[0-9a-f]+:[ ]+31d59073[ ]+csrw[ ]+mstateen1h,a1
+[ ]+[0-9a-f]+:[ ]+31e02573[ ]+csrr[ ]+a0,mstateen2h
+[ ]+[0-9a-f]+:[ ]+31e59073[ ]+csrw[ ]+mstateen2h,a1
+[ ]+[0-9a-f]+:[ ]+31f02573[ ]+csrr[ ]+a0,mstateen3h
+[ ]+[0-9a-f]+:[ ]+31f59073[ ]+csrw[ ]+mstateen3h,a1
+[ ]+[0-9a-f]+:[ ]+61c02573[ ]+csrr[ ]+a0,hstateen0h
+[ ]+[0-9a-f]+:[ ]+61c59073[ ]+csrw[ ]+hstateen0h,a1
+[ ]+[0-9a-f]+:[ ]+61d02573[ ]+csrr[ ]+a0,hstateen1h
+[ ]+[0-9a-f]+:[ ]+61d59073[ ]+csrw[ ]+hstateen1h,a1
+[ ]+[0-9a-f]+:[ ]+61e02573[ ]+csrr[ ]+a0,hstateen2h
+[ ]+[0-9a-f]+:[ ]+61e59073[ ]+csrw[ ]+hstateen2h,a1
+[ ]+[0-9a-f]+:[ ]+61f02573[ ]+csrr[ ]+a0,hstateen3h
+[ ]+[0-9a-f]+:[ ]+61f59073[ ]+csrw[ ]+hstateen3h,a1
[ ]+[0-9a-f]+:[ ]+04302573[ ]+csrr[ ]+a0,utval
[ ]+[0-9a-f]+:[ ]+04359073[ ]+csrw[ ]+utval,a1
[ ]+[0-9a-f]+:[ ]+14302573[ ]+csrr[ ]+a0,stval
diff --git a/gas/testsuite/gas/riscv/csr-version-1p11.l b/gas/testsuite/gas/riscv/csr-version-1p11.l
index d4716a2..1b66848 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p11.l
+++ b/gas/testsuite/gas/riscv/csr-version-1p11.l
@@ -409,6 +409,78 @@
.*Warning: invalid CSR `vsip', needs `h' extension
.*Warning: invalid CSR `vsatp', needs `h' extension
.*Warning: invalid CSR `vsatp', needs `h' extension
+.*Warning: invalid CSR `mstateen0', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen0', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen1', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen1', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen2', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen2', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen3', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen3', needs `smstateen' extension
+.*Warning: invalid CSR `sstateen0', needs `smstateen' extension
+.*Warning: invalid CSR `sstateen0', needs `smstateen' extension
+.*Warning: invalid CSR `sstateen1', needs `smstateen' extension
+.*Warning: invalid CSR `sstateen1', needs `smstateen' extension
+.*Warning: invalid CSR `sstateen2', needs `smstateen' extension
+.*Warning: invalid CSR `sstateen2', needs `smstateen' extension
+.*Warning: invalid CSR `sstateen3', needs `smstateen' extension
+.*Warning: invalid CSR `sstateen3', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen0', needs `h' extension
+.*Warning: invalid CSR `hstateen0', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen0', needs `h' extension
+.*Warning: invalid CSR `hstateen0', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen1', needs `h' extension
+.*Warning: invalid CSR `hstateen1', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen1', needs `h' extension
+.*Warning: invalid CSR `hstateen1', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen2', needs `h' extension
+.*Warning: invalid CSR `hstateen2', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen2', needs `h' extension
+.*Warning: invalid CSR `hstateen2', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen3', needs `h' extension
+.*Warning: invalid CSR `hstateen3', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen3', needs `h' extension
+.*Warning: invalid CSR `hstateen3', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen0h', needs rv32i extension
+.*Warning: invalid CSR `mstateen0h', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen0h', needs rv32i extension
+.*Warning: invalid CSR `mstateen0h', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen1h', needs rv32i extension
+.*Warning: invalid CSR `mstateen1h', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen1h', needs rv32i extension
+.*Warning: invalid CSR `mstateen1h', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen2h', needs rv32i extension
+.*Warning: invalid CSR `mstateen2h', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen2h', needs rv32i extension
+.*Warning: invalid CSR `mstateen2h', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen3h', needs rv32i extension
+.*Warning: invalid CSR `mstateen3h', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen3h', needs rv32i extension
+.*Warning: invalid CSR `mstateen3h', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen0h', needs rv32i extension
+.*Warning: invalid CSR `hstateen0h', needs `h' extension
+.*Warning: invalid CSR `hstateen0h', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen0h', needs rv32i extension
+.*Warning: invalid CSR `hstateen0h', needs `h' extension
+.*Warning: invalid CSR `hstateen0h', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen1h', needs rv32i extension
+.*Warning: invalid CSR `hstateen1h', needs `h' extension
+.*Warning: invalid CSR `hstateen1h', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen1h', needs rv32i extension
+.*Warning: invalid CSR `hstateen1h', needs `h' extension
+.*Warning: invalid CSR `hstateen1h', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen2h', needs rv32i extension
+.*Warning: invalid CSR `hstateen2h', needs `h' extension
+.*Warning: invalid CSR `hstateen2h', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen2h', needs rv32i extension
+.*Warning: invalid CSR `hstateen2h', needs `h' extension
+.*Warning: invalid CSR `hstateen2h', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen3h', needs rv32i extension
+.*Warning: invalid CSR `hstateen3h', needs `h' extension
+.*Warning: invalid CSR `hstateen3h', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen3h', needs rv32i extension
+.*Warning: invalid CSR `hstateen3h', needs `h' extension
+.*Warning: invalid CSR `hstateen3h', needs `smstateen' extension
.*Warning: invalid CSR `ubadaddr' for the privileged spec `1.11'
.*Warning: invalid CSR `ubadaddr' for the privileged spec `1.11'
.*Warning: invalid CSR `sbadaddr' for the privileged spec `1.11'
diff --git a/gas/testsuite/gas/riscv/csr-version-1p12.d b/gas/testsuite/gas/riscv/csr-version-1p12.d
index 3c27ca2..46ca519 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p12.d
+++ b/gas/testsuite/gas/riscv/csr-version-1p12.d
@@ -601,6 +601,46 @@ Disassembly of section .text:
[ ]+[0-9a-f]+:[ ]+24459073[ ]+csrw[ ]+vsip,a1
[ ]+[0-9a-f]+:[ ]+28002573[ ]+csrr[ ]+a0,vsatp
[ ]+[0-9a-f]+:[ ]+28059073[ ]+csrw[ ]+vsatp,a1
+[ ]+[0-9a-f]+:[ ]+30c02573[ ]+csrr[ ]+a0,mstateen0
+[ ]+[0-9a-f]+:[ ]+30c59073[ ]+csrw[ ]+mstateen0,a1
+[ ]+[0-9a-f]+:[ ]+30d02573[ ]+csrr[ ]+a0,mstateen1
+[ ]+[0-9a-f]+:[ ]+30d59073[ ]+csrw[ ]+mstateen1,a1
+[ ]+[0-9a-f]+:[ ]+30e02573[ ]+csrr[ ]+a0,mstateen2
+[ ]+[0-9a-f]+:[ ]+30e59073[ ]+csrw[ ]+mstateen2,a1
+[ ]+[0-9a-f]+:[ ]+30f02573[ ]+csrr[ ]+a0,mstateen3
+[ ]+[0-9a-f]+:[ ]+30f59073[ ]+csrw[ ]+mstateen3,a1
+[ ]+[0-9a-f]+:[ ]+10c02573[ ]+csrr[ ]+a0,sstateen0
+[ ]+[0-9a-f]+:[ ]+10c59073[ ]+csrw[ ]+sstateen0,a1
+[ ]+[0-9a-f]+:[ ]+10d02573[ ]+csrr[ ]+a0,sstateen1
+[ ]+[0-9a-f]+:[ ]+10d59073[ ]+csrw[ ]+sstateen1,a1
+[ ]+[0-9a-f]+:[ ]+10e02573[ ]+csrr[ ]+a0,sstateen2
+[ ]+[0-9a-f]+:[ ]+10e59073[ ]+csrw[ ]+sstateen2,a1
+[ ]+[0-9a-f]+:[ ]+10f02573[ ]+csrr[ ]+a0,sstateen3
+[ ]+[0-9a-f]+:[ ]+10f59073[ ]+csrw[ ]+sstateen3,a1
+[ ]+[0-9a-f]+:[ ]+60c02573[ ]+csrr[ ]+a0,hstateen0
+[ ]+[0-9a-f]+:[ ]+60c59073[ ]+csrw[ ]+hstateen0,a1
+[ ]+[0-9a-f]+:[ ]+60d02573[ ]+csrr[ ]+a0,hstateen1
+[ ]+[0-9a-f]+:[ ]+60d59073[ ]+csrw[ ]+hstateen1,a1
+[ ]+[0-9a-f]+:[ ]+60e02573[ ]+csrr[ ]+a0,hstateen2
+[ ]+[0-9a-f]+:[ ]+60e59073[ ]+csrw[ ]+hstateen2,a1
+[ ]+[0-9a-f]+:[ ]+60f02573[ ]+csrr[ ]+a0,hstateen3
+[ ]+[0-9a-f]+:[ ]+60f59073[ ]+csrw[ ]+hstateen3,a1
+[ ]+[0-9a-f]+:[ ]+31c02573[ ]+csrr[ ]+a0,mstateen0h
+[ ]+[0-9a-f]+:[ ]+31c59073[ ]+csrw[ ]+mstateen0h,a1
+[ ]+[0-9a-f]+:[ ]+31d02573[ ]+csrr[ ]+a0,mstateen1h
+[ ]+[0-9a-f]+:[ ]+31d59073[ ]+csrw[ ]+mstateen1h,a1
+[ ]+[0-9a-f]+:[ ]+31e02573[ ]+csrr[ ]+a0,mstateen2h
+[ ]+[0-9a-f]+:[ ]+31e59073[ ]+csrw[ ]+mstateen2h,a1
+[ ]+[0-9a-f]+:[ ]+31f02573[ ]+csrr[ ]+a0,mstateen3h
+[ ]+[0-9a-f]+:[ ]+31f59073[ ]+csrw[ ]+mstateen3h,a1
+[ ]+[0-9a-f]+:[ ]+61c02573[ ]+csrr[ ]+a0,hstateen0h
+[ ]+[0-9a-f]+:[ ]+61c59073[ ]+csrw[ ]+hstateen0h,a1
+[ ]+[0-9a-f]+:[ ]+61d02573[ ]+csrr[ ]+a0,hstateen1h
+[ ]+[0-9a-f]+:[ ]+61d59073[ ]+csrw[ ]+hstateen1h,a1
+[ ]+[0-9a-f]+:[ ]+61e02573[ ]+csrr[ ]+a0,hstateen2h
+[ ]+[0-9a-f]+:[ ]+61e59073[ ]+csrw[ ]+hstateen2h,a1
+[ ]+[0-9a-f]+:[ ]+61f02573[ ]+csrr[ ]+a0,hstateen3h
+[ ]+[0-9a-f]+:[ ]+61f59073[ ]+csrw[ ]+hstateen3h,a1
[ ]+[0-9a-f]+:[ ]+04302573[ ]+csrr[ ]+a0,0x43
[ ]+[0-9a-f]+:[ ]+04359073[ ]+csrw[ ]+0x43,a1
[ ]+[0-9a-f]+:[ ]+14302573[ ]+csrr[ ]+a0,stval
diff --git a/gas/testsuite/gas/riscv/csr-version-1p12.l b/gas/testsuite/gas/riscv/csr-version-1p12.l
index ab291c5..90a67f0 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p12.l
+++ b/gas/testsuite/gas/riscv/csr-version-1p12.l
@@ -271,6 +271,78 @@
.*Warning: invalid CSR `vsip', needs `h' extension
.*Warning: invalid CSR `vsatp', needs `h' extension
.*Warning: invalid CSR `vsatp', needs `h' extension
+.*Warning: invalid CSR `mstateen0', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen0', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen1', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen1', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen2', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen2', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen3', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen3', needs `smstateen' extension
+.*Warning: invalid CSR `sstateen0', needs `smstateen' extension
+.*Warning: invalid CSR `sstateen0', needs `smstateen' extension
+.*Warning: invalid CSR `sstateen1', needs `smstateen' extension
+.*Warning: invalid CSR `sstateen1', needs `smstateen' extension
+.*Warning: invalid CSR `sstateen2', needs `smstateen' extension
+.*Warning: invalid CSR `sstateen2', needs `smstateen' extension
+.*Warning: invalid CSR `sstateen3', needs `smstateen' extension
+.*Warning: invalid CSR `sstateen3', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen0', needs `h' extension
+.*Warning: invalid CSR `hstateen0', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen0', needs `h' extension
+.*Warning: invalid CSR `hstateen0', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen1', needs `h' extension
+.*Warning: invalid CSR `hstateen1', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen1', needs `h' extension
+.*Warning: invalid CSR `hstateen1', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen2', needs `h' extension
+.*Warning: invalid CSR `hstateen2', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen2', needs `h' extension
+.*Warning: invalid CSR `hstateen2', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen3', needs `h' extension
+.*Warning: invalid CSR `hstateen3', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen3', needs `h' extension
+.*Warning: invalid CSR `hstateen3', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen0h', needs rv32i extension
+.*Warning: invalid CSR `mstateen0h', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen0h', needs rv32i extension
+.*Warning: invalid CSR `mstateen0h', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen1h', needs rv32i extension
+.*Warning: invalid CSR `mstateen1h', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen1h', needs rv32i extension
+.*Warning: invalid CSR `mstateen1h', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen2h', needs rv32i extension
+.*Warning: invalid CSR `mstateen2h', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen2h', needs rv32i extension
+.*Warning: invalid CSR `mstateen2h', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen3h', needs rv32i extension
+.*Warning: invalid CSR `mstateen3h', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen3h', needs rv32i extension
+.*Warning: invalid CSR `mstateen3h', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen0h', needs rv32i extension
+.*Warning: invalid CSR `hstateen0h', needs `h' extension
+.*Warning: invalid CSR `hstateen0h', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen0h', needs rv32i extension
+.*Warning: invalid CSR `hstateen0h', needs `h' extension
+.*Warning: invalid CSR `hstateen0h', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen1h', needs rv32i extension
+.*Warning: invalid CSR `hstateen1h', needs `h' extension
+.*Warning: invalid CSR `hstateen1h', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen1h', needs rv32i extension
+.*Warning: invalid CSR `hstateen1h', needs `h' extension
+.*Warning: invalid CSR `hstateen1h', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen2h', needs rv32i extension
+.*Warning: invalid CSR `hstateen2h', needs `h' extension
+.*Warning: invalid CSR `hstateen2h', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen2h', needs rv32i extension
+.*Warning: invalid CSR `hstateen2h', needs `h' extension
+.*Warning: invalid CSR `hstateen2h', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen3h', needs rv32i extension
+.*Warning: invalid CSR `hstateen3h', needs `h' extension
+.*Warning: invalid CSR `hstateen3h', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen3h', needs rv32i extension
+.*Warning: invalid CSR `hstateen3h', needs `h' extension
+.*Warning: invalid CSR `hstateen3h', needs `smstateen' extension
.*Warning: invalid CSR `ubadaddr' for the privileged spec `1.12'
.*Warning: invalid CSR `ubadaddr' for the privileged spec `1.12'
.*Warning: invalid CSR `sbadaddr' 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 cf9479d..da56a0b 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p9p1.d
+++ b/gas/testsuite/gas/riscv/csr-version-1p9p1.d
@@ -601,6 +601,46 @@ Disassembly of section .text:
[ ]+[0-9a-f]+:[ ]+24459073[ ]+csrw[ ]+vsip,a1
[ ]+[0-9a-f]+:[ ]+28002573[ ]+csrr[ ]+a0,vsatp
[ ]+[0-9a-f]+:[ ]+28059073[ ]+csrw[ ]+vsatp,a1
+[ ]+[0-9a-f]+:[ ]+30c02573[ ]+csrr[ ]+a0,mstateen0
+[ ]+[0-9a-f]+:[ ]+30c59073[ ]+csrw[ ]+mstateen0,a1
+[ ]+[0-9a-f]+:[ ]+30d02573[ ]+csrr[ ]+a0,mstateen1
+[ ]+[0-9a-f]+:[ ]+30d59073[ ]+csrw[ ]+mstateen1,a1
+[ ]+[0-9a-f]+:[ ]+30e02573[ ]+csrr[ ]+a0,mstateen2
+[ ]+[0-9a-f]+:[ ]+30e59073[ ]+csrw[ ]+mstateen2,a1
+[ ]+[0-9a-f]+:[ ]+30f02573[ ]+csrr[ ]+a0,mstateen3
+[ ]+[0-9a-f]+:[ ]+30f59073[ ]+csrw[ ]+mstateen3,a1
+[ ]+[0-9a-f]+:[ ]+10c02573[ ]+csrr[ ]+a0,sstateen0
+[ ]+[0-9a-f]+:[ ]+10c59073[ ]+csrw[ ]+sstateen0,a1
+[ ]+[0-9a-f]+:[ ]+10d02573[ ]+csrr[ ]+a0,sstateen1
+[ ]+[0-9a-f]+:[ ]+10d59073[ ]+csrw[ ]+sstateen1,a1
+[ ]+[0-9a-f]+:[ ]+10e02573[ ]+csrr[ ]+a0,sstateen2
+[ ]+[0-9a-f]+:[ ]+10e59073[ ]+csrw[ ]+sstateen2,a1
+[ ]+[0-9a-f]+:[ ]+10f02573[ ]+csrr[ ]+a0,sstateen3
+[ ]+[0-9a-f]+:[ ]+10f59073[ ]+csrw[ ]+sstateen3,a1
+[ ]+[0-9a-f]+:[ ]+60c02573[ ]+csrr[ ]+a0,hstateen0
+[ ]+[0-9a-f]+:[ ]+60c59073[ ]+csrw[ ]+hstateen0,a1
+[ ]+[0-9a-f]+:[ ]+60d02573[ ]+csrr[ ]+a0,hstateen1
+[ ]+[0-9a-f]+:[ ]+60d59073[ ]+csrw[ ]+hstateen1,a1
+[ ]+[0-9a-f]+:[ ]+60e02573[ ]+csrr[ ]+a0,hstateen2
+[ ]+[0-9a-f]+:[ ]+60e59073[ ]+csrw[ ]+hstateen2,a1
+[ ]+[0-9a-f]+:[ ]+60f02573[ ]+csrr[ ]+a0,hstateen3
+[ ]+[0-9a-f]+:[ ]+60f59073[ ]+csrw[ ]+hstateen3,a1
+[ ]+[0-9a-f]+:[ ]+31c02573[ ]+csrr[ ]+a0,mstateen0h
+[ ]+[0-9a-f]+:[ ]+31c59073[ ]+csrw[ ]+mstateen0h,a1
+[ ]+[0-9a-f]+:[ ]+31d02573[ ]+csrr[ ]+a0,mstateen1h
+[ ]+[0-9a-f]+:[ ]+31d59073[ ]+csrw[ ]+mstateen1h,a1
+[ ]+[0-9a-f]+:[ ]+31e02573[ ]+csrr[ ]+a0,mstateen2h
+[ ]+[0-9a-f]+:[ ]+31e59073[ ]+csrw[ ]+mstateen2h,a1
+[ ]+[0-9a-f]+:[ ]+31f02573[ ]+csrr[ ]+a0,mstateen3h
+[ ]+[0-9a-f]+:[ ]+31f59073[ ]+csrw[ ]+mstateen3h,a1
+[ ]+[0-9a-f]+:[ ]+61c02573[ ]+csrr[ ]+a0,hstateen0h
+[ ]+[0-9a-f]+:[ ]+61c59073[ ]+csrw[ ]+hstateen0h,a1
+[ ]+[0-9a-f]+:[ ]+61d02573[ ]+csrr[ ]+a0,hstateen1h
+[ ]+[0-9a-f]+:[ ]+61d59073[ ]+csrw[ ]+hstateen1h,a1
+[ ]+[0-9a-f]+:[ ]+61e02573[ ]+csrr[ ]+a0,hstateen2h
+[ ]+[0-9a-f]+:[ ]+61e59073[ ]+csrw[ ]+hstateen2h,a1
+[ ]+[0-9a-f]+:[ ]+61f02573[ ]+csrr[ ]+a0,hstateen3h
+[ ]+[0-9a-f]+:[ ]+61f59073[ ]+csrw[ ]+hstateen3h,a1
[ ]+[0-9a-f]+:[ ]+04302573[ ]+csrr[ ]+a0,ubadaddr
[ ]+[0-9a-f]+:[ ]+04359073[ ]+csrw[ ]+ubadaddr,a1
[ ]+[0-9a-f]+:[ ]+14302573[ ]+csrr[ ]+a0,sbadaddr
diff --git a/gas/testsuite/gas/riscv/csr-version-1p9p1.l b/gas/testsuite/gas/riscv/csr-version-1p9p1.l
index b431697..7376c7c 100644
--- a/gas/testsuite/gas/riscv/csr-version-1p9p1.l
+++ b/gas/testsuite/gas/riscv/csr-version-1p9p1.l
@@ -461,6 +461,78 @@
.*Warning: invalid CSR `vsip', needs `h' extension
.*Warning: invalid CSR `vsatp', needs `h' extension
.*Warning: invalid CSR `vsatp', needs `h' extension
+.*Warning: invalid CSR `mstateen0', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen0', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen1', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen1', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen2', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen2', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen3', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen3', needs `smstateen' extension
+.*Warning: invalid CSR `sstateen0', needs `smstateen' extension
+.*Warning: invalid CSR `sstateen0', needs `smstateen' extension
+.*Warning: invalid CSR `sstateen1', needs `smstateen' extension
+.*Warning: invalid CSR `sstateen1', needs `smstateen' extension
+.*Warning: invalid CSR `sstateen2', needs `smstateen' extension
+.*Warning: invalid CSR `sstateen2', needs `smstateen' extension
+.*Warning: invalid CSR `sstateen3', needs `smstateen' extension
+.*Warning: invalid CSR `sstateen3', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen0', needs `h' extension
+.*Warning: invalid CSR `hstateen0', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen0', needs `h' extension
+.*Warning: invalid CSR `hstateen0', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen1', needs `h' extension
+.*Warning: invalid CSR `hstateen1', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen1', needs `h' extension
+.*Warning: invalid CSR `hstateen1', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen2', needs `h' extension
+.*Warning: invalid CSR `hstateen2', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen2', needs `h' extension
+.*Warning: invalid CSR `hstateen2', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen3', needs `h' extension
+.*Warning: invalid CSR `hstateen3', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen3', needs `h' extension
+.*Warning: invalid CSR `hstateen3', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen0h', needs rv32i extension
+.*Warning: invalid CSR `mstateen0h', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen0h', needs rv32i extension
+.*Warning: invalid CSR `mstateen0h', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen1h', needs rv32i extension
+.*Warning: invalid CSR `mstateen1h', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen1h', needs rv32i extension
+.*Warning: invalid CSR `mstateen1h', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen2h', needs rv32i extension
+.*Warning: invalid CSR `mstateen2h', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen2h', needs rv32i extension
+.*Warning: invalid CSR `mstateen2h', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen3h', needs rv32i extension
+.*Warning: invalid CSR `mstateen3h', needs `smstateen' extension
+.*Warning: invalid CSR `mstateen3h', needs rv32i extension
+.*Warning: invalid CSR `mstateen3h', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen0h', needs rv32i extension
+.*Warning: invalid CSR `hstateen0h', needs `h' extension
+.*Warning: invalid CSR `hstateen0h', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen0h', needs rv32i extension
+.*Warning: invalid CSR `hstateen0h', needs `h' extension
+.*Warning: invalid CSR `hstateen0h', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen1h', needs rv32i extension
+.*Warning: invalid CSR `hstateen1h', needs `h' extension
+.*Warning: invalid CSR `hstateen1h', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen1h', needs rv32i extension
+.*Warning: invalid CSR `hstateen1h', needs `h' extension
+.*Warning: invalid CSR `hstateen1h', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen2h', needs rv32i extension
+.*Warning: invalid CSR `hstateen2h', needs `h' extension
+.*Warning: invalid CSR `hstateen2h', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen2h', needs rv32i extension
+.*Warning: invalid CSR `hstateen2h', needs `h' extension
+.*Warning: invalid CSR `hstateen2h', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen3h', needs rv32i extension
+.*Warning: invalid CSR `hstateen3h', needs `h' extension
+.*Warning: invalid CSR `hstateen3h', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen3h', needs rv32i extension
+.*Warning: invalid CSR `hstateen3h', needs `h' extension
+.*Warning: invalid CSR `hstateen3h', needs `smstateen' extension
.*Warning: invalid CSR `utval' for the privileged spec `1.9.1'
.*Warning: invalid CSR `utval' for the privileged spec `1.9.1'
.*Warning: invalid CSR `fflags', needs `f' extension
diff --git a/gas/testsuite/gas/riscv/csr.s b/gas/testsuite/gas/riscv/csr.s
index 0d0ec71..1a4a2be 100644
--- a/gas/testsuite/gas/riscv/csr.s
+++ b/gas/testsuite/gas/riscv/csr.s
@@ -337,6 +337,28 @@
csr vsip
csr vsatp
+ # Smstateen extension
+ csr mstateen0
+ csr mstateen1
+ csr mstateen2
+ csr mstateen3
+ csr sstateen0
+ csr sstateen1
+ csr sstateen2
+ csr sstateen3
+ csr hstateen0
+ csr hstateen1
+ csr hstateen2
+ csr hstateen3
+ csr mstateen0h
+ csr mstateen1h
+ csr mstateen2h
+ csr mstateen3h
+ csr hstateen0h
+ csr hstateen1h
+ csr hstateen2h
+ csr hstateen3h
+
# Supported in previous priv spec, but dropped now
csr ubadaddr # 0x043 in 1.9.1, but the value is utval since 1.10