* [PATCH] Adjust memory_move_cost for MASK_REGS when MODE_SIZE > 8.
@ 2023-03-31 5:11 liuhongt
2023-03-31 5:57 ` Uros Bizjak
0 siblings, 1 reply; 3+ messages in thread
From: liuhongt @ 2023-03-31 5:11 UTC (permalink / raw)
To: gcc-patches; +Cc: crazylht, hjl.tools, ubizjak
RA sometimes will use lowest the cost of the mode with all different regclasses
w/o check if it's hard_regno_mode_ok.
It's impossible to put modes whose size > 8 into MASK_REGS, ajdust the cost to
avoid potential performance issue.
Bootstrapped and regtested on x86_64-pc-linux-gnu{-m32,}.
Ok for trunk?
gcc/ChangeLog:
* config/i386/i386.cc (inline_memory_move_cost): Return 100
for MASK_REGS when MODE_SIZE > 8.
---
gcc/config/i386/i386.cc | 5 ++++-
1 file changed, 4 insertions(+), 1 deletion(-)
diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
index 2cc8e9548a9..2581b800a06 100644
--- a/gcc/config/i386/i386.cc
+++ b/gcc/config/i386/i386.cc
@@ -19847,9 +19847,12 @@ inline_memory_move_cost (machine_mode mode, enum reg_class regclass, int in)
index = 1;
break;
/* DImode loads and stores assumed to cost the same as SImode. */
- default:
+ case 4:
+ case 8:
index = 2;
break;
+ default:
+ return 100;
}
if (in == 2)
--
2.39.1.388.g2fc9e9ca3c
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Adjust memory_move_cost for MASK_REGS when MODE_SIZE > 8.
2023-03-31 5:11 [PATCH] Adjust memory_move_cost for MASK_REGS when MODE_SIZE > 8 liuhongt
@ 2023-03-31 5:57 ` Uros Bizjak
2023-03-31 6:14 ` Hongtao Liu
0 siblings, 1 reply; 3+ messages in thread
From: Uros Bizjak @ 2023-03-31 5:57 UTC (permalink / raw)
To: liuhongt; +Cc: gcc-patches, crazylht, hjl.tools
On Fri, Mar 31, 2023 at 7:11 AM liuhongt <hongtao.liu@intel.com> wrote:
>
> RA sometimes will use lowest the cost of the mode with all different regclasses
> w/o check if it's hard_regno_mode_ok.
> It's impossible to put modes whose size > 8 into MASK_REGS, ajdust the cost to
> avoid potential performance issue.
I was going to ask to open a PR in order to fix RA instead of the
proposed workaround, but the patch just prevents a theoretical issue
and follows the established practice with other regclasses. Perhaps
these workarounds are not needed with the current RA, but this is a
tangential issue which should be fixed for all regclasses.
> Bootstrapped and regtested on x86_64-pc-linux-gnu{-m32,}.
> Ok for trunk?
OK.
Thanks,
Uros.
>
> gcc/ChangeLog:
>
> * config/i386/i386.cc (inline_memory_move_cost): Return 100
> for MASK_REGS when MODE_SIZE > 8.
> ---
> gcc/config/i386/i386.cc | 5 ++++-
> 1 file changed, 4 insertions(+), 1 deletion(-)
>
> diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
> index 2cc8e9548a9..2581b800a06 100644
> --- a/gcc/config/i386/i386.cc
> +++ b/gcc/config/i386/i386.cc
> @@ -19847,9 +19847,12 @@ inline_memory_move_cost (machine_mode mode, enum reg_class regclass, int in)
> index = 1;
> break;
> /* DImode loads and stores assumed to cost the same as SImode. */
> - default:
> + case 4:
> + case 8:
> index = 2;
> break;
> + default:
> + return 100;
> }
>
> if (in == 2)
> --
> 2.39.1.388.g2fc9e9ca3c
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Adjust memory_move_cost for MASK_REGS when MODE_SIZE > 8.
2023-03-31 5:57 ` Uros Bizjak
@ 2023-03-31 6:14 ` Hongtao Liu
0 siblings, 0 replies; 3+ messages in thread
From: Hongtao Liu @ 2023-03-31 6:14 UTC (permalink / raw)
To: Uros Bizjak; +Cc: liuhongt, gcc-patches, hjl.tools
On Fri, Mar 31, 2023 at 1:57 PM Uros Bizjak <ubizjak@gmail.com> wrote:
>
> On Fri, Mar 31, 2023 at 7:11 AM liuhongt <hongtao.liu@intel.com> wrote:
> >
> > RA sometimes will use lowest the cost of the mode with all different regclasses
> > w/o check if it's hard_regno_mode_ok.
> > It's impossible to put modes whose size > 8 into MASK_REGS, ajdust the cost to
> > avoid potential performance issue.
>
> I was going to ask to open a PR in order to fix RA instead of the
> proposed workaround, but the patch just prevents a theoretical issue
> and follows the established practice with other regclasses. Perhaps
> these workarounds are not needed with the current RA, but this is a
> tangential issue which should be fixed for all regclasses.
Opened https://gcc.gnu.org/bugzilla/show_bug.cgi?id=109351
>
> > Bootstrapped and regtested on x86_64-pc-linux-gnu{-m32,}.
> > Ok for trunk?
>
> OK.
>
> Thanks,
> Uros.
>
> >
> > gcc/ChangeLog:
> >
> > * config/i386/i386.cc (inline_memory_move_cost): Return 100
> > for MASK_REGS when MODE_SIZE > 8.
> > ---
> > gcc/config/i386/i386.cc | 5 ++++-
> > 1 file changed, 4 insertions(+), 1 deletion(-)
> >
> > diff --git a/gcc/config/i386/i386.cc b/gcc/config/i386/i386.cc
> > index 2cc8e9548a9..2581b800a06 100644
> > --- a/gcc/config/i386/i386.cc
> > +++ b/gcc/config/i386/i386.cc
> > @@ -19847,9 +19847,12 @@ inline_memory_move_cost (machine_mode mode, enum reg_class regclass, int in)
> > index = 1;
> > break;
> > /* DImode loads and stores assumed to cost the same as SImode. */
> > - default:
> > + case 4:
> > + case 8:
> > index = 2;
> > break;
> > + default:
> > + return 100;
> > }
> >
> > if (in == 2)
> > --
> > 2.39.1.388.g2fc9e9ca3c
> >
--
BR,
Hongtao
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2023-03-31 6:14 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-03-31 5:11 [PATCH] Adjust memory_move_cost for MASK_REGS when MODE_SIZE > 8 liuhongt
2023-03-31 5:57 ` Uros Bizjak
2023-03-31 6:14 ` Hongtao Liu
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).