]> git.ipfire.org Git - thirdparty/gcc.git/commitdiff
RISC-V: Check if zcd conflicts with zcmt and zcmp
authorKito Cheng <kito.cheng@sifive.com>
Mon, 27 Nov 2023 12:50:11 +0000 (20:50 +0800)
committerKito Cheng <kito.cheng@sifive.com>
Tue, 5 Dec 2023 09:24:34 +0000 (17:24 +0800)
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.

gcc/common/config/riscv/riscv-common.cc
gcc/testsuite/gcc.target/riscv/arch-29.c [new file with mode: 0644]
gcc/testsuite/gcc.target/riscv/arch-30.c [new file with mode: 0644]

index 277d86da064b2ee5181bcd1db08f23fbc6acaae0..4d5a2f874a25e695bf4700fd2f61eb462f4eb1c5 100644 (file)
@@ -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 (file)
index 0000000..f828127
--- /dev/null
@@ -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 (file)
index 0000000..3e67ea0
--- /dev/null
@@ -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 } */