aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--bfd/elfxx-riscv.c1
-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
-rw-r--r--include/opcode/riscv-opc.h42
14 files changed, 568 insertions, 0 deletions
diff --git a/bfd/elfxx-riscv.c b/bfd/elfxx-riscv.c
index f920e0c..f72b827 100644
--- a/bfd/elfxx-riscv.c
+++ b/bfd/elfxx-riscv.c
@@ -1231,6 +1231,7 @@ static struct riscv_supported_ext riscv_supported_std_z_ext[] =
static struct riscv_supported_ext riscv_supported_std_s_ext[] =
{
+ {"smstateen", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
{"svinval", ISA_SPEC_CLASS_DRAFT, 1, 0, 0 },
{NULL, 0, 0, 0, 0}
};
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
diff --git a/include/opcode/riscv-opc.h b/include/opcode/riscv-opc.h
index 207215b..97a37ba 100644
--- a/include/opcode/riscv-opc.h
+++ b/include/opcode/riscv-opc.h
@@ -2432,6 +2432,27 @@
#define CSR_UIP 0x44
#define CSR_SEDELEG 0x102
#define CSR_SIDELEG 0x103
+/* Smstateen extension */
+#define CSR_MSTATEEN0 0x30c
+#define CSR_MSTATEEN1 0x30d
+#define CSR_MSTATEEN2 0x30e
+#define CSR_MSTATEEN3 0x30f
+#define CSR_SSTATEEN0 0x10c
+#define CSR_SSTATEEN1 0x10d
+#define CSR_SSTATEEN2 0x10e
+#define CSR_SSTATEEN3 0x10f
+#define CSR_HSTATEEN0 0x60c
+#define CSR_HSTATEEN1 0x60d
+#define CSR_HSTATEEN2 0x60e
+#define CSR_HSTATEEN3 0x60f
+#define CSR_MSTATEEN0H 0x31c
+#define CSR_MSTATEEN1H 0x31d
+#define CSR_MSTATEEN2H 0x31e
+#define CSR_MSTATEEN3H 0x31f
+#define CSR_HSTATEEN0H 0x61c
+#define CSR_HSTATEEN1H 0x61d
+#define CSR_HSTATEEN2H 0x61e
+#define CSR_HSTATEEN3H 0x61f
/* Unprivileged Floating-Point CSR addresses. */
#define CSR_FFLAGS 0x1
#define CSR_FRM 0x2
@@ -3097,6 +3118,27 @@ DECLARE_CSR(vscause, CSR_VSCAUSE, CSR_CLASS_H, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_C
DECLARE_CSR(vstval, CSR_VSTVAL, CSR_CLASS_H, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
DECLARE_CSR(vsip, CSR_VSIP, CSR_CLASS_H, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
DECLARE_CSR(vsatp, CSR_VSATP, CSR_CLASS_H, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+/* Smstateen extension */
+DECLARE_CSR(mstateen0, CSR_MSTATEEN0, CSR_CLASS_SMSTATEEN, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(mstateen1, CSR_MSTATEEN1, CSR_CLASS_SMSTATEEN, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(mstateen2, CSR_MSTATEEN2, CSR_CLASS_SMSTATEEN, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(mstateen3, CSR_MSTATEEN3, CSR_CLASS_SMSTATEEN, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(sstateen0, CSR_SSTATEEN0, CSR_CLASS_SMSTATEEN, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(sstateen1, CSR_SSTATEEN1, CSR_CLASS_SMSTATEEN, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(sstateen2, CSR_SSTATEEN2, CSR_CLASS_SMSTATEEN, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(sstateen3, CSR_SSTATEEN3, CSR_CLASS_SMSTATEEN, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hstateen0, CSR_HSTATEEN0, CSR_CLASS_SMSTATEEN_AND_H, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hstateen1, CSR_HSTATEEN1, CSR_CLASS_SMSTATEEN_AND_H, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hstateen2, CSR_HSTATEEN2, CSR_CLASS_SMSTATEEN_AND_H, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hstateen3, CSR_HSTATEEN3, CSR_CLASS_SMSTATEEN_AND_H, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(mstateen0h, CSR_MSTATEEN0H, CSR_CLASS_SMSTATEEN_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(mstateen1h, CSR_MSTATEEN1H, CSR_CLASS_SMSTATEEN_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(mstateen2h, CSR_MSTATEEN2H, CSR_CLASS_SMSTATEEN_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(mstateen3h, CSR_MSTATEEN3H, CSR_CLASS_SMSTATEEN_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hstateen0h, CSR_HSTATEEN0H, CSR_CLASS_SMSTATEEN_AND_H_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hstateen1h, CSR_HSTATEEN1H, CSR_CLASS_SMSTATEEN_AND_H_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hstateen2h, CSR_HSTATEEN2H, CSR_CLASS_SMSTATEEN_AND_H_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hstateen3h, CSR_HSTATEEN3H, CSR_CLASS_SMSTATEEN_AND_H_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
/* Dropped CSRs. */
DECLARE_CSR(mbase, CSR_MBASE, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_1P10)
DECLARE_CSR(mbound, CSR_MBOUND, CSR_CLASS_I, PRIV_SPEC_CLASS_1P9P1, PRIV_SPEC_CLASS_1P10)