]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
[PATCH] RISC-V: Add smcntrpmf extension.
authorDongyan Chen <chendongyan@isrc.iscas.ac.cn>
Mon, 2 Jun 2025 19:30:29 +0000 (13:30 -0600)
committerJeff Law <jlaw@ventanamicro.com>
Mon, 2 Jun 2025 19:30:29 +0000 (13:30 -0600)
This patch support smcntrpmf extension[1].
To enable GCC to recognize and process smcntrpmf extension correctly at compile time.

[1]https://github.com/riscvarchive/riscv-smcntrpmf

gcc/ChangeLog:

* config/riscv/riscv-ext.def: New extension defs.
* config/riscv/riscv-ext.opt: Ditto.
* doc/riscv-ext.texi: Ditto.

gcc/testsuite/ChangeLog:

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

gcc/config/riscv/riscv-ext.def
gcc/config/riscv/riscv-ext.opt
gcc/doc/riscv-ext.texi
gcc/testsuite/gcc.target/riscv/arch-59.c [new file with mode: 0644]

index dbda8ded39747369b4d4b55310fb13be2f0837d7..d0adc2b6569bebd6df2f49871da41937604154ee 100644 (file)
@@ -1675,6 +1675,19 @@ DEFINE_RISCV_EXT(
   /* BITMASK_BIT_POSITION*/ BITMASK_NOT_YET_ALLOCATED,
   /* EXTRA_EXTENSION_FLAGS */ 0)
 
+DEFINE_RISCV_EXT(
+  /* NAME */ smcntrpmf,
+  /* UPPERCAE_NAME */ SMCNTRPMF,
+  /* FULL_NAME */ "Cycle and instret privilege mode filtering",
+  /* DESC */ "",
+  /* URL */ ,
+  /* DEP_EXTS */ ({"zicsr"}),
+  /* SUPPORTED_VERSIONS */ ({{1, 0}}),
+  /* FLAG_GROUP */ sm,
+  /* BITMASK_GROUP_ID */ BITMASK_NOT_YET_ALLOCATED,
+  /* BITMASK_BIT_POSITION*/ BITMASK_NOT_YET_ALLOCATED,
+  /* EXTRA_EXTENSION_FLAGS */ 0)
+
 DEFINE_RISCV_EXT(
   /* NAME */ smepmp,
   /* UPPERCAE_NAME */ SMEPMP,
index 5e9c5f56ad672f59c962c5bc6e9ded5b5ffd413f..c0dcde6529308cad79353c474e44785d22e695ab 100644 (file)
@@ -335,6 +335,8 @@ Mask(SHVSATPA) Var(riscv_sh_subext)
 
 Mask(SMAIA) Var(riscv_sm_subext)
 
+Mask(SMCNTRPMF) Var(riscv_sm_subext)
+
 Mask(SMEPMP) Var(riscv_sm_subext)
 
 Mask(SMMPM) Var(riscv_sm_subext)
index 7a22d841d1b6277d594249d7b1870a971ec6c467..e64c0d653a9f28eba2bfc2b6a7af2ad75d8bc219 100644 (file)
 @tab 1.0
 @tab Advanced interrupt architecture extension
 
+@item smcntrpmf
+@tab 1.0
+@tab Cycle and instret privilege mode filtering
+
 @item smepmp
 @tab 1.0
 @tab PMP Enhancements for memory access and execution prevention on Machine mode
diff --git a/gcc/testsuite/gcc.target/riscv/arch-59.c b/gcc/testsuite/gcc.target/riscv/arch-59.c
new file mode 100644 (file)
index 0000000..511cf22
--- /dev/null
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64i_smcntrpmf -mabi=lp64" } */
+int foo()
+{
+}