https://gcc.gnu.org/g:be7a231d52b91d7a50dc88f628e03ce0721c1b05

commit r17-2527-gbe7a231d52b91d7a50dc88f628e03ce0721c1b05
Author: Jiawei <[email protected]>
Date:   Wed Jun 24 21:46:35 2026 +0800

    RISC-V: Add minimal Ssqosid extension support
    
    This adds minimal support for the Ssqosid[1] (Supervisor-mode
    quality-of-service ID) extension.
    
    [1] https://github.com/riscv/riscv-ssqosid
    
    gcc/ChangeLog:
    
            * config/riscv/riscv-ext.def (ssqosid): Add new extension.
            * config/riscv/riscv-ext.opt: Ditto.
            * doc/riscv-ext.texi: Ditto.
    
    gcc/testsuite/ChangeLog:
    
            * gcc.target/riscv/ssqosid-version.c: New test.

Diff:
---
 gcc/config/riscv/riscv-ext.def                   | 13 +++++++++++++
 gcc/config/riscv/riscv-ext.opt                   |  2 ++
 gcc/doc/riscv-ext.texi                           |  4 ++++
 gcc/testsuite/gcc.target/riscv/ssqosid-version.c | 15 +++++++++++++++
 4 files changed, 34 insertions(+)

diff --git a/gcc/config/riscv/riscv-ext.def b/gcc/config/riscv/riscv-ext.def
index 2ed1e788d0cf..a70d0abe343e 100644
--- a/gcc/config/riscv/riscv-ext.def
+++ b/gcc/config/riscv/riscv-ext.def
@@ -2001,6 +2001,19 @@ DEFINE_RISCV_EXT(
   /* BITMASK_BIT_POSITION*/ BITMASK_NOT_YET_ALLOCATED,
   /* EXTRA_EXTENSION_FLAGS */ 0)
 
+DEFINE_RISCV_EXT(
+  /* NAME */ ssqosid,
+  /* UPPERCASE_NAME */ SSQOSID,
+  /* FULL_NAME */ "Supervisor-mode quality-of-service ID extension",
+  /* DESC */ "",
+  /* URL */ ,
+  /* DEP_EXTS */ ({}),
+  /* 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 */ ssstateen,
   /* UPPERCASE_NAME */ SSSTATEEN,
diff --git a/gcc/config/riscv/riscv-ext.opt b/gcc/config/riscv/riscv-ext.opt
index d7d0e48d294c..31b3a51a570e 100644
--- a/gcc/config/riscv/riscv-ext.opt
+++ b/gcc/config/riscv/riscv-ext.opt
@@ -397,6 +397,8 @@ Mask(SSNPM) Var(riscv_ss_subext)
 
 Mask(SSPM) Var(riscv_ss_subext)
 
+Mask(SSQOSID) Var(riscv_ss_subext)
+
 Mask(SSSTATEEN) Var(riscv_ss_subext)
 
 Mask(SSTC) Var(riscv_ss_subext)
diff --git a/gcc/doc/riscv-ext.texi b/gcc/doc/riscv-ext.texi
index bebf1c52616a..65b7c5197154 100644
--- a/gcc/doc/riscv-ext.texi
+++ b/gcc/doc/riscv-ext.texi
@@ -594,6 +594,10 @@
 @tab 1.0
 @tab Supervisor-mode pointer masking extension
 
+@item @samp{ssqosid}
+@tab 1.0
+@tab Supervisor-mode quality-of-service ID extension
+
 @item @samp{ssstateen}
 @tab 1.0
 @tab Supervisor-mode state-enable extension
diff --git a/gcc/testsuite/gcc.target/riscv/ssqosid-version.c 
b/gcc/testsuite/gcc.target/riscv/ssqosid-version.c
new file mode 100644
index 000000000000..5821b6a0edd0
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/ssqosid-version.c
@@ -0,0 +1,15 @@
+/* { dg-do compile } */
+/* { dg-options "-mriscv-attribute -march=rv64i_ssqosid1p0 -mabi=lp64" { 
target { rv64 } } } */
+/* { dg-options "-mriscv-attribute -march=rv32i_ssqosid1p0 -mabi=ilp32" { 
target { rv32 } } } */
+
+#ifndef __riscv_ssqosid
+#error "Feature macro for 'ssqosid' not defined"
+#endif
+
+int
+foo (void)
+{
+  return 0;
+}
+
+/* { dg-final { scan-assembler ".attribute arch, .*ssqosid1p0" } } */

Reply via email to