public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] RISC-V: Check if zcd conflicts with zcmt and zcmp
@ 2023-12-04  7:48 Kito Cheng
  2023-12-04  9:21 ` Christoph Müllner
  0 siblings, 1 reply; 3+ messages in thread
From: Kito Cheng @ 2023-12-04  7:48 UTC (permalink / raw)
  To: gcc-patches, palmer, kito.cheng, christoph.muellner, jeffreyalaw
  Cc: Kito Cheng

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  | 8 ++++++++
 gcc/testsuite/gcc.target/riscv/arch-29.c | 7 +++++++
 gcc/testsuite/gcc.target/riscv/arch-30.c | 7 +++++++
 3 files changed, 22 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/riscv/arch-29.c
 create mode 100644 gcc/testsuite/gcc.target/riscv/arch-30.c

diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc
index aecb342b164..bfb41827f7a 100644
--- a/gcc/common/config/riscv/riscv-common.cc
+++ b/gcc/common/config/riscv/riscv-common.cc
@@ -1230,6 +1230,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 } */
-- 
2.40.1


^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-12-05  9:53 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-04  7:48 [PATCH] RISC-V: Check if zcd conflicts with zcmt and zcmp Kito Cheng
2023-12-04  9:21 ` Christoph Müllner
2023-12-05  9:53   ` Kito Cheng

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).