public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
From: Jiawei <jiawei@iscas.ac.cn>
To: gcc-patches@gcc.gnu.org
Cc: kito.cheng@sifive.com, palmer@dabbelt.com,
	christoph.muellner@vrull.eu, wuwei2016@iscas.ac.cn,
	Jiawei <jiawei@iscas.ac.cn>
Subject: [PATCH v3] RISC-V: Add Z*inx imcompatible check in gcc
Date: Wed, 29 Mar 2023 00:55:15 +0800	[thread overview]
Message-ID: <20230328165515.2300685-1-jiawei@iscas.ac.cn> (raw)

Z*inx is conflict with float extensions, add incompatible check when
z*inx and f extension both enabled.

Since all float extension imply f extension and all z*inx extension 
imply zfinx extension, so we just need to check f with zfinx extension 
as the base case.

Co-Authored by: Kito Cheng <kito.cheng@gmail.com>

gcc/ChangeLog:

        * common/config/riscv/riscv-common.cc (riscv_subset_list::parse):
	* New check.

gcc/testsuite/ChangeLog:

        * gcc.target/riscv/arch-19.c: New test.

---
 gcc/common/config/riscv/riscv-common.cc  | 5 +++++
 gcc/testsuite/gcc.target/riscv/arch-19.c | 4 ++++
 2 files changed, 9 insertions(+)
 create mode 100644 gcc/testsuite/gcc.target/riscv/arch-19.c

diff --git a/gcc/common/config/riscv/riscv-common.cc b/gcc/common/config/riscv/riscv-common.cc
index ef221be1eb1..b3c6ec97e7a 100644
--- a/gcc/common/config/riscv/riscv-common.cc
+++ b/gcc/common/config/riscv/riscv-common.cc
@@ -1153,6 +1153,11 @@ riscv_subset_list::parse (const char *arch, location_t loc)
 
   subset_list->handle_combine_ext ();
 
+  if (subset_list->lookup("zfinx") && subset_list->lookup("f"))
+	error_at (loc,
+	"%<-march=%s%>: z*inx is conflict with float extensions",
+	arch);
+
   return subset_list;
 
 fail:
diff --git a/gcc/testsuite/gcc.target/riscv/arch-19.c b/gcc/testsuite/gcc.target/riscv/arch-19.c
new file mode 100644
index 00000000000..83c6e00a755
--- /dev/null
+++ b/gcc/testsuite/gcc.target/riscv/arch-19.c
@@ -0,0 +1,4 @@
+/* { dg-do compile } */
+/* { dg-options "-march=rv64if_zfinx -mabi=lp64" } */
+int foo() {}
+/* { dg-error "'-march=rv64if_zfinx': z\\*inx is conflict with float extensions" "" { target *-*-* } 0 } */
-- 
2.25.1


             reply	other threads:[~2023-03-28 16:55 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-28 16:55 Jiawei [this message]
2023-03-30  6:17 ` Kito Cheng
2023-03-31  9:27   ` Andreas Schwab

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=20230328165515.2300685-1-jiawei@iscas.ac.cn \
    --to=jiawei@iscas.ac.cn \
    --cc=christoph.muellner@vrull.eu \
    --cc=gcc-patches@gcc.gnu.org \
    --cc=kito.cheng@sifive.com \
    --cc=palmer@dabbelt.com \
    --cc=wuwei2016@iscas.ac.cn \
    /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).