From: Kito Cheng <kito.cheng@sifive.com>
To: gcc-patches@gcc.gnu.org, palmer@dabbelt.com,
kito.cheng@gmail.com, christoph.muellner@vrull.eu,
jeffreyalaw@gmail.com
Cc: Kito Cheng <kito.cheng@sifive.com>
Subject: [PATCH] RISC-V: Check if zcd conflicts with zcmt and zcmp
Date: Mon, 4 Dec 2023 15:48:23 +0800 [thread overview]
Message-ID: <20231204074823.17970-1-kito.cheng@sifive.com> (raw)
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
next reply other threads:[~2023-12-04 7:48 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-12-04 7:48 Kito Cheng [this message]
2023-12-04 9:21 ` Christoph Müllner
2023-12-05 9:53 ` Kito Cheng
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20231204074823.17970-1-kito.cheng@sifive.com \
--to=kito.cheng@sifive.com \
--cc=christoph.muellner@vrull.eu \
--cc=gcc-patches@gcc.gnu.org \
--cc=jeffreyalaw@gmail.com \
--cc=kito.cheng@gmail.com \
--cc=palmer@dabbelt.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).