AArch64: Turn on GPR narrowing pass by default

Message ID patch-20509-tamar@arm.com
State Committed
Headers
Series AArch64: Turn on GPR narrowing pass by default |

Commit Message

Tamar Christina May 6, 2026, 1 p.m. UTC
  This turns on the GPR narrowing pass for all AArch64 targets.

Bootstrapped Regtested on aarch64-none-linux-gnu and no issues.

Any objections?

Thanks,
Tamar

gcc/ChangeLog:

	* config/aarch64/aarch64-tuning-flags.def
	(AARCH64_EXTRA_TUNE_BASE): Add AARCH64_EXTRA_TUNE_NARROW_GP_WRITES.

---


--
  

Comments

Wilco Dijkstra May 6, 2026, 1:06 p.m. UTC | #1
Hi Tamar,
 
> This turns on the GPR narrowing pass for all AArch64 targets.
> 
> Bootstrapped Regtested on aarch64-none-linux-gnu and no issues.
>
> Any objections?

LGTM.

Cheers,
Wilco
  
Alex Coplan May 6, 2026, 1:14 p.m. UTC | #2
On 06/05/2026 14:00, Tamar Christina wrote:
> This turns on the GPR narrowing pass for all AArch64 targets.

In principle this sounds good, although maybe it should go in after
Soumya's fix for PR124895 to minimize noise for folks that are testing
the trunk.

> 
> Bootstrapped Regtested on aarch64-none-linux-gnu and no issues.
> 
> Any objections?
> 
> Thanks,
> Tamar
> 
> gcc/ChangeLog:
> 
> 	* config/aarch64/aarch64-tuning-flags.def
> 	(AARCH64_EXTRA_TUNE_BASE): Add AARCH64_EXTRA_TUNE_NARROW_GP_WRITES.
> 
> ---
> diff --git a/gcc/config/aarch64/aarch64-tuning-flags.def b/gcc/config/aarch64/aarch64-tuning-flags.def
> index 882daa4b4312039f96dcde1295179be3ab3da0d0..058dadecccaac458e30a6585b558581a7bef6f54 100644
> --- a/gcc/config/aarch64/aarch64-tuning-flags.def
> +++ b/gcc/config/aarch64/aarch64-tuning-flags.def
> @@ -67,7 +67,8 @@ AARCH64_EXTRA_TUNING_OPTION ("cheap_fpmr_write", CHEAP_FPMR_WRITE)
>  
>  /* Baseline tuning settings suitable for all modern cores.  */
>  #define AARCH64_EXTRA_TUNE_BASE (AARCH64_EXTRA_TUNE_CHEAP_SHIFT_EXTEND	\
> -				 | AARCH64_EXTRA_TUNE_FULLY_PIPELINED_FMA)
> +				 | AARCH64_EXTRA_TUNE_FULLY_PIPELINED_FMA \
> +				 | AARCH64_EXTRA_TUNE_NARROW_GP_WRITES)

Doesn't this render the tuning flag obsolete?  Presumably we could remove
the flag entirely and instead just adjust the default to 1 for
-mnarrow-gp-writes in aarch64.opt (simplifying the logic in
pass_narrow_gp_writes::gate accordingly)?

Or would you prefer to keep it so that the pass can be turned off for
particular cores if required / to minimize churn in case a reversion is
needed?

Thanks,
Alex

>  
>  /* Enables dispatch scheduling.  */
>  AARCH64_EXTRA_TUNING_OPTION ("dispatch_sched", DISPATCH_SCHED)
> 
> 
> -- 

> diff --git a/gcc/config/aarch64/aarch64-tuning-flags.def b/gcc/config/aarch64/aarch64-tuning-flags.def
> index 882daa4b4312039f96dcde1295179be3ab3da0d0..058dadecccaac458e30a6585b558581a7bef6f54 100644
> --- a/gcc/config/aarch64/aarch64-tuning-flags.def
> +++ b/gcc/config/aarch64/aarch64-tuning-flags.def
> @@ -67,7 +67,8 @@ AARCH64_EXTRA_TUNING_OPTION ("cheap_fpmr_write", CHEAP_FPMR_WRITE)
>  
>  /* Baseline tuning settings suitable for all modern cores.  */
>  #define AARCH64_EXTRA_TUNE_BASE (AARCH64_EXTRA_TUNE_CHEAP_SHIFT_EXTEND	\
> -				 | AARCH64_EXTRA_TUNE_FULLY_PIPELINED_FMA)
> +				 | AARCH64_EXTRA_TUNE_FULLY_PIPELINED_FMA \
> +				 | AARCH64_EXTRA_TUNE_NARROW_GP_WRITES)
>  
>  /* Enables dispatch scheduling.  */
>  AARCH64_EXTRA_TUNING_OPTION ("dispatch_sched", DISPATCH_SCHED)
>
  
Tamar Christina May 6, 2026, 1:39 p.m. UTC | #3
> -----Original Message-----
> From: Alex Coplan <Alex.Coplan@arm.com>
> Sent: 06 May 2026 14:15
> To: Tamar Christina <Tamar.Christina@arm.com>
> Cc: gcc-patches@gcc.gnu.org; nd <nd@arm.com>; Richard Earnshaw
> <Richard.Earnshaw@arm.com>; ktkachov@gcc.gnu.org;
> andrew.pinski@oss.qualcomm.com; Wilco Dijkstra
> <Wilco.Dijkstra@arm.com>; Alice Carlotti <Alice.Carlotti@arm.com>
> Subject: Re: [PATCH]AArch64: Turn on GPR narrowing pass by default
> 
> On 06/05/2026 14:00, Tamar Christina wrote:
> > This turns on the GPR narrowing pass for all AArch64 targets.
> 
> In principle this sounds good, although maybe it should go in after
> Soumya's fix for PR124895 to minimize noise for folks that are testing
> the trunk.

Sure, I'll wait for that fix to be committed.

> 
> >
> > Bootstrapped Regtested on aarch64-none-linux-gnu and no issues.
> >
> > Any objections?
> >
> > Thanks,
> > Tamar
> >
> > gcc/ChangeLog:
> >
> > 	* config/aarch64/aarch64-tuning-flags.def
> > 	(AARCH64_EXTRA_TUNE_BASE): Add
> AARCH64_EXTRA_TUNE_NARROW_GP_WRITES.
> >
> > ---
> > diff --git a/gcc/config/aarch64/aarch64-tuning-flags.def
> b/gcc/config/aarch64/aarch64-tuning-flags.def
> > index
> 882daa4b4312039f96dcde1295179be3ab3da0d0..058dadecccaac458e30a
> 6585b558581a7bef6f54 100644
> > --- a/gcc/config/aarch64/aarch64-tuning-flags.def
> > +++ b/gcc/config/aarch64/aarch64-tuning-flags.def
> > @@ -67,7 +67,8 @@ AARCH64_EXTRA_TUNING_OPTION
> ("cheap_fpmr_write", CHEAP_FPMR_WRITE)
> >
> >  /* Baseline tuning settings suitable for all modern cores.  */
> >  #define AARCH64_EXTRA_TUNE_BASE
> (AARCH64_EXTRA_TUNE_CHEAP_SHIFT_EXTEND	\
> > -				 |
> AARCH64_EXTRA_TUNE_FULLY_PIPELINED_FMA)
> > +				 |
> AARCH64_EXTRA_TUNE_FULLY_PIPELINED_FMA \
> > +				 |
> AARCH64_EXTRA_TUNE_NARROW_GP_WRITES)
> 
> Doesn't this render the tuning flag obsolete?  Presumably we could remove
> the flag entirely and instead just adjust the default to 1 for
> -mnarrow-gp-writes in aarch64.opt (simplifying the logic in
> pass_narrow_gp_writes::gate accordingly)?

I think we should remove `-mnarrow-gp-writes` entirely.  With it on by default
It can be disabled with the pass manager's standard -fdisable-rtl-narrow_gp_writes
so there's no need to the target option anymore.

This would also be more inline with other generic passes.  Or do you see a value in
having it?

> 
> Or would you prefer to keep it so that the pass can be turned off for
> particular cores if required / to minimize churn in case a reversion is
> needed?
> 

I wanted to keep a way to disable it since I don't know if it'll do anything
weird on partner cores.  So I think I'd like the tune for now, but when/if
this moves to a middle-end pass to drop it.

So I'll respin dropping the `-m` flag if you agree.

Thanks,
Tamar

> Thanks,
> Alex
> 
> >
> >  /* Enables dispatch scheduling.  */
> >  AARCH64_EXTRA_TUNING_OPTION ("dispatch_sched", DISPATCH_SCHED)
> >
> >
> > --
> 
> > diff --git a/gcc/config/aarch64/aarch64-tuning-flags.def
> b/gcc/config/aarch64/aarch64-tuning-flags.def
> > index
> 882daa4b4312039f96dcde1295179be3ab3da0d0..058dadecccaac458e30a
> 6585b558581a7bef6f54 100644
> > --- a/gcc/config/aarch64/aarch64-tuning-flags.def
> > +++ b/gcc/config/aarch64/aarch64-tuning-flags.def
> > @@ -67,7 +67,8 @@ AARCH64_EXTRA_TUNING_OPTION
> ("cheap_fpmr_write", CHEAP_FPMR_WRITE)
> >
> >  /* Baseline tuning settings suitable for all modern cores.  */
> >  #define AARCH64_EXTRA_TUNE_BASE
> (AARCH64_EXTRA_TUNE_CHEAP_SHIFT_EXTEND	\
> > -				 |
> AARCH64_EXTRA_TUNE_FULLY_PIPELINED_FMA)
> > +				 |
> AARCH64_EXTRA_TUNE_FULLY_PIPELINED_FMA \
> > +				 |
> AARCH64_EXTRA_TUNE_NARROW_GP_WRITES)
> >
> >  /* Enables dispatch scheduling.  */
> >  AARCH64_EXTRA_TUNING_OPTION ("dispatch_sched", DISPATCH_SCHED)
> >
  
Alex Coplan May 6, 2026, 2:05 p.m. UTC | #4
On 06/05/2026 14:39, Tamar Christina wrote:
> > -----Original Message-----
> > From: Alex Coplan <Alex.Coplan@arm.com>
> > Sent: 06 May 2026 14:15
> > To: Tamar Christina <Tamar.Christina@arm.com>
> > Cc: gcc-patches@gcc.gnu.org; nd <nd@arm.com>; Richard Earnshaw
> > <Richard.Earnshaw@arm.com>; ktkachov@gcc.gnu.org;
> > andrew.pinski@oss.qualcomm.com; Wilco Dijkstra
> > <Wilco.Dijkstra@arm.com>; Alice Carlotti <Alice.Carlotti@arm.com>
> > Subject: Re: [PATCH]AArch64: Turn on GPR narrowing pass by default
> > 
> > On 06/05/2026 14:00, Tamar Christina wrote:
> > > This turns on the GPR narrowing pass for all AArch64 targets.
> > 
> > In principle this sounds good, although maybe it should go in after
> > Soumya's fix for PR124895 to minimize noise for folks that are testing
> > the trunk.
> 
> Sure, I'll wait for that fix to be committed.
> 
> > 
> > >
> > > Bootstrapped Regtested on aarch64-none-linux-gnu and no issues.
> > >
> > > Any objections?
> > >
> > > Thanks,
> > > Tamar
> > >
> > > gcc/ChangeLog:
> > >
> > > 	* config/aarch64/aarch64-tuning-flags.def
> > > 	(AARCH64_EXTRA_TUNE_BASE): Add
> > AARCH64_EXTRA_TUNE_NARROW_GP_WRITES.
> > >
> > > ---
> > > diff --git a/gcc/config/aarch64/aarch64-tuning-flags.def
> > b/gcc/config/aarch64/aarch64-tuning-flags.def
> > > index
> > 882daa4b4312039f96dcde1295179be3ab3da0d0..058dadecccaac458e30a
> > 6585b558581a7bef6f54 100644
> > > --- a/gcc/config/aarch64/aarch64-tuning-flags.def
> > > +++ b/gcc/config/aarch64/aarch64-tuning-flags.def
> > > @@ -67,7 +67,8 @@ AARCH64_EXTRA_TUNING_OPTION
> > ("cheap_fpmr_write", CHEAP_FPMR_WRITE)
> > >
> > >  /* Baseline tuning settings suitable for all modern cores.  */
> > >  #define AARCH64_EXTRA_TUNE_BASE
> > (AARCH64_EXTRA_TUNE_CHEAP_SHIFT_EXTEND	\
> > > -				 |
> > AARCH64_EXTRA_TUNE_FULLY_PIPELINED_FMA)
> > > +				 |
> > AARCH64_EXTRA_TUNE_FULLY_PIPELINED_FMA \
> > > +				 |
> > AARCH64_EXTRA_TUNE_NARROW_GP_WRITES)
> > 
> > Doesn't this render the tuning flag obsolete?  Presumably we could remove
> > the flag entirely and instead just adjust the default to 1 for
> > -mnarrow-gp-writes in aarch64.opt (simplifying the logic in
> > pass_narrow_gp_writes::gate accordingly)?
> 
> I think we should remove `-mnarrow-gp-writes` entirely.  With it on by default
> It can be disabled with the pass manager's standard -fdisable-rtl-narrow_gp_writes
> so there's no need to the target option anymore.

I don't think the -m option can just be removed, since it is already present in
the GCC 16 release.

> 
> This would also be more inline with other generic passes.  Or do you see a value in
> having it?
> 
> > 
> > Or would you prefer to keep it so that the pass can be turned off for
> > particular cores if required / to minimize churn in case a reversion is
> > needed?
> > 
> 
> I wanted to keep a way to disable it since I don't know if it'll do anything
> weird on partner cores.  So I think I'd like the tune for now, but when/if
> this moves to a middle-end pass to drop it.

That's fair enough, let's keep the tune flag in that case, so the original patch
is OK from my POV.

Thanks,
Alex

> 
> So I'll respin dropping the `-m` flag if you agree.

> 
> Thanks,
> Tamar
> 
> > Thanks,
> > Alex
> > 
> > >
> > >  /* Enables dispatch scheduling.  */
> > >  AARCH64_EXTRA_TUNING_OPTION ("dispatch_sched", DISPATCH_SCHED)
> > >
> > >
> > > --
> > 
> > > diff --git a/gcc/config/aarch64/aarch64-tuning-flags.def
> > b/gcc/config/aarch64/aarch64-tuning-flags.def
> > > index
> > 882daa4b4312039f96dcde1295179be3ab3da0d0..058dadecccaac458e30a
> > 6585b558581a7bef6f54 100644
> > > --- a/gcc/config/aarch64/aarch64-tuning-flags.def
> > > +++ b/gcc/config/aarch64/aarch64-tuning-flags.def
> > > @@ -67,7 +67,8 @@ AARCH64_EXTRA_TUNING_OPTION
> > ("cheap_fpmr_write", CHEAP_FPMR_WRITE)
> > >
> > >  /* Baseline tuning settings suitable for all modern cores.  */
> > >  #define AARCH64_EXTRA_TUNE_BASE
> > (AARCH64_EXTRA_TUNE_CHEAP_SHIFT_EXTEND	\
> > > -				 |
> > AARCH64_EXTRA_TUNE_FULLY_PIPELINED_FMA)
> > > +				 |
> > AARCH64_EXTRA_TUNE_FULLY_PIPELINED_FMA \
> > > +				 |
> > AARCH64_EXTRA_TUNE_NARROW_GP_WRITES)
> > >
> > >  /* Enables dispatch scheduling.  */
> > >  AARCH64_EXTRA_TUNING_OPTION ("dispatch_sched", DISPATCH_SCHED)
> > >
>
  
Tamar Christina May 6, 2026, 2:43 p.m. UTC | #5
> -----Original Message-----
> From: Alex Coplan <Alex.Coplan@arm.com>
> Sent: 06 May 2026 15:06
> To: Tamar Christina <Tamar.Christina@arm.com>
> Cc: gcc-patches@gcc.gnu.org; nd <nd@arm.com>; Richard Earnshaw
> <Richard.Earnshaw@arm.com>; ktkachov@gcc.gnu.org;
> andrew.pinski@oss.qualcomm.com; Wilco Dijkstra
> <Wilco.Dijkstra@arm.com>; Alice Carlotti <Alice.Carlotti@arm.com>
> Subject: Re: [PATCH]AArch64: Turn on GPR narrowing pass by default
> 
> On 06/05/2026 14:39, Tamar Christina wrote:
> > > -----Original Message-----
> > > From: Alex Coplan <Alex.Coplan@arm.com>
> > > Sent: 06 May 2026 14:15
> > > To: Tamar Christina <Tamar.Christina@arm.com>
> > > Cc: gcc-patches@gcc.gnu.org; nd <nd@arm.com>; Richard Earnshaw
> > > <Richard.Earnshaw@arm.com>; ktkachov@gcc.gnu.org;
> > > andrew.pinski@oss.qualcomm.com; Wilco Dijkstra
> > > <Wilco.Dijkstra@arm.com>; Alice Carlotti <Alice.Carlotti@arm.com>
> > > Subject: Re: [PATCH]AArch64: Turn on GPR narrowing pass by default
> > >
> > > On 06/05/2026 14:00, Tamar Christina wrote:
> > > > This turns on the GPR narrowing pass for all AArch64 targets.
> > >
> > > In principle this sounds good, although maybe it should go in after
> > > Soumya's fix for PR124895 to minimize noise for folks that are testing
> > > the trunk.
> >
> > Sure, I'll wait for that fix to be committed.
> >
> > >
> > > >
> > > > Bootstrapped Regtested on aarch64-none-linux-gnu and no issues.
> > > >
> > > > Any objections?
> > > >
> > > > Thanks,
> > > > Tamar
> > > >
> > > > gcc/ChangeLog:
> > > >
> > > > 	* config/aarch64/aarch64-tuning-flags.def
> > > > 	(AARCH64_EXTRA_TUNE_BASE): Add
> > > AARCH64_EXTRA_TUNE_NARROW_GP_WRITES.
> > > >
> > > > ---
> > > > diff --git a/gcc/config/aarch64/aarch64-tuning-flags.def
> > > b/gcc/config/aarch64/aarch64-tuning-flags.def
> > > > index
> > >
> 882daa4b4312039f96dcde1295179be3ab3da0d0..058dadecccaac458e30a
> > > 6585b558581a7bef6f54 100644
> > > > --- a/gcc/config/aarch64/aarch64-tuning-flags.def
> > > > +++ b/gcc/config/aarch64/aarch64-tuning-flags.def
> > > > @@ -67,7 +67,8 @@ AARCH64_EXTRA_TUNING_OPTION
> > > ("cheap_fpmr_write", CHEAP_FPMR_WRITE)
> > > >
> > > >  /* Baseline tuning settings suitable for all modern cores.  */
> > > >  #define AARCH64_EXTRA_TUNE_BASE
> > > (AARCH64_EXTRA_TUNE_CHEAP_SHIFT_EXTEND	\
> > > > -				 |
> > > AARCH64_EXTRA_TUNE_FULLY_PIPELINED_FMA)
> > > > +				 |
> > > AARCH64_EXTRA_TUNE_FULLY_PIPELINED_FMA \
> > > > +				 |
> > > AARCH64_EXTRA_TUNE_NARROW_GP_WRITES)
> > >
> > > Doesn't this render the tuning flag obsolete?  Presumably we could remove
> > > the flag entirely and instead just adjust the default to 1 for
> > > -mnarrow-gp-writes in aarch64.opt (simplifying the logic in
> > > pass_narrow_gp_writes::gate accordingly)?
> >
> > I think we should remove `-mnarrow-gp-writes` entirely.  With it on by
> default
> > It can be disabled with the pass manager's standard -fdisable-rtl-
> narrow_gp_writes
> > so there's no need to the target option anymore.
> 
> I don't think the -m option can just be removed, since it is already present in
> the GCC 16 release.

Flags can always be deprecated and removed.  We've done so before.
That said I had expected this flag to be marked with "Undocumented" as it has
no point as a user visible flag.

It's basically replicating -fenable-rtl-narrow_gp_writes would have worked fine to
enable it, and that is already maintained... So next time I don't think we should
add an m option that just turns on a pass..

> 
> >
> > This would also be more inline with other generic passes.  Or do you see a
> value in
> > having it?
> >
> > >
> > > Or would you prefer to keep it so that the pass can be turned off for
> > > particular cores if required / to minimize churn in case a reversion is
> > > needed?
> > >
> >
> > I wanted to keep a way to disable it since I don't know if it'll do anything
> > weird on partner cores.  So I think I'd like the tune for now, but when/if
> > this moves to a middle-end pass to drop it.
> 
> That's fair enough, let's keep the tune flag in that case, so the original patch
> is OK from my POV.

Cool,
Tamar

> 
> Thanks,
> Alex
> 
> >
> > So I'll respin dropping the `-m` flag if you agree.
> 
> >
> > Thanks,
> > Tamar
> >
> > > Thanks,
> > > Alex
> > >
> > > >
> > > >  /* Enables dispatch scheduling.  */
> > > >  AARCH64_EXTRA_TUNING_OPTION ("dispatch_sched",
> DISPATCH_SCHED)
> > > >
> > > >
> > > > --
> > >
> > > > diff --git a/gcc/config/aarch64/aarch64-tuning-flags.def
> > > b/gcc/config/aarch64/aarch64-tuning-flags.def
> > > > index
> > >
> 882daa4b4312039f96dcde1295179be3ab3da0d0..058dadecccaac458e30a
> > > 6585b558581a7bef6f54 100644
> > > > --- a/gcc/config/aarch64/aarch64-tuning-flags.def
> > > > +++ b/gcc/config/aarch64/aarch64-tuning-flags.def
> > > > @@ -67,7 +67,8 @@ AARCH64_EXTRA_TUNING_OPTION
> > > ("cheap_fpmr_write", CHEAP_FPMR_WRITE)
> > > >
> > > >  /* Baseline tuning settings suitable for all modern cores.  */
> > > >  #define AARCH64_EXTRA_TUNE_BASE
> > > (AARCH64_EXTRA_TUNE_CHEAP_SHIFT_EXTEND	\
> > > > -				 |
> > > AARCH64_EXTRA_TUNE_FULLY_PIPELINED_FMA)
> > > > +				 |
> > > AARCH64_EXTRA_TUNE_FULLY_PIPELINED_FMA \
> > > > +				 |
> > > AARCH64_EXTRA_TUNE_NARROW_GP_WRITES)
> > > >
> > > >  /* Enables dispatch scheduling.  */
> > > >  AARCH64_EXTRA_TUNING_OPTION ("dispatch_sched",
> DISPATCH_SCHED)
> > > >
> >
  
Andrew Pinski May 16, 2026, 5:03 a.m. UTC | #6
On Wed, May 6, 2026 at 6:01 AM Tamar Christina <tamar.christina@arm.com> wrote:
>
> This turns on the GPR narrowing pass for all AArch64 targets.
>
> Bootstrapped Regtested on aarch64-none-linux-gnu and no issues.
>
> Any objections?

Just FYI, there was a reason compile time jump (16.5%) with this patch
with `-O2 -g` on the testcase from PR 69609 as graphed at
https://lnt.opensuse.org/db_default/v4/CPP/graph?plot.0=685.630.8 .

Note I have not looked to see what caused the previous increases back
in August and September of last year yet either.

Thanks,
Andrea

>
> Thanks,
> Tamar
>
> gcc/ChangeLog:
>
>         * config/aarch64/aarch64-tuning-flags.def
>         (AARCH64_EXTRA_TUNE_BASE): Add AARCH64_EXTRA_TUNE_NARROW_GP_WRITES.
>
> ---
> diff --git a/gcc/config/aarch64/aarch64-tuning-flags.def b/gcc/config/aarch64/aarch64-tuning-flags.def
> index 882daa4b4312039f96dcde1295179be3ab3da0d0..058dadecccaac458e30a6585b558581a7bef6f54 100644
> --- a/gcc/config/aarch64/aarch64-tuning-flags.def
> +++ b/gcc/config/aarch64/aarch64-tuning-flags.def
> @@ -67,7 +67,8 @@ AARCH64_EXTRA_TUNING_OPTION ("cheap_fpmr_write", CHEAP_FPMR_WRITE)
>
>  /* Baseline tuning settings suitable for all modern cores.  */
>  #define AARCH64_EXTRA_TUNE_BASE (AARCH64_EXTRA_TUNE_CHEAP_SHIFT_EXTEND \
> -                                | AARCH64_EXTRA_TUNE_FULLY_PIPELINED_FMA)
> +                                | AARCH64_EXTRA_TUNE_FULLY_PIPELINED_FMA \
> +                                | AARCH64_EXTRA_TUNE_NARROW_GP_WRITES)
>
>  /* Enables dispatch scheduling.  */
>  AARCH64_EXTRA_TUNING_OPTION ("dispatch_sched", DISPATCH_SCHED)
>
>
> --
  
Richard Sandiford May 18, 2026, 5:18 p.m. UTC | #7
Andrew Pinski <andrew.pinski@oss.qualcomm.com> writes:
> On Wed, May 6, 2026 at 6:01 AM Tamar Christina <tamar.christina@arm.com>
> wrote:
>>
>> This turns on the GPR narrowing pass for all AArch64 targets.
>>
>> Bootstrapped Regtested on aarch64-none-linux-gnu and no issues.
>>
>> Any objections?
>
> Just FYI, there was a reason compile time jump (16.5%) with this patch
> with `-O2 -g` on the testcase from PR 69609 as graphed at
> https://lnt.opensuse.org/db_default/v4/CPP/graph?plot.0=685.630.8 .
>
> Note I have not looked to see what caused the previous increases back
> in August and September of last year yet either.

Just to confirm what I said in the other thread: this isn't the pass's
fault.  It seems to be an issue with rtl-ssa.  (Specifically post-RA
rtl-ssa; pre-RA seems ok.)

I only see it on native aarch64, rather than x86_64-x-aarch64.
And it seems to be due to poor cache behaviour, rather than excess work.
I'll try to look deeper soon.

Thanks,
Richard

>
> Thanks,
> Andrea
>
>>
>> Thanks,
>> Tamar
>>
>> gcc/ChangeLog:
>>
>>         * config/aarch64/aarch64-tuning-flags.def
>>         (AARCH64_EXTRA_TUNE_BASE): Add AARCH64_EXTRA_TUNE_NARROW_GP_WRITES.
>>
>> ---
>> diff --git a/gcc/config/aarch64/aarch64-tuning-flags.def b/gcc/config/aarch64/aarch64-tuning-flags.def
>> index 882daa4b4312039f96dcde1295179be3ab3da0d0..058dadecccaac458e30a6585b558581a7bef6f54 100644
>> --- a/gcc/config/aarch64/aarch64-tuning-flags.def
>> +++ b/gcc/config/aarch64/aarch64-tuning-flags.def
>> @@ -67,7 +67,8 @@ AARCH64_EXTRA_TUNING_OPTION ("cheap_fpmr_write", CHEAP_FPMR_WRITE)
>>
>>  /* Baseline tuning settings suitable for all modern cores.  */
>>  #define AARCH64_EXTRA_TUNE_BASE (AARCH64_EXTRA_TUNE_CHEAP_SHIFT_EXTEND \
>> -                                | AARCH64_EXTRA_TUNE_FULLY_PIPELINED_FMA)
>> +                                | AARCH64_EXTRA_TUNE_FULLY_PIPELINED_FMA \
>> +                                | AARCH64_EXTRA_TUNE_NARROW_GP_WRITES)
>>
>>  /* Enables dispatch scheduling.  */
>>  AARCH64_EXTRA_TUNING_OPTION ("dispatch_sched", DISPATCH_SCHED)
>>
>>
>> --
  

Patch

diff --git a/gcc/config/aarch64/aarch64-tuning-flags.def b/gcc/config/aarch64/aarch64-tuning-flags.def
index 882daa4b4312039f96dcde1295179be3ab3da0d0..058dadecccaac458e30a6585b558581a7bef6f54 100644
--- a/gcc/config/aarch64/aarch64-tuning-flags.def
+++ b/gcc/config/aarch64/aarch64-tuning-flags.def
@@ -67,7 +67,8 @@  AARCH64_EXTRA_TUNING_OPTION ("cheap_fpmr_write", CHEAP_FPMR_WRITE)
 
 /* Baseline tuning settings suitable for all modern cores.  */
 #define AARCH64_EXTRA_TUNE_BASE (AARCH64_EXTRA_TUNE_CHEAP_SHIFT_EXTEND	\
-				 | AARCH64_EXTRA_TUNE_FULLY_PIPELINED_FMA)
+				 | AARCH64_EXTRA_TUNE_FULLY_PIPELINED_FMA \
+				 | AARCH64_EXTRA_TUNE_NARROW_GP_WRITES)
 
 /* Enables dispatch scheduling.  */
 AARCH64_EXTRA_TUNING_OPTION ("dispatch_sched", DISPATCH_SCHED)