* [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; 7+ 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] 7+ messages in thread
* Re: [PATCH v2] RISC-V: Add Z*inx imcompatible check in gcc.
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
1 sibling, 0 replies; 7+ messages in thread
From: Kito Cheng @ 2023-03-28 14:30 UTC (permalink / raw)
To: Jiawei; +Cc: gcc-patches, palmer, christoph.muellner, wuwei2016
I would prefer those checking happened in
riscv_subset_list::parse@gcc/common/config/riscv/riscv-common.cc that
could be reused when we adding target attribute.
And I plan integrate the arch-canonicalize script to just reusing
whole arch string parser in GCC 14, so it would be great to have all
check within riscv_subset_list::parse
On Tue, Mar 28, 2023 at 10:23 PM Jiawei <jiawei@iscas.ac.cn> wrote:
>
> 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] 7+ messages in thread
* Re: [PATCH v2] RISC-V: Add Z*inx imcompatible check in gcc.
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
1 sibling, 1 reply; 7+ messages in thread
From: Hans-Peter Nilsson @ 2023-04-04 1:46 UTC (permalink / raw)
To: Jiawei; +Cc: gcc-patches, kito.cheng, palmer, christoph.muellner, wuwei2016
On Tue, 28 Mar 2023, Jiawei wrote:
> + // Zfinx is conflict with float extensions.
> + if (TARGET_ZFINX && TARGET_HARD_FLOAT)
> + error ("z*inx is conflict with float extensions");
> +
While I'm not a native English speaker, "is conflict with"
doesn't sound grammatically correct. Perhaps "conflicts with"
or "is in conflict with"?
brgds, H-P
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v2] RISC-V: Add Z*inx imcompatible check in gcc.
2023-04-04 1:46 ` Hans-Peter Nilsson
@ 2023-04-05 1:30 ` Jeff Law
2023-04-06 2:56 ` jiawei
0 siblings, 1 reply; 7+ messages in thread
From: Jeff Law @ 2023-04-05 1:30 UTC (permalink / raw)
To: Hans-Peter Nilsson, Jiawei
Cc: gcc-patches, kito.cheng, palmer, christoph.muellner, wuwei2016
On 4/3/23 19:46, Hans-Peter Nilsson wrote:
> On Tue, 28 Mar 2023, Jiawei wrote:
>
>> + // Zfinx is conflict with float extensions.
>> + if (TARGET_ZFINX && TARGET_HARD_FLOAT)
>> + error ("z*inx is conflict with float extensions");
>> +
>
> While I'm not a native English speaker, "is conflict with"
> doesn't sound grammatically correct. Perhaps "conflicts with"
> or "is in conflict with"?
"conflicts with" is better.
Jeff
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Re: [PATCH v2] RISC-V: Add Z*inx imcompatible check in gcc.
2023-04-05 1:30 ` Jeff Law
@ 2023-04-06 2:56 ` jiawei
0 siblings, 0 replies; 7+ messages in thread
From: jiawei @ 2023-04-06 2:56 UTC (permalink / raw)
To: Jeff Law
Cc: Hans-Peter Nilsson, gcc-patches, kito.cheng, palmer,
christoph.muellner, wuwei2016
> -----原始邮件-----
> 发件人: "Jeff Law" <jeffreyalaw@gmail.com>
> 发送时间: 2023-04-05 09:30:43 (星期三)
> 收件人: "Hans-Peter Nilsson" <hp@bitrange.com>, Jiawei <jiawei@iscas.ac.cn>
> 抄送: gcc-patches@gcc.gnu.org, kito.cheng@sifive.com, palmer@dabbelt.com, christoph.muellner@vrull.eu, wuwei2016@iscas.ac.cn
> 主题: Re: [PATCH v2] RISC-V: Add Z*inx imcompatible check in gcc.
>
>
>
> On 4/3/23 19:46, Hans-Peter Nilsson wrote:
> > On Tue, 28 Mar 2023, Jiawei wrote:
> >
> >> + // Zfinx is conflict with float extensions.
> >> + if (TARGET_ZFINX && TARGET_HARD_FLOAT)
> >> + error ("z*inx is conflict with float extensions");
> >> +
> >
> > While I'm not a native English speaker, "is conflict with"
> > doesn't sound grammatically correct. Perhaps "conflicts with"
> > or "is in conflict with"?
> "conflicts with" is better.
>
> Jeff
Thanks for your reply, fixed in the trunk.
BR,
Jiawei</jiawei@iscas.ac.cn></hp@bitrange.com></jeffreyalaw@gmail.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Re: [PATCH v2] RISC-V: Add Z*inx imcompatible check in gcc.
2023-03-28 14:36 ` Re: [PATCH v2] RISC-V: Add Z*inx imcompatible " jiawei
@ 2023-03-28 14:43 ` Kito Cheng
0 siblings, 0 replies; 7+ messages in thread
From: Kito Cheng @ 2023-03-28 14:43 UTC (permalink / raw)
To: jiawei; +Cc: gcc-patches, kito.cheng, palmer, christoph.muellner, wuwei2016
Maybe something like this?
diff --git a/gcc/common/config/riscv/riscv-common.cc
b/gcc/common/config/riscv/riscv-common.cc
index acfd7b92563..aa7edc8cfec 100644
--- a/gcc/common/config/riscv/riscv-common.cc
+++ b/gcc/common/config/riscv/riscv-common.cc
@@ -1155,6 +1155,10 @@ 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:
On Tue, Mar 28, 2023 at 10:36 PM <jiawei@iscas.ac.cn> wrote:
>
> Hi Kito,
>
> Thanks for your sugestions, I had added the new testcases in the new patch.
> I feel it's hard to check long string name extension by use riscv_subset_list::parse,
> Since it just check one char when the pointer moving, So I still keep the implement
> by check the extenstison with target. Maybe we can add new check function in the new
> version :)
>
>
> > -----原始邮件-----
> > 发件人: "Kito Cheng" <kito.cheng@gmail.com>
> > 发送时间: 2023-03-27 16:15:00 (星期一)
> > 收件人: Jiawei <jiawei@iscas.ac.cn>
> > 抄送: gcc-patches@gcc.gnu.org, kito.cheng@sifive.com, palmer@dabbelt.com, christoph.muellner@vrull.eu, wuwei2016@iscas.ac.cn
> > 主题: Re: [PATCH] RISC-V: Add Z*inx incompatible check in gcc.
> >
> > HI Jiawei:
> >
> > Thanks for the fix!
> >
> > Two comments:
> > - Could you add testcase like
> > https://github.com/gcc-mirror/gcc/blob/master/gcc/testsuite/gcc.target/riscv/arch-12.c
> > - And I would prefer those check happened in riscv_subset_list::parse
> > @gcc/common/config/riscv/riscv-common.cc
> >
> > On Sun, Mar 26, 2023 at 4:36 PM Jiawei <jiawei@iscas.ac.cn> wrote:
> > >
> > > 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/config/riscv/riscv.cc | 4 ++++
> > > 1 file changed, 4 insertions(+)
> > >
> > > 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);
> > > --
> > > 2.25.1
> > >
> </jiawei@iscas.ac.cn></jiawei@iscas.ac.cn></kito.cheng@gmail.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: Re: [PATCH v2] RISC-V: Add Z*inx imcompatible check in gcc.
2023-03-27 8:15 ` Kito Cheng
@ 2023-03-28 14:36 ` jiawei
2023-03-28 14:43 ` Kito Cheng
0 siblings, 1 reply; 7+ messages in thread
From: jiawei @ 2023-03-28 14:36 UTC (permalink / raw)
To: Kito Cheng; +Cc: gcc-patches, kito.cheng, palmer, christoph.muellner, wuwei2016
Hi Kito,
Thanks for your sugestions, I had added the new testcases in the new patch.
I feel it's hard to check long string name extension by use riscv_subset_list::parse,
Since it just check one char when the pointer moving, So I still keep the implement
by check the extenstison with target. Maybe we can add new check function in the new
version :)
> -----原始邮件-----
> 发件人: "Kito Cheng" <kito.cheng@gmail.com>
> 发送时间: 2023-03-27 16:15:00 (星期一)
> 收件人: Jiawei <jiawei@iscas.ac.cn>
> 抄送: gcc-patches@gcc.gnu.org, kito.cheng@sifive.com, palmer@dabbelt.com, christoph.muellner@vrull.eu, wuwei2016@iscas.ac.cn
> 主题: Re: [PATCH] RISC-V: Add Z*inx incompatible check in gcc.
>
> HI Jiawei:
>
> Thanks for the fix!
>
> Two comments:
> - Could you add testcase like
> https://github.com/gcc-mirror/gcc/blob/master/gcc/testsuite/gcc.target/riscv/arch-12.c
> - And I would prefer those check happened in riscv_subset_list::parse
> @gcc/common/config/riscv/riscv-common.cc
>
> On Sun, Mar 26, 2023 at 4:36 PM Jiawei <jiawei@iscas.ac.cn> wrote:
> >
> > 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/config/riscv/riscv.cc | 4 ++++
> > 1 file changed, 4 insertions(+)
> >
> > 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);
> > --
> > 2.25.1
> >
</jiawei@iscas.ac.cn></jiawei@iscas.ac.cn></kito.cheng@gmail.com>
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2023-04-06 2:56 UTC | newest]
Thread overview: 7+ 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
-- strict thread matches above, loose matches on Subject: below --
2023-03-26 8:34 [PATCH] RISC-V: Add Z*inx incompatible " Jiawei
2023-03-27 8:15 ` Kito Cheng
2023-03-28 14:36 ` Re: [PATCH v2] RISC-V: Add Z*inx imcompatible " jiawei
2023-03-28 14:43 ` 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).