RISC-V: Add 'Ssstateen' extension and its CSRs
authorTsukasa OI <research_trasio@irq.a4lg.com>
Mon, 24 Oct 2022 10:08:15 +0000 (10:08 +0000)
committerTsukasa OI <research_trasio@irq.a4lg.com>
Sat, 19 Nov 2022 02:57:05 +0000 (02:57 +0000)
This commit adds 'Ssstateen' extension, which is a supervisor-visible view
of the 'Smstateen' extension.  It means, this extension implements sstateen*
and hstateen* CSRs of the 'Smstateen' extension.

Note that 'Smstateen' extension itself is unchanged but due to
implementation simplicity, it is implemented so that 'Smstateen' implies
'Ssstateen' (just like 'M' implies 'Zmmul').

This is based on the latest version of RISC-V Profiles
(version 0.9-draft, Frozen):
<https://github.com/riscv/riscv-profiles/commit/226b7f643067b29abc6723fac60d5f6d3f9eb901>

bfd/ChangeLog:

* elfxx-riscv.c (riscv_implicit_subsets): Update implication rules.
(riscv_supported_std_s_ext) Add 'Ssstateen' extension.

gas/ChangeLog:

* config/tc-riscv.c (enum riscv_csr_class): Rename
CSR_CLASS_SMSTATEEN_AND_H{,_32} to CSR_CLASS_SSSTATEEN_...
Add CSR_CLASS_SSSTATEEN.
(riscv_csr_address): Support new/renamed CSR classes.
* testsuite/gas/riscv/csr.s: Add 'Ssstateen' extension to comment.
* testsuite/gas/riscv/csr-version-1p9p1.l: Reflect changes to
error messages.
* testsuite/gas/riscv/csr-version-1p10.l: Likewise.
* testsuite/gas/riscv/csr-version-1p11.l: Likewise.
* testsuite/gas/riscv/csr-version-1p12.l: Likewise.
* testsuite/gas/riscv/ssstateen-csr.s: Test for 'Ssstateen' CSRs.
* testsuite/gas/riscv/ssstateen-csr.d: Likewise.
* testsuite/gas/riscv/smstateen-csr-s.d: Test to make sure that
supervisor/hypervisor part of 'Smstateen' CSRs are accessible from
'RV32IH_Smstateen', not just from 'RV32IH_Ssstateen' that is tested
in ssstateen-csr.d.

include/ChangeLog:

* opcode/riscv-opc.h: Update DECLARE_CSR declarations with
new CSR classes.

bfd/elfxx-riscv.c
gas/config/tc-riscv.c
gas/testsuite/gas/riscv/csr-version-1p10.l
gas/testsuite/gas/riscv/csr-version-1p11.l
gas/testsuite/gas/riscv/csr-version-1p12.l
gas/testsuite/gas/riscv/csr-version-1p9p1.l
gas/testsuite/gas/riscv/csr.s
gas/testsuite/gas/riscv/smstateen-csr-s.d [new file with mode: 0644]
gas/testsuite/gas/riscv/ssstateen-csr.d [new file with mode: 0644]
gas/testsuite/gas/riscv/ssstateen-csr.s [new file with mode: 0644]
include/opcode/riscv-opc.h

index cfec9a6996c92e088016180716e9096be62ea9bc..afbde56b9e549f4bfc6cf834016e22bc2398239d 100644 (file)
@@ -1097,9 +1097,10 @@ static struct riscv_implicit_subset riscv_implicit_subsets[] =
   {"zks", "zbkx",      check_implicit_always},
   {"zks", "zksed",     check_implicit_always},
   {"zks", "zksh",      check_implicit_always},
+  {"smstateen", "ssstateen",   check_implicit_always},
   {"smepmp", "zicsr",          check_implicit_always},
-  {"smstateen", "zicsr",       check_implicit_always},
   {"sscofpmf", "zicsr",                check_implicit_always},
+  {"ssstateen", "zicsr",       check_implicit_always},
   {"sstc", "zicsr",            check_implicit_always},
   {NULL, NULL, NULL}
 };
@@ -1219,6 +1220,7 @@ static struct riscv_supported_ext riscv_supported_std_s_ext[] =
   {"smepmp",           ISA_SPEC_CLASS_DRAFT,           1, 0, 0 },
   {"smstateen",                ISA_SPEC_CLASS_DRAFT,           1, 0, 0 },
   {"sscofpmf",         ISA_SPEC_CLASS_DRAFT,           1, 0, 0 },
+  {"ssstateen",                ISA_SPEC_CLASS_DRAFT,           1, 0, 0 },
   {"sstc",             ISA_SPEC_CLASS_DRAFT,           1, 0, 0 },
   {"svinval",          ISA_SPEC_CLASS_DRAFT,           1, 0, 0 },
   {"svnapot",          ISA_SPEC_CLASS_DRAFT,           1, 0, 0 },
index 2dc92ecd3c36083ad5c57033a837eabf93dcdf2c..019545171f5eb4728ed6307c0f1539f516b4d8aa 100644 (file)
@@ -69,9 +69,10 @@ enum riscv_csr_class
   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) */
+  CSR_CLASS_SSSTATEEN,         /* S[ms]stateen only */
+  CSR_CLASS_SSSTATEEN_AND_H,   /* S[ms]stateen only (with H) */
+  CSR_CLASS_SSSTATEEN_AND_H_32,        /* S[ms]stateen RV32 only (with H) */
   CSR_CLASS_SSCOFPMF,          /* Sscofpmf only */
   CSR_CLASS_SSCOFPMF_32,       /* Sscofpmf RV32 only */
   CSR_CLASS_SSTC,              /* Sstc only */
@@ -1029,15 +1030,18 @@ riscv_csr_address (const char *csr_name,
       extension = "zve32x";
       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);
+      is_rv32_only = (csr_class == CSR_CLASS_SMSTATEEN_32);
       extension = "smstateen";
       break;
+    case CSR_CLASS_SSSTATEEN:
+    case CSR_CLASS_SSSTATEEN_AND_H:
+    case CSR_CLASS_SSSTATEEN_AND_H_32:
+      is_rv32_only = (csr_class == CSR_CLASS_SSSTATEEN_AND_H_32);
+      is_h_required = (csr_class == CSR_CLASS_SSSTATEEN_AND_H
+                     || csr_class == CSR_CLASS_SSSTATEEN_AND_H_32);
+      extension = "ssstateen";
+      break;
     case CSR_CLASS_SSCOFPMF_32:
       is_rv32_only = true;
       /* Fall through.  */
index 999e9af1520b1507969ed27dd139c7e4c8b6ffa8..03af32d3beffd72c468935a4a06f705c169fb2c7 100644 (file)
 .*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 `sstateen0', needs `ssstateen' extension
+.*Warning: invalid CSR `sstateen0', needs `ssstateen' extension
+.*Warning: invalid CSR `sstateen1', needs `ssstateen' extension
+.*Warning: invalid CSR `sstateen1', needs `ssstateen' extension
+.*Warning: invalid CSR `sstateen2', needs `ssstateen' extension
+.*Warning: invalid CSR `sstateen2', needs `ssstateen' extension
+.*Warning: invalid CSR `sstateen3', needs `ssstateen' extension
+.*Warning: invalid CSR `sstateen3', needs `ssstateen' extension
 .*Warning: invalid CSR `hstateen0', needs `h' extension
-.*Warning: invalid CSR `hstateen0', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen0', needs `ssstateen' extension
 .*Warning: invalid CSR `hstateen0', needs `h' extension
-.*Warning: invalid CSR `hstateen0', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen0', needs `ssstateen' extension
 .*Warning: invalid CSR `hstateen1', needs `h' extension
-.*Warning: invalid CSR `hstateen1', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen1', needs `ssstateen' extension
 .*Warning: invalid CSR `hstateen1', needs `h' extension
-.*Warning: invalid CSR `hstateen1', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen1', needs `ssstateen' extension
 .*Warning: invalid CSR `hstateen2', needs `h' extension
-.*Warning: invalid CSR `hstateen2', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen2', needs `ssstateen' extension
 .*Warning: invalid CSR `hstateen2', needs `h' extension
-.*Warning: invalid CSR `hstateen2', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen2', needs `ssstateen' extension
 .*Warning: invalid CSR `hstateen3', needs `h' extension
-.*Warning: invalid CSR `hstateen3', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen3', needs `ssstateen' extension
 .*Warning: invalid CSR `hstateen3', needs `h' extension
-.*Warning: invalid CSR `hstateen3', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen3', needs `ssstateen' 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 `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 `ssstateen' 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 `ssstateen' 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 `ssstateen' 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 `ssstateen' 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 `ssstateen' 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 `ssstateen' 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 `ssstateen' 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 `ssstateen' extension
 .*Warning: invalid CSR `scountovf', needs `sscofpmf' extension
 .*Warning: invalid CSR `scountovf', needs `sscofpmf' extension
 .*Warning: read-only CSR is written `csrw scountovf,a1'
index a099e4ecc937ccdcd7e0d24ed3d19f536d2aa025..0766c2263ec8855030bd2a7d8ca1e722064bc941 100644 (file)
 .*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 `sstateen0', needs `ssstateen' extension
+.*Warning: invalid CSR `sstateen0', needs `ssstateen' extension
+.*Warning: invalid CSR `sstateen1', needs `ssstateen' extension
+.*Warning: invalid CSR `sstateen1', needs `ssstateen' extension
+.*Warning: invalid CSR `sstateen2', needs `ssstateen' extension
+.*Warning: invalid CSR `sstateen2', needs `ssstateen' extension
+.*Warning: invalid CSR `sstateen3', needs `ssstateen' extension
+.*Warning: invalid CSR `sstateen3', needs `ssstateen' extension
 .*Warning: invalid CSR `hstateen0', needs `h' extension
-.*Warning: invalid CSR `hstateen0', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen0', needs `ssstateen' extension
 .*Warning: invalid CSR `hstateen0', needs `h' extension
-.*Warning: invalid CSR `hstateen0', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen0', needs `ssstateen' extension
 .*Warning: invalid CSR `hstateen1', needs `h' extension
-.*Warning: invalid CSR `hstateen1', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen1', needs `ssstateen' extension
 .*Warning: invalid CSR `hstateen1', needs `h' extension
-.*Warning: invalid CSR `hstateen1', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen1', needs `ssstateen' extension
 .*Warning: invalid CSR `hstateen2', needs `h' extension
-.*Warning: invalid CSR `hstateen2', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen2', needs `ssstateen' extension
 .*Warning: invalid CSR `hstateen2', needs `h' extension
-.*Warning: invalid CSR `hstateen2', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen2', needs `ssstateen' extension
 .*Warning: invalid CSR `hstateen3', needs `h' extension
-.*Warning: invalid CSR `hstateen3', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen3', needs `ssstateen' extension
 .*Warning: invalid CSR `hstateen3', needs `h' extension
-.*Warning: invalid CSR `hstateen3', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen3', needs `ssstateen' 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 `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 `ssstateen' 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 `ssstateen' 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 `ssstateen' 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 `ssstateen' 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 `ssstateen' 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 `ssstateen' 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 `ssstateen' 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 `ssstateen' extension
 .*Warning: invalid CSR `scountovf', needs `sscofpmf' extension
 .*Warning: invalid CSR `scountovf', needs `sscofpmf' extension
 .*Warning: read-only CSR is written `csrw scountovf,a1'
index cf8f2e25634fe9d04e947bafc30158d5c904a4bf..c13efcc66814ab5ddcf30bee66dff16809b209d6 100644 (file)
 .*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 `sstateen0', needs `ssstateen' extension
+.*Warning: invalid CSR `sstateen0', needs `ssstateen' extension
+.*Warning: invalid CSR `sstateen1', needs `ssstateen' extension
+.*Warning: invalid CSR `sstateen1', needs `ssstateen' extension
+.*Warning: invalid CSR `sstateen2', needs `ssstateen' extension
+.*Warning: invalid CSR `sstateen2', needs `ssstateen' extension
+.*Warning: invalid CSR `sstateen3', needs `ssstateen' extension
+.*Warning: invalid CSR `sstateen3', needs `ssstateen' extension
 .*Warning: invalid CSR `hstateen0', needs `h' extension
-.*Warning: invalid CSR `hstateen0', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen0', needs `ssstateen' extension
 .*Warning: invalid CSR `hstateen0', needs `h' extension
-.*Warning: invalid CSR `hstateen0', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen0', needs `ssstateen' extension
 .*Warning: invalid CSR `hstateen1', needs `h' extension
-.*Warning: invalid CSR `hstateen1', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen1', needs `ssstateen' extension
 .*Warning: invalid CSR `hstateen1', needs `h' extension
-.*Warning: invalid CSR `hstateen1', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen1', needs `ssstateen' extension
 .*Warning: invalid CSR `hstateen2', needs `h' extension
-.*Warning: invalid CSR `hstateen2', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen2', needs `ssstateen' extension
 .*Warning: invalid CSR `hstateen2', needs `h' extension
-.*Warning: invalid CSR `hstateen2', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen2', needs `ssstateen' extension
 .*Warning: invalid CSR `hstateen3', needs `h' extension
-.*Warning: invalid CSR `hstateen3', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen3', needs `ssstateen' extension
 .*Warning: invalid CSR `hstateen3', needs `h' extension
-.*Warning: invalid CSR `hstateen3', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen3', needs `ssstateen' 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 `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 `ssstateen' 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 `ssstateen' 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 `ssstateen' 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 `ssstateen' 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 `ssstateen' 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 `ssstateen' 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 `ssstateen' 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 `ssstateen' extension
 .*Warning: invalid CSR `scountovf', needs `sscofpmf' extension
 .*Warning: invalid CSR `scountovf', needs `sscofpmf' extension
 .*Warning: read-only CSR is written `csrw scountovf,a1'
index 5f298c1dda96f3cbe1ddffc3580ff24c99d116da..bc35630abd0de0c16fa8a277aff9fe8ea0d94021 100644 (file)
 .*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 `sstateen0', needs `ssstateen' extension
+.*Warning: invalid CSR `sstateen0', needs `ssstateen' extension
+.*Warning: invalid CSR `sstateen1', needs `ssstateen' extension
+.*Warning: invalid CSR `sstateen1', needs `ssstateen' extension
+.*Warning: invalid CSR `sstateen2', needs `ssstateen' extension
+.*Warning: invalid CSR `sstateen2', needs `ssstateen' extension
+.*Warning: invalid CSR `sstateen3', needs `ssstateen' extension
+.*Warning: invalid CSR `sstateen3', needs `ssstateen' extension
 .*Warning: invalid CSR `hstateen0', needs `h' extension
-.*Warning: invalid CSR `hstateen0', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen0', needs `ssstateen' extension
 .*Warning: invalid CSR `hstateen0', needs `h' extension
-.*Warning: invalid CSR `hstateen0', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen0', needs `ssstateen' extension
 .*Warning: invalid CSR `hstateen1', needs `h' extension
-.*Warning: invalid CSR `hstateen1', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen1', needs `ssstateen' extension
 .*Warning: invalid CSR `hstateen1', needs `h' extension
-.*Warning: invalid CSR `hstateen1', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen1', needs `ssstateen' extension
 .*Warning: invalid CSR `hstateen2', needs `h' extension
-.*Warning: invalid CSR `hstateen2', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen2', needs `ssstateen' extension
 .*Warning: invalid CSR `hstateen2', needs `h' extension
-.*Warning: invalid CSR `hstateen2', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen2', needs `ssstateen' extension
 .*Warning: invalid CSR `hstateen3', needs `h' extension
-.*Warning: invalid CSR `hstateen3', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen3', needs `ssstateen' extension
 .*Warning: invalid CSR `hstateen3', needs `h' extension
-.*Warning: invalid CSR `hstateen3', needs `smstateen' extension
+.*Warning: invalid CSR `hstateen3', needs `ssstateen' 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 `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 `ssstateen' 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 `ssstateen' 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 `ssstateen' 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 `ssstateen' 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 `ssstateen' 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 `ssstateen' 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 `ssstateen' 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 `ssstateen' extension
 .*Warning: invalid CSR `scountovf', needs `sscofpmf' extension
 .*Warning: invalid CSR `scountovf', needs `sscofpmf' extension
 .*Warning: read-only CSR is written `csrw scountovf,a1'
index 128aeb83a04df448ea2cdd303a6bd7c4ac19bfa7..397fe0b9eb8b1304690f96e8479be91dc45f6541 100644 (file)
        csr vsip
        csr vsatp
 
-       # Smstateen extension
+       # Smstateen/Ssstateen extensions
        csr mstateen0
        csr mstateen1
        csr mstateen2
diff --git a/gas/testsuite/gas/riscv/smstateen-csr-s.d b/gas/testsuite/gas/riscv/smstateen-csr-s.d
new file mode 100644 (file)
index 0000000..44b6dd6
--- /dev/null
@@ -0,0 +1,22 @@
+#as: -march=rv32ih_smstateen -mcsr-check -mpriv-spec=1.12
+#source: ssstateen-csr.s
+#objdump: -dr
+
+.*:[   ]+file format .*
+
+
+Disassembly of section .text:
+
+0+000 <target>:
+[      ]+[0-9a-f]+:[   ]+10c02573[     ]+csrr[         ]+a0,sstateen0
+[      ]+[0-9a-f]+:[   ]+10d02573[     ]+csrr[         ]+a0,sstateen1
+[      ]+[0-9a-f]+:[   ]+10e02573[     ]+csrr[         ]+a0,sstateen2
+[      ]+[0-9a-f]+:[   ]+10f02573[     ]+csrr[         ]+a0,sstateen3
+[      ]+[0-9a-f]+:[   ]+60c02573[     ]+csrr[         ]+a0,hstateen0
+[      ]+[0-9a-f]+:[   ]+60d02573[     ]+csrr[         ]+a0,hstateen1
+[      ]+[0-9a-f]+:[   ]+60e02573[     ]+csrr[         ]+a0,hstateen2
+[      ]+[0-9a-f]+:[   ]+60f02573[     ]+csrr[         ]+a0,hstateen3
+[      ]+[0-9a-f]+:[   ]+61c02573[     ]+csrr[         ]+a0,hstateen0h
+[      ]+[0-9a-f]+:[   ]+61d02573[     ]+csrr[         ]+a0,hstateen1h
+[      ]+[0-9a-f]+:[   ]+61e02573[     ]+csrr[         ]+a0,hstateen2h
+[      ]+[0-9a-f]+:[   ]+61f02573[     ]+csrr[         ]+a0,hstateen3h
diff --git a/gas/testsuite/gas/riscv/ssstateen-csr.d b/gas/testsuite/gas/riscv/ssstateen-csr.d
new file mode 100644 (file)
index 0000000..29b286a
--- /dev/null
@@ -0,0 +1,22 @@
+#as: -march=rv32ih_ssstateen -mcsr-check -mpriv-spec=1.12
+#source: ssstateen-csr.s
+#objdump: -dr
+
+.*:[   ]+file format .*
+
+
+Disassembly of section .text:
+
+0+000 <target>:
+[      ]+[0-9a-f]+:[   ]+10c02573[     ]+csrr[         ]+a0,sstateen0
+[      ]+[0-9a-f]+:[   ]+10d02573[     ]+csrr[         ]+a0,sstateen1
+[      ]+[0-9a-f]+:[   ]+10e02573[     ]+csrr[         ]+a0,sstateen2
+[      ]+[0-9a-f]+:[   ]+10f02573[     ]+csrr[         ]+a0,sstateen3
+[      ]+[0-9a-f]+:[   ]+60c02573[     ]+csrr[         ]+a0,hstateen0
+[      ]+[0-9a-f]+:[   ]+60d02573[     ]+csrr[         ]+a0,hstateen1
+[      ]+[0-9a-f]+:[   ]+60e02573[     ]+csrr[         ]+a0,hstateen2
+[      ]+[0-9a-f]+:[   ]+60f02573[     ]+csrr[         ]+a0,hstateen3
+[      ]+[0-9a-f]+:[   ]+61c02573[     ]+csrr[         ]+a0,hstateen0h
+[      ]+[0-9a-f]+:[   ]+61d02573[     ]+csrr[         ]+a0,hstateen1h
+[      ]+[0-9a-f]+:[   ]+61e02573[     ]+csrr[         ]+a0,hstateen2h
+[      ]+[0-9a-f]+:[   ]+61f02573[     ]+csrr[         ]+a0,hstateen3h
diff --git a/gas/testsuite/gas/riscv/ssstateen-csr.s b/gas/testsuite/gas/riscv/ssstateen-csr.s
new file mode 100644 (file)
index 0000000..82707a4
--- /dev/null
@@ -0,0 +1,13 @@
+target:
+       csrr    a0, sstateen0
+       csrr    a0, sstateen1
+       csrr    a0, sstateen2
+       csrr    a0, sstateen3
+       csrr    a0, hstateen0
+       csrr    a0, hstateen1
+       csrr    a0, hstateen2
+       csrr    a0, hstateen3
+       csrr    a0, hstateen0h
+       csrr    a0, hstateen1h
+       csrr    a0, hstateen2h
+       csrr    a0, hstateen3h
index f36b06dcd6bd4363d2dc9dd198218c7bd3ad4f9c..cdc0919dfe249a390ea31a83a33ee8b652497138 100644 (file)
@@ -3504,27 +3504,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 */
+/* Smstateen/Ssstateen extensions.  */
 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(sstateen0, CSR_SSTATEEN0, CSR_CLASS_SSSTATEEN, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(sstateen1, CSR_SSTATEEN1, CSR_CLASS_SSSTATEEN, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(sstateen2, CSR_SSTATEEN2, CSR_CLASS_SSSTATEEN, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(sstateen3, CSR_SSTATEEN3, CSR_CLASS_SSSTATEEN, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hstateen0, CSR_HSTATEEN0, CSR_CLASS_SSSTATEEN_AND_H, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hstateen1, CSR_HSTATEEN1, CSR_CLASS_SSSTATEEN_AND_H, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hstateen2, CSR_HSTATEEN2, CSR_CLASS_SSSTATEEN_AND_H, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hstateen3, CSR_HSTATEEN3, CSR_CLASS_SSSTATEEN_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)
+DECLARE_CSR(hstateen0h, CSR_HSTATEEN0H, CSR_CLASS_SSSTATEEN_AND_H_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hstateen1h, CSR_HSTATEEN1H, CSR_CLASS_SSSTATEEN_AND_H_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hstateen2h, CSR_HSTATEEN2H, CSR_CLASS_SSSTATEEN_AND_H_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
+DECLARE_CSR(hstateen3h, CSR_HSTATEEN3H, CSR_CLASS_SSSTATEEN_AND_H_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
 /* Sscofpmf extension */
 DECLARE_CSR(scountovf, CSR_SCOUNTOVF, CSR_CLASS_SSCOFPMF, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)
 DECLARE_CSR(mhpmevent3h, CSR_MHPMEVENT3H, CSR_CLASS_SSCOFPMF_32, PRIV_SPEC_CLASS_NONE, PRIV_SPEC_CLASS_NONE)