public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH v2] RISC-V: Add Z*inx imcompatible check in gcc.
@ 2023-03-28 14:23 Jiawei
  2023-03-28 14:30 ` Kito Cheng
  2023-04-04  1:46 ` Hans-Peter Nilsson
  0 siblings, 2 replies; 5+ messages in thread
From: Jiawei @ 2023-03-28 14:23 UTC (permalink / raw)
  To: gcc-patches; +Cc: kito.cheng, palmer, christoph.muellner, wuwei2016, Jiawei

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

gcc/ChangeLog:

        * config/riscv/riscv.cc (riscv_option_override): New check.

gcc/testsuite/ChangeLog:

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

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

diff --git a/gcc/config/riscv/riscv.cc b/gcc/config/riscv/riscv.cc
index 76eee4a55e9..162ba14d3c7 100644
--- a/gcc/config/riscv/riscv.cc
+++ b/gcc/config/riscv/riscv.cc
@@ -6285,6 +6285,10 @@ riscv_option_override (void)
       && riscv_abi != ABI_LP64 && riscv_abi != ABI_ILP32E)
     error ("z*inx requires ABI ilp32, ilp32e or lp64");
 
+  // Zfinx is conflict with float extensions.
+  if (TARGET_ZFINX && TARGET_HARD_FLOAT)
+    error ("z*inx is conflict with float extensions");
+
   /* We do not yet support ILP32 on RV64.  */
   if (BITS_PER_WORD != POINTER_SIZE)
     error ("ABI requires %<-march=rv%d%>", POINTER_SIZE);
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..a6f72af3677
--- /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 "z*inx is conflict with float extensions" "" { target *-*-* } 0 } */
-- 
2.25.1


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

end of thread, other threads:[~2023-04-06  2:56 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-28 14:23 [PATCH v2] RISC-V: Add Z*inx imcompatible check in gcc Jiawei
2023-03-28 14:30 ` Kito Cheng
2023-04-04  1:46 ` Hans-Peter Nilsson
2023-04-05  1:30   ` Jeff Law
2023-04-06  2:56     ` jiawei

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).