]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
RISC-V: Support Sscounterenw extension.
authorJiawei <jiawei@iscas.ac.cn>
Thu, 5 Jun 2025 05:33:21 +0000 (13:33 +0800)
committerJiawei <jiawei@iscas.ac.cn>
Thu, 5 Jun 2025 11:33:20 +0000 (19:33 +0800)
Support the Sscounterenw extension, which allows writeable enables for any
supported counter.

gcc/ChangeLog:

* config/riscv/riscv-ext.def: New extension definition.
* config/riscv/riscv-ext.opt: New extension mask.
* doc/riscv-ext.texi: Document the new extension.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/arch-sscounterenw.c: New test.

Signed-off-by: Jiawei <jiawei@iscas.ac.cn>
gcc/config/riscv/riscv-ext.def
gcc/config/riscv/riscv-ext.opt
gcc/doc/riscv-ext.texi
gcc/testsuite/gcc.target/riscv/arch-sscounterenw.c [new file with mode: 0644]

index ec0a08c3282c68ec51ee0aa35a521723590e0273..dab8cb8d69d6288423eb0da807e6c86dc0870819 100644 (file)
@@ -1831,6 +1831,19 @@ DEFINE_RISCV_EXT(
   /* BITMASK_BIT_POSITION*/ BITMASK_NOT_YET_ALLOCATED,
   /* EXTRA_EXTENSION_FLAGS */ 0)
 
+DEFINE_RISCV_EXT(
+  /* NAME */ sscounterenw,
+  /* UPPERCASE_NAME */ SSCOUNTERENW,
+  /* FULL_NAME */ "Support writeable enables for any supported counter",
+  /* DESC */ "",
+  /* URL */ ,
+  /* DEP_EXTS */ ({"zicsr"}),
+  /* SUPPORTED_VERSIONS */ ({{1, 0}}),
+  /* FLAG_GROUP */ ss,
+  /* BITMASK_GROUP_ID */ BITMASK_NOT_YET_ALLOCATED,
+  /* BITMASK_BIT_POSITION*/ BITMASK_NOT_YET_ALLOCATED,
+  /* EXTRA_EXTENSION_FLAGS */ 0)
+
 DEFINE_RISCV_EXT(
   /* NAME */ sscsrind,
   /* UPPERCASE_NAME */ SSCSRIND,
index f851678236bdab10a5f6d2889a3ecc00e10c8836..ad9e1d68069c7d45cfd46c341a143b5c23c839f8 100644 (file)
@@ -359,6 +359,8 @@ Mask(SSCCPTR) Var(riscv_ss_subext)
 
 Mask(SSCOFPMF) Var(riscv_ss_subext)
 
+Mask(SSCOUNTERENW) Var(riscv_ss_subext)
+
 Mask(SSCSRIND) Var(riscv_ss_subext)
 
 Mask(SSNPM) Var(riscv_ss_subext)
index 83aa436b46658a73875c4ae859cd64ab64a9f797..2b23366607d588895be27faac6578b473dcec598 100644 (file)
 @tab 1.0
 @tab Count overflow & filtering extension
 
+@item sscounterenw
+@tab 1.0
+@tab Support writeable enables for any supported counter
+
 @item sscsrind
 @tab 1.0
 @tab Supervisor-Level Indirect CSR Access
diff --git a/gcc/testsuite/gcc.target/riscv/arch-sscounterenw.c b/gcc/testsuite/gcc.target/riscv/arch-sscounterenw.c
new file mode 100644 (file)
index 0000000..901b6bc
--- /dev/null
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64i_sscounterenw -mabi=lp64" } */
+int foo()
+{
+}