]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
RISC-V: Add minimal Svrsw60t59b extension support
authorJiawei <jiawei@iscas.ac.cn>
Wed, 24 Jun 2026 13:47:24 +0000 (21:47 +0800)
committerJiawei <jiawei@iscas.ac.cn>
Sun, 19 Jul 2026 14:58:36 +0000 (22:58 +0800)
This adds minimal support for the Svrsw60t59b[1] (Page-table reserved-for-
software bits 60-59) extension, and it will be a new part of RVA23.1[2].

[1] https://github.com/riscv/riscv-isa-manual/blob/main/src/priv/svrsw60t59b.adoc
[2] https://github.com/riscv/riscv-isa-manual/pull/3170

gcc/ChangeLog:

* config/riscv/riscv-ext.def (svrsw60t59b): Add new extension.
* config/riscv/riscv-ext.opt: Ditto.
* doc/riscv-ext.texi: Ditto.

gcc/testsuite/ChangeLog:

* gcc.target/riscv/svrsw60t59b-version.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/svrsw60t59b-version.c [new file with mode: 0644]

index a70d0abe343e144c4bc4e092e609c0649d579335..eeee99da77e2737e48354fe29115aab741b51736 100644 (file)
@@ -2159,6 +2159,19 @@ DEFINE_RISCV_EXT(
   /* BITMASK_BIT_POSITION*/ BITMASK_NOT_YET_ALLOCATED,
   /* EXTRA_EXTENSION_FLAGS */ 0)
 
+DEFINE_RISCV_EXT(
+  /* NAME */ svrsw60t59b,
+  /* UPPERCASE_NAME */ SVRSW60T59B,
+  /* FULL_NAME */ "Page-table reserved-for-software bits 60-59 extension",
+  /* DESC */ "",
+  /* URL */ ,
+  /* DEP_EXTS */ ({}),
+  /* SUPPORTED_VERSIONS */ ({{1, 0}}),
+  /* FLAG_GROUP */ sv,
+  /* BITMASK_GROUP_ID */ BITMASK_NOT_YET_ALLOCATED,
+  /* BITMASK_BIT_POSITION*/ BITMASK_NOT_YET_ALLOCATED,
+  /* EXTRA_EXTENSION_FLAGS */ 0)
+
 DEFINE_RISCV_EXT(
   /* NAME */ svvptc,
   /* UPPERCASE_NAME */ SVVPTC,
index 31b3a51a570e68d65ed5de3b59118565ba742e48..8cd7825522b30bdfa9a5401ce1bfee463bfae7b2 100644 (file)
@@ -421,6 +421,8 @@ Mask(SVNAPOT) Var(riscv_sv_subext)
 
 Mask(SVPBMT) Var(riscv_sv_subext)
 
+Mask(SVRSW60T59B) Var(riscv_sv_subext)
+
 Mask(SVVPTC) Var(riscv_sv_subext)
 
 Mask(SVADU) Var(riscv_sv_subext)
index 65b7c519715436d7023ded4f3356b5e9e09dc179..c3fc8c79118ebf573619eefe973e0252f6b2edf3 100644 (file)
 @tab 1.0
 @tab Page-based memory types extension
 
+@item @samp{svrsw60t59b}
+@tab 1.0
+@tab Page-table reserved-for-software bits 60-59 extension
+
 @item @samp{svvptc}
 @tab 1.0
 @tab Extension for obviating memory-management instructions after marking PTEs valid
diff --git a/gcc/testsuite/gcc.target/riscv/svrsw60t59b-version.c b/gcc/testsuite/gcc.target/riscv/svrsw60t59b-version.c
new file mode 100644 (file)
index 0000000..8d130fb
--- /dev/null
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-mriscv-attribute -march=rv64i_svrsw60t59b1p0 -mabi=lp64" { target { rv64 } } } */
+/* { dg-options "-mriscv-attribute -march=rv32i_svrsw60t59b1p0 -mabi=ilp32" { target { rv32 } } } */
+
+#ifndef __riscv_svrsw60t59b
+#error "Feature macro for 'svrsw60t59b' not defined"
+#endif
+
+int
+foo (void)
+{
+  return 0;
+}
+
+/* { dg-final { scan-assembler ".attribute arch, .*svrsw60t59b1p0" } } */