[gcc r14-6140] RISC-V: Check if zcd conflicts with zcmt and zcmp

Kito Cheng kito@gcc.gnu.org
Tue Dec 5 09:25:09 GMT 2023


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

commit r14-6140-gf542df026cd24e604eb40426a83ce072ef34e15a
Author: Kito Cheng <kito.cheng@sifive.com>
Date:   Mon Nov 27 20:50:11 2023 +0800

    RISC-V: Check if zcd conflicts with zcmt and zcmp
    
    gcc/ChangeLog:
    
            * common/config/riscv/riscv-common.cc
            (riscv_subset_list::check_conflict_ext): Check zcd conflicts
            with zcmt and zcmp.
    
    gcc/testsuite/ChangeLog:
    
            * gcc.target/riscv/arch-29.c: New test.
            * gcc.target/riscv/arch-30.c: New test.

Diff:
---
 gcc/common/config/riscv/riscv-common.cc  | 8 ++++++++
 gcc/testsuite/gcc.target/riscv/arch-29.c | 7 +++++++
 gcc/testsuite/gcc.target/riscv/arch-30.c | 7 +++++++
 3 files changed, 22 insertions(+)

diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc
index 277d86da064..4d5a2f874a2 100644
--- a/gcc/common/config/riscv/riscv-common.cc
+++ b/gcc/common/config/riscv/riscv-common.cc
@@ -1231,6 +1231,14 @@ riscv_subset_list::check_conflict_ext ()
   /* 'H' hypervisor extension requires base ISA with 32 registers.  */
   if (lookup ("e") && lookup ("h"))
     error_at (m_loc, "%<-march=%s%>: h extension requires i extension", m_arch);
+
+  if (lookup ("zcd"))
+    {
+      if (lookup ("zcmt"))
+	error_at (m_loc, "%<-march=%s%>: zcd conflicts with zcmt", m_arch);
+      if (lookup ("zcmp"))
+	error_at (m_loc, "%<-march=%s%>: zcd conflicts with zcmp", m_arch);
+    }
 }
 
 /* Parsing function for multi-letter extensions.
diff --git a/gcc/testsuite/gcc.target/riscv/arch-29.c b/gcc/testsuite/gcc.target/riscv/arch-29.c
new file mode 100644
index 00000000000..f8281275878
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/arch-29.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64id_zcd_zcmt -mabi=lp64d" } */
+int foo()
+{
+}
+
+/* { dg-error "zcd conflicts with zcmt" "" { target *-*-* } 0 } */
diff --git a/gcc/testsuite/gcc.target/riscv/arch-30.c b/gcc/testsuite/gcc.target/riscv/arch-30.c
new file mode 100644
index 00000000000..3e67ea0bb06
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/arch-30.c
@@ -0,0 +1,7 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64id_zcd_zcmp -mabi=lp64d" } */
+int foo()
+{
+}
+
+/* { dg-error "zcd conflicts with zcmp" "" { target *-*-* } 0 } */


More information about the Gcc-cvs mailing list