public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH][ARM] Tweak HONOR_REG_ALLOC_ORDER
@ 2019-09-09 17:05 Wilco Dijkstra
  2019-10-10 17:26 ` Wilco Dijkstra
  2019-10-10 22:55 ` Ramana Radhakrishnan
  0 siblings, 2 replies; 5+ messages in thread
From: Wilco Dijkstra @ 2019-09-09 17:05 UTC (permalink / raw)
  To: GCC Patches, Kyrylo Tkachov, Richard Earnshaw; +Cc: nd

Setting HONOR_REG_ALLOC_ORDER improves codesize with -Os, however it generates
slower and larger code with -O2 and higher.  So only set it when optimizing for
size.  On Cortex-A57 this improves SPECINT2006 by 0.15% and SPECFP2006 by 0.25%
while reducing codesize.

Bootstrap OK, OK for commit?

ChangeLog:
2019-09-09  Wilco Dijkstra  <wdijkstr@arm.com>

	* config/arm/arm.h (HONOR_REG_ALLOC_ORDER): Set when optimizing for size.

--
diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
index 8d023389eec469ad9c8a4e88edebdad5f3c23769..e3473e29fbbb964ff1136c226fbe30d35dbf7b39 100644
--- a/gcc/config/arm/arm.h
+++ b/gcc/config/arm/arm.h
@@ -1065,9 +1065,8 @@ extern int arm_regs_in_sequence[];
 /* Use different register alloc ordering for Thumb.  */
 #define ADJUST_REG_ALLOC_ORDER arm_order_regs_for_local_alloc ()
 
-/* Tell IRA to use the order we define rather than messing it up with its
-   own cost calculations.  */
-#define HONOR_REG_ALLOC_ORDER 1
+/* Tell IRA to use the order we define when optimizing for size.  */
+#define HONOR_REG_ALLOC_ORDER optimize_size
 
 /* Interrupt functions can only use registers that have already been
    saved by the prologue, even if they would normally be

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

* Re: [PATCH][ARM] Tweak HONOR_REG_ALLOC_ORDER
  2019-09-09 17:05 [PATCH][ARM] Tweak HONOR_REG_ALLOC_ORDER Wilco Dijkstra
@ 2019-10-10 17:26 ` Wilco Dijkstra
  2019-10-10 22:55 ` Ramana Radhakrishnan
  1 sibling, 0 replies; 5+ messages in thread
From: Wilco Dijkstra @ 2019-10-10 17:26 UTC (permalink / raw)
  To: GCC Patches, Kyrylo Tkachov, Richard Earnshaw, Richard Sandiford; +Cc: nd

ping

Setting HONOR_REG_ALLOC_ORDER improves codesize with -Os, however it generates
slower and larger code with -O2 and higher.  So only set it when optimizing for
size.  On Cortex-A57 this improves SPECINT2006 by 0.15% and SPECFP2006 by 0.25%
while reducing codesize.

Bootstrap OK, OK for commit?

ChangeLog:
2019-09-09  Wilco Dijkstra  <wdijkstr@arm.com>

        * config/arm/arm.h (HONOR_REG_ALLOC_ORDER): Set when optimizing for size.

--
diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
index 8d023389eec469ad9c8a4e88edebdad5f3c23769..e3473e29fbbb964ff1136c226fbe30d35dbf7b39 100644
--- a/gcc/config/arm/arm.h
+++ b/gcc/config/arm/arm.h
@@ -1065,9 +1065,8 @@ extern int arm_regs_in_sequence[];
 /* Use different register alloc ordering for Thumb.  */
 #define ADJUST_REG_ALLOC_ORDER arm_order_regs_for_local_alloc ()
 
-/* Tell IRA to use the order we define rather than messing it up with its
-   own cost calculations.  */
-#define HONOR_REG_ALLOC_ORDER 1
+/* Tell IRA to use the order we define when optimizing for size.  */
+#define HONOR_REG_ALLOC_ORDER optimize_size
 
 /* Interrupt functions can only use registers that have already been
    saved by the prologue, even if they would normally be


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

* Re: [PATCH][ARM] Tweak HONOR_REG_ALLOC_ORDER
  2019-09-09 17:05 [PATCH][ARM] Tweak HONOR_REG_ALLOC_ORDER Wilco Dijkstra
  2019-10-10 17:26 ` Wilco Dijkstra
@ 2019-10-10 22:55 ` Ramana Radhakrishnan
  2019-10-11 14:53   ` Wilco Dijkstra
  1 sibling, 1 reply; 5+ messages in thread
From: Ramana Radhakrishnan @ 2019-10-10 22:55 UTC (permalink / raw)
  To: Wilco Dijkstra; +Cc: GCC Patches, Kyrylo Tkachov, Richard Earnshaw, nd

On Mon, Sep 9, 2019 at 6:05 PM Wilco Dijkstra <Wilco.Dijkstra@arm.com> wrote:
>
> Setting HONOR_REG_ALLOC_ORDER improves codesize with -Os, however it generates
> slower and larger code with -O2 and higher.  So only set it when optimizing for
> size.  On Cortex-A57 this improves SPECINT2006 by 0.15% and SPECFP2006 by 0.25%
> while reducing codesize.
>
> Bootstrap OK, OK for commit?
>
> ChangeLog:
> 2019-09-09  Wilco Dijkstra  <wdijkstr@arm.com>
>
>         * config/arm/arm.h (HONOR_REG_ALLOC_ORDER): Set when optimizing for size.
>
> --
> diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
> index 8d023389eec469ad9c8a4e88edebdad5f3c23769..e3473e29fbbb964ff1136c226fbe30d35dbf7b39 100644
> --- a/gcc/config/arm/arm.h
> +++ b/gcc/config/arm/arm.h
> @@ -1065,9 +1065,8 @@ extern int arm_regs_in_sequence[];
>  /* Use different register alloc ordering for Thumb.  */
>  #define ADJUST_REG_ALLOC_ORDER arm_order_regs_for_local_alloc ()
>
> -/* Tell IRA to use the order we define rather than messing it up with its
> -   own cost calculations.  */
> -#define HONOR_REG_ALLOC_ORDER 1
> +/* Tell IRA to use the order we define when optimizing for size.  */
> +#define HONOR_REG_ALLOC_ORDER optimize_size

My only question would be whether it's more suitable to use
optimize_function_for_size_p(cfun) instead as IIRC that gives us a
chance with lto rather than the global optimize_size.

Otherwise ok .

regards
Ramana


>
>  /* Interrupt functions can only use registers that have already been
>     saved by the prologue, even if they would normally be

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

* Re: [PATCH][ARM] Tweak HONOR_REG_ALLOC_ORDER
  2019-10-10 22:55 ` Ramana Radhakrishnan
@ 2019-10-11 14:53   ` Wilco Dijkstra
  2019-10-11 19:47     ` Ramana Radhakrishnan
  0 siblings, 1 reply; 5+ messages in thread
From: Wilco Dijkstra @ 2019-10-11 14:53 UTC (permalink / raw)
  To: Ramana Radhakrishnan; +Cc: GCC Patches, Kyrylo Tkachov, Richard Earnshaw, nd

Hi Ramana,

> My only question would be whether it's more suitable to use
> optimize_function_for_size_p(cfun) instead as IIRC that gives us a
> chance with lto rather than the global optimize_size.

Yes that is even better and that defaults to optimize_size if cfun isn't
set. I've committed this:

diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
index 8b67c9c3657b312be223ab60c01969958baa9ed3..5fad1e5bcc2bc448489fdc8239c676246bbc8879 100644
--- a/gcc/config/arm/arm.h
+++ b/gcc/config/arm/arm.h
@@ -1068,9 +1068,8 @@ extern int arm_regs_in_sequence[];
 /* Use different register alloc ordering for Thumb.  */
 #define ADJUST_REG_ALLOC_ORDER arm_order_regs_for_local_alloc ()
 
-/* Tell IRA to use the order we define rather than messing it up with its
-   own cost calculations.  */
-#define HONOR_REG_ALLOC_ORDER 1
+/* Tell IRA to use the order we define when optimizing for size.  */
+#define HONOR_REG_ALLOC_ORDER optimize_function_for_size_p (cfun)
 
 /* Interrupt functions can only use registers that have already been
    saved by the prologue, even if they would normally be

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

* Re: [PATCH][ARM] Tweak HONOR_REG_ALLOC_ORDER
  2019-10-11 14:53   ` Wilco Dijkstra
@ 2019-10-11 19:47     ` Ramana Radhakrishnan
  0 siblings, 0 replies; 5+ messages in thread
From: Ramana Radhakrishnan @ 2019-10-11 19:47 UTC (permalink / raw)
  To: Wilco Dijkstra; +Cc: GCC Patches, Kyrylo Tkachov, Richard Earnshaw, nd

On Fri, Oct 11, 2019 at 3:52 PM Wilco Dijkstra <Wilco.Dijkstra@arm.com> wrote:
>
> Hi Ramana,
>
> > My only question would be whether it's more suitable to use
> > optimize_function_for_size_p(cfun) instead as IIRC that gives us a
> > chance with lto rather than the global optimize_size.
>
> Yes that is even better and that defaults to optimize_size if cfun isn't
> set. I've committed this:
>
> diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
> index 8b67c9c3657b312be223ab60c01969958baa9ed3..5fad1e5bcc2bc448489fdc8239c676246bbc8879 100644
> --- a/gcc/config/arm/arm.h
> +++ b/gcc/config/arm/arm.h
> @@ -1068,9 +1068,8 @@ extern int arm_regs_in_sequence[];
>  /* Use different register alloc ordering for Thumb.  */
>  #define ADJUST_REG_ALLOC_ORDER arm_order_regs_for_local_alloc ()
>
> -/* Tell IRA to use the order we define rather than messing it up with its
> -   own cost calculations.  */
> -#define HONOR_REG_ALLOC_ORDER 1
> +/* Tell IRA to use the order we define when optimizing for size.  */
> +#define HONOR_REG_ALLOC_ORDER optimize_function_for_size_p (cfun)

I'd be happy with a patch that goes and looks at more such uses in the
backend in your copious free time. hint hint.

R

>
>  /* Interrupt functions can only use registers that have already been
>     saved by the prologue, even if they would normally be

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

end of thread, other threads:[~2019-10-11 18:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-09 17:05 [PATCH][ARM] Tweak HONOR_REG_ALLOC_ORDER Wilco Dijkstra
2019-10-10 17:26 ` Wilco Dijkstra
2019-10-10 22:55 ` Ramana Radhakrishnan
2019-10-11 14:53   ` Wilco Dijkstra
2019-10-11 19:47     ` Ramana Radhakrishnan

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