public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] RISC-V: Don't unconditionally add m,a,f,d in arch-canonicalize
@ 2022-05-25 13:25 Simon Cook
  2022-05-25 14:00 ` [PATCH] RISC-V: Don't unconditionally add m, a, f, d " Kito Cheng
  0 siblings, 1 reply; 4+ messages in thread
From: Simon Cook @ 2022-05-25 13:25 UTC (permalink / raw)
  To: gcc-patches; +Cc: kito.cheng

This solves an issue where rv32i, etc. are canonicalized to rv32imafd
since the g->i addition of 'm', 'a', 'f', 'd' is not actually gated by
whether the input was rv32g/rv64g.

gcc/ChangeLog:

	* config/riscv/arch-canonicalize: Only add mafd extension if
 	base was rv32/rv64g.
---
 gcc/config/riscv/arch-canonicalize | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/gcc/config/riscv/arch-canonicalize
b/gcc/config/riscv/arch-canonicalize
index 71b2232b29e..fd7651ac491 100755
--- a/gcc/config/riscv/arch-canonicalize
+++ b/gcc/config/riscv/arch-canonicalize
@@ -73,8 +73,8 @@ def arch_canonicalize(arch, isa_spec):
   std_exts = []
   if arch[:5] in ['rv32e', 'rv32i', 'rv32g', 'rv64i', 'rv64g']:
     new_arch = arch[:5].replace("g", "i")
-    std_exts = ['m', 'a', 'f', 'd']
     if arch[:5] in ['rv32g', 'rv64g']:
+      std_exts = ['m', 'a', 'f', 'd']
       if not is_isa_spec_2p2:
         extra_long_ext = ['zicsr', 'zifencei']
   else:
-- 
2.32.1

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

* Re: [PATCH] RISC-V: Don't unconditionally add m, a, f, d in arch-canonicalize
  2022-05-25 13:25 [PATCH] RISC-V: Don't unconditionally add m,a,f,d in arch-canonicalize Simon Cook
@ 2022-05-25 14:00 ` Kito Cheng
  2022-05-25 21:32   ` Palmer Dabbelt
  0 siblings, 1 reply; 4+ messages in thread
From: Kito Cheng @ 2022-05-25 14:00 UTC (permalink / raw)
  To: Simon Cook; +Cc: GCC Patches

Committed, Thanks for fixing my stupid bug :P


On Wed, May 25, 2022 at 9:26 PM Simon Cook <simon.cook@embecosm.com> wrote:
>
> This solves an issue where rv32i, etc. are canonicalized to rv32imafd
> since the g->i addition of 'm', 'a', 'f', 'd' is not actually gated by
> whether the input was rv32g/rv64g.
>
> gcc/ChangeLog:
>
>         * config/riscv/arch-canonicalize: Only add mafd extension if
>         base was rv32/rv64g.
> ---
>  gcc/config/riscv/arch-canonicalize | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/gcc/config/riscv/arch-canonicalize
> b/gcc/config/riscv/arch-canonicalize
> index 71b2232b29e..fd7651ac491 100755
> --- a/gcc/config/riscv/arch-canonicalize
> +++ b/gcc/config/riscv/arch-canonicalize
> @@ -73,8 +73,8 @@ def arch_canonicalize(arch, isa_spec):
>    std_exts = []
>    if arch[:5] in ['rv32e', 'rv32i', 'rv32g', 'rv64i', 'rv64g']:
>      new_arch = arch[:5].replace("g", "i")
> -    std_exts = ['m', 'a', 'f', 'd']
>      if arch[:5] in ['rv32g', 'rv64g']:
> +      std_exts = ['m', 'a', 'f', 'd']
>        if not is_isa_spec_2p2:
>          extra_long_ext = ['zicsr', 'zifencei']
>    else:
> --
> 2.32.1

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

* Re: [PATCH] RISC-V: Don't unconditionally add m, a, f, d in arch-canonicalize
  2022-05-25 14:00 ` [PATCH] RISC-V: Don't unconditionally add m, a, f, d " Kito Cheng
@ 2022-05-25 21:32   ` Palmer Dabbelt
  2022-05-26  6:51     ` Kito Cheng
  0 siblings, 1 reply; 4+ messages in thread
From: Palmer Dabbelt @ 2022-05-25 21:32 UTC (permalink / raw)
  To: gcc-patches; +Cc: simon.cook, gcc-patches

On Wed, 25 May 2022 07:00:11 PDT (-0700), gcc-patches@gcc.gnu.org wrote:
> Committed, Thanks for fixing my stupid bug :P

IMO this is a good candidate for a backport.

> On Wed, May 25, 2022 at 9:26 PM Simon Cook <simon.cook@embecosm.com> wrote:
>>
>> This solves an issue where rv32i, etc. are canonicalized to rv32imafd
>> since the g->i addition of 'm', 'a', 'f', 'd' is not actually gated by
>> whether the input was rv32g/rv64g.
>>
>> gcc/ChangeLog:
>>
>>         * config/riscv/arch-canonicalize: Only add mafd extension if
>>         base was rv32/rv64g.
>> ---
>>  gcc/config/riscv/arch-canonicalize | 2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/gcc/config/riscv/arch-canonicalize
>> b/gcc/config/riscv/arch-canonicalize
>> index 71b2232b29e..fd7651ac491 100755
>> --- a/gcc/config/riscv/arch-canonicalize
>> +++ b/gcc/config/riscv/arch-canonicalize
>> @@ -73,8 +73,8 @@ def arch_canonicalize(arch, isa_spec):
>>    std_exts = []
>>    if arch[:5] in ['rv32e', 'rv32i', 'rv32g', 'rv64i', 'rv64g']:
>>      new_arch = arch[:5].replace("g", "i")
>> -    std_exts = ['m', 'a', 'f', 'd']
>>      if arch[:5] in ['rv32g', 'rv64g']:
>> +      std_exts = ['m', 'a', 'f', 'd']
>>        if not is_isa_spec_2p2:
>>          extra_long_ext = ['zicsr', 'zifencei']
>>    else:
>> --
>> 2.32.1

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

* Re: [PATCH] RISC-V: Don't unconditionally add m, a, f, d in arch-canonicalize
  2022-05-25 21:32   ` Palmer Dabbelt
@ 2022-05-26  6:51     ` Kito Cheng
  0 siblings, 0 replies; 4+ messages in thread
From: Kito Cheng @ 2022-05-26  6:51 UTC (permalink / raw)
  To: Palmer Dabbelt; +Cc: GCC Patches

Back ported to releases/gcc-11 and releases/gcc-12 branch :)

On Thu, May 26, 2022 at 5:33 AM Palmer Dabbelt <palmer@dabbelt.com> wrote:
>
> On Wed, 25 May 2022 07:00:11 PDT (-0700), gcc-patches@gcc.gnu.org wrote:
> > Committed, Thanks for fixing my stupid bug :P
>
> IMO this is a good candidate for a backport.
>
> > On Wed, May 25, 2022 at 9:26 PM Simon Cook <simon.cook@embecosm.com> wrote:
> >>
> >> This solves an issue where rv32i, etc. are canonicalized to rv32imafd
> >> since the g->i addition of 'm', 'a', 'f', 'd' is not actually gated by
> >> whether the input was rv32g/rv64g.
> >>
> >> gcc/ChangeLog:
> >>
> >>         * config/riscv/arch-canonicalize: Only add mafd extension if
> >>         base was rv32/rv64g.
> >> ---
> >>  gcc/config/riscv/arch-canonicalize | 2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/gcc/config/riscv/arch-canonicalize
> >> b/gcc/config/riscv/arch-canonicalize
> >> index 71b2232b29e..fd7651ac491 100755
> >> --- a/gcc/config/riscv/arch-canonicalize
> >> +++ b/gcc/config/riscv/arch-canonicalize
> >> @@ -73,8 +73,8 @@ def arch_canonicalize(arch, isa_spec):
> >>    std_exts = []
> >>    if arch[:5] in ['rv32e', 'rv32i', 'rv32g', 'rv64i', 'rv64g']:
> >>      new_arch = arch[:5].replace("g", "i")
> >> -    std_exts = ['m', 'a', 'f', 'd']
> >>      if arch[:5] in ['rv32g', 'rv64g']:
> >> +      std_exts = ['m', 'a', 'f', 'd']
> >>        if not is_isa_spec_2p2:
> >>          extra_long_ext = ['zicsr', 'zifencei']
> >>    else:
> >> --
> >> 2.32.1

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

end of thread, other threads:[~2022-05-26  6:51 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-25 13:25 [PATCH] RISC-V: Don't unconditionally add m,a,f,d in arch-canonicalize Simon Cook
2022-05-25 14:00 ` [PATCH] RISC-V: Don't unconditionally add m, a, f, d " Kito Cheng
2022-05-25 21:32   ` Palmer Dabbelt
2022-05-26  6:51     ` 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).