aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJiawei <jiawei@iscas.ac.cn>2025-05-27 14:37:03 +0800
committerJiawei <jiawei@iscas.ac.cn>2025-06-04 14:37:53 +0800
commitf8251b4fce20f030fb133de1cadb06f95f01656e (patch)
treec425215edde18ce19be8250717b79a4a641d4b08
parent102b21f9ce7d7a30cdee7c729a152e95c96107ac (diff)
downloadgcc-f8251b4fce20f030fb133de1cadb06f95f01656e.zip
gcc-f8251b4fce20f030fb133de1cadb06f95f01656e.tar.gz
gcc-f8251b4fce20f030fb133de1cadb06f95f01656e.tar.bz2
RISC-V: Add Shlcofideleg extension.
This patch add the RISC-V Shlcofideleg extension. It supports delegating LCOFI interrupts(the count-overflow interrupts) to VS-mode.[1] [1] https://riscv.github.io/riscv-isa-manual/snapshot/privileged 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-shlocofideleg.c: New test. Signed-off-by: Jiawei <jiawei@iscas.ac.cn>
-rw-r--r--gcc/config/riscv/riscv-ext.def13
-rw-r--r--gcc/config/riscv/riscv-ext.opt2
-rw-r--r--gcc/doc/riscv-ext.texi4
-rw-r--r--gcc/testsuite/gcc.target/riscv/arch-shlocofideleg.c5
4 files changed, 24 insertions, 0 deletions
diff --git a/gcc/config/riscv/riscv-ext.def b/gcc/config/riscv/riscv-ext.def
index d0adc2b..2d052c1 100644
--- a/gcc/config/riscv/riscv-ext.def
+++ b/gcc/config/riscv/riscv-ext.def
@@ -1611,6 +1611,19 @@ DEFINE_RISCV_EXT(
/* EXTRA_EXTENSION_FLAGS */ 0)
DEFINE_RISCV_EXT(
+ /* NAME */ shlcofideleg,
+ /* UPPERCASE_NAME */ SHLCOFIDELEG,
+ /* FULL_NAME */ "Delegating LCOFI interrupts to VS-mode",
+ /* DESC */ "",
+ /* URL */ ,
+ /* DEP_EXTS */ ({"h"}),
+ /* SUPPORTED_VERSIONS */ ({{1, 0}}),
+ /* FLAG_GROUP */ sh,
+ /* BITMASK_GROUP_ID */ BITMASK_NOT_YET_ALLOCATED,
+ /* BITMASK_BIT_POSITION*/ BITMASK_NOT_YET_ALLOCATED,
+ /* EXTRA_EXTENSION_FLAGS */ 0)
+
+DEFINE_RISCV_EXT(
/* NAME */ shtvala,
/* UPPERCAE_NAME */ SHTVALA,
/* FULL_NAME */ "The htval register provides all needed values",
diff --git a/gcc/config/riscv/riscv-ext.opt b/gcc/config/riscv/riscv-ext.opt
index c0dcde6..e0314430f 100644
--- a/gcc/config/riscv/riscv-ext.opt
+++ b/gcc/config/riscv/riscv-ext.opt
@@ -325,6 +325,8 @@ Mask(SHCOUNTERENW) Var(riscv_sh_subext)
Mask(SHGATPA) Var(riscv_sh_subext)
+Mask(SHLCOFIDELEG) Var(riscv_sh_subext)
+
Mask(SHTVALA) Var(riscv_sh_subext)
Mask(SHVSTVALA) Var(riscv_sh_subext)
diff --git a/gcc/doc/riscv-ext.texi b/gcc/doc/riscv-ext.texi
index e64c0d6..e7e1f75 100644
--- a/gcc/doc/riscv-ext.texi
+++ b/gcc/doc/riscv-ext.texi
@@ -474,6 +474,10 @@
@tab 1.0
@tab SvNNx4 mode supported for all modes supported by satp
+@item shlcofideleg
+@tab 1.0
+@tab Delegating LCOFI interrupts to VS-mode
+
@item shtvala
@tab 1.0
@tab The htval register provides all needed values
diff --git a/gcc/testsuite/gcc.target/riscv/arch-shlocofideleg.c b/gcc/testsuite/gcc.target/riscv/arch-shlocofideleg.c
new file mode 100644
index 0000000..de9f9fc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/arch-shlocofideleg.c
@@ -0,0 +1,5 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64i_shlcofideleg -mabi=lp64" } */
+int foo()
+{
+}