public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH v3] RISC-V: Add Z*inx imcompatible check in gcc
@ 2023-03-28 16:55 Jiawei
  2023-03-30  6:17 ` Kito Cheng
  0 siblings, 1 reply; 3+ messages in thread
From: Jiawei @ 2023-03-28 16:55 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 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


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

* Re: [PATCH v3] RISC-V: Add Z*inx imcompatible check in gcc
  2023-03-28 16:55 [PATCH v3] RISC-V: Add Z*inx imcompatible check in gcc Jiawei
@ 2023-03-30  6:17 ` Kito Cheng
  2023-03-31  9:27   ` Andreas Schwab
  0 siblings, 1 reply; 3+ messages in thread
From: Kito Cheng @ 2023-03-30  6:17 UTC (permalink / raw)
  To: Jiawei; +Cc: gcc-patches, kito.cheng, palmer, christoph.muellner, wuwei2016

Thanks Jiawei, committed to trunk!

On Wed, Mar 29, 2023 at 12:55 AM Jiawei <jiawei@iscas.ac.cn> wrote:
>
> 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
>

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

* Re: [PATCH v3] RISC-V: Add Z*inx imcompatible check in gcc
  2023-03-30  6:17 ` Kito Cheng
@ 2023-03-31  9:27   ` Andreas Schwab
  0 siblings, 0 replies; 3+ messages in thread
From: Andreas Schwab @ 2023-03-31  9:27 UTC (permalink / raw)
  To: Kito Cheng via Gcc-patches
  Cc: Jiawei, Kito Cheng, kito.cheng, palmer, christoph.muellner, wuwei2016

../../gcc/common/config/riscv/riscv-common.cc: In static member function 'static riscv_subset_list* riscv_subset_list::parse(const char*, location_t)':
../../gcc/common/config/riscv/riscv-common.cc:1158:48: error: unquoted keyword 'float' in format [-Werror=format-diag]
 1158 |         "%<-march=%s%>: z*inx is conflict with float extensions",
      |                                                ^~~~~

-- 
Andreas Schwab, schwab@linux-m68k.org
GPG Key fingerprint = 7578 EB47 D4E5 4D69 2510  2552 DF73 E780 A9DA AEC1
"And now for something completely different."

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

end of thread, other threads:[~2023-03-31  9:27 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-28 16:55 [PATCH v3] RISC-V: Add Z*inx imcompatible check in gcc Jiawei
2023-03-30  6:17 ` Kito Cheng
2023-03-31  9:27   ` Andreas Schwab

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