public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH v2 2/2][ARM] Improve max_cond_insns setting for Cortex cores
@ 2019-12-03 13:45 Wilco Dijkstra
  2019-12-03 17:56 ` Kyrill Tkachov
  2019-12-06 10:38 ` Christophe Lyon
  0 siblings, 2 replies; 10+ messages in thread
From: Wilco Dijkstra @ 2019-12-03 13:45 UTC (permalink / raw)
  To: GCC Patches, Kyrylo Tkachov; +Cc: Richard Earnshaw, Richard Sandiford

Hi,

Part 2, split off from https://gcc.gnu.org/ml/gcc-patches/2019-11/msg00399.html

To enable cores to use the correct max_cond_insns setting, use the core-specific
tuning when a CPU/tune is selected unless -mrestrict-it is explicitly set.

On Cortex-A57 this gives 1.1% performance gain on SPECINT2006 as well as a
0.4% codesize reduction.

Bootstrapped on armhf. OK for commit?

ChangeLog:

2019-12-03  Wilco Dijkstra  <wdijkstr@arm.com>

        * config/arm/arm.c (arm_option_override_internal):
        Use max_cond_insns from CPU tuning unless -mrestrict-it is used.
--

diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
index daebe76352d62ad94556762b4e3bc3d0532ad411..5ed9046988996e56f754c5588e4d25d5ecdd6b03 100644
--- a/gcc/config/arm/arm.c
+++ b/gcc/config/arm/arm.c
@@ -3041,6 +3041,11 @@ arm_option_override_internal (struct gcc_options *opts,
   if (!TARGET_THUMB2_P (opts->x_target_flags) || !arm_arch_notm)
     opts->x_arm_restrict_it = 0;
 
+  /* Use the IT size from CPU specific tuning unless -mrestrict-it is used.  */
+  if (!opts_set->x_arm_restrict_it
+      && (opts_set->x_arm_cpu_string || opts_set->x_arm_tune_string))
+    opts->x_arm_restrict_it = 0;
+
   /* Enable -munaligned-access by default for
      - all ARMv6 architecture-based processors when compiling for a 32-bit ISA
      i.e. Thumb2 and ARM state only.

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

* Re: [PATCH v2 2/2][ARM] Improve max_cond_insns setting for Cortex cores
  2019-12-03 13:45 [PATCH v2 2/2][ARM] Improve max_cond_insns setting for Cortex cores Wilco Dijkstra
@ 2019-12-03 17:56 ` Kyrill Tkachov
  2019-12-06 10:38 ` Christophe Lyon
  1 sibling, 0 replies; 10+ messages in thread
From: Kyrill Tkachov @ 2019-12-03 17:56 UTC (permalink / raw)
  To: Wilco Dijkstra, GCC Patches; +Cc: Richard Earnshaw, Richard Sandiford


On 12/3/19 1:45 PM, Wilco Dijkstra wrote:
> Hi,
>
> Part 2, split off from 
> https://gcc.gnu.org/ml/gcc-patches/2019-11/msg00399.html
>
> To enable cores to use the correct max_cond_insns setting, use the 
> core-specific
> tuning when a CPU/tune is selected unless -mrestrict-it is explicitly set.
>
> On Cortex-A57 this gives 1.1% performance gain on SPECINT2006 as well as a
> 0.4% codesize reduction.
>
> Bootstrapped on armhf. OK for commit?
>
Ok.

Thanks,

Kyrill


> ChangeLog:
>
> 2019-12-03  Wilco Dijkstra  <wdijkstr@arm.com>
>
>         * config/arm/arm.c (arm_option_override_internal):
>         Use max_cond_insns from CPU tuning unless -mrestrict-it is used.
> --
>
> diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
> index 
> daebe76352d62ad94556762b4e3bc3d0532ad411..5ed9046988996e56f754c5588e4d25d5ecdd6b03 
> 100644
> --- a/gcc/config/arm/arm.c
> +++ b/gcc/config/arm/arm.c
> @@ -3041,6 +3041,11 @@ arm_option_override_internal (struct 
> gcc_options *opts,
>    if (!TARGET_THUMB2_P (opts->x_target_flags) || !arm_arch_notm)
>      opts->x_arm_restrict_it = 0;
>
> +  /* Use the IT size from CPU specific tuning unless -mrestrict-it is 
> used.  */
> +  if (!opts_set->x_arm_restrict_it
> +      && (opts_set->x_arm_cpu_string || opts_set->x_arm_tune_string))
> +    opts->x_arm_restrict_it = 0;
> +
>    /* Enable -munaligned-access by default for
>       - all ARMv6 architecture-based processors when compiling for a 
> 32-bit ISA
>       i.e. Thumb2 and ARM state only.

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

* Re: [PATCH v2 2/2][ARM] Improve max_cond_insns setting for Cortex cores
  2019-12-03 13:45 [PATCH v2 2/2][ARM] Improve max_cond_insns setting for Cortex cores Wilco Dijkstra
  2019-12-03 17:56 ` Kyrill Tkachov
@ 2019-12-06 10:38 ` Christophe Lyon
  2019-12-06 10:47   ` Wilco Dijkstra
  1 sibling, 1 reply; 10+ messages in thread
From: Christophe Lyon @ 2019-12-06 10:38 UTC (permalink / raw)
  To: Wilco Dijkstra
  Cc: GCC Patches, Kyrylo Tkachov, Richard Earnshaw, Richard Sandiford

On Tue, 3 Dec 2019 at 14:45, Wilco Dijkstra <Wilco.Dijkstra@arm.com> wrote:
>
> Hi,
>
> Part 2, split off from https://gcc.gnu.org/ml/gcc-patches/2019-11/msg00399.html
>
> To enable cores to use the correct max_cond_insns setting, use the core-specific
> tuning when a CPU/tune is selected unless -mrestrict-it is explicitly set.
>

Hi,

This patch (r278968) is causing regressions when building GCC
--target arm-none-linux-gnueabihf
--with-mode thumb
--with-cpu cortex-a57
--with-fpu crypto-neon-fp-armv8
because the assembler (gas version 2.33.1) complains:
/ccc7z5eW.s:4267: IT blocks containing more than one conditional
instruction are performance deprecated in ARMv8-A and ARMv8-R

I guess that's related to what you say about -mrestrict-it ?

Christophe

> On Cortex-A57 this gives 1.1% performance gain on SPECINT2006 as well as a
> 0.4% codesize reduction.
>
> Bootstrapped on armhf. OK for commit?
>
> ChangeLog:
>
> 2019-12-03  Wilco Dijkstra  <wdijkstr@arm.com>
>
>         * config/arm/arm.c (arm_option_override_internal):
>         Use max_cond_insns from CPU tuning unless -mrestrict-it is used.
> --
>
> diff --git a/gcc/config/arm/arm.c b/gcc/config/arm/arm.c
> index daebe76352d62ad94556762b4e3bc3d0532ad411..5ed9046988996e56f754c5588e4d25d5ecdd6b03 100644
> --- a/gcc/config/arm/arm.c
> +++ b/gcc/config/arm/arm.c
> @@ -3041,6 +3041,11 @@ arm_option_override_internal (struct gcc_options *opts,
>    if (!TARGET_THUMB2_P (opts->x_target_flags) || !arm_arch_notm)
>      opts->x_arm_restrict_it = 0;
>
> +  /* Use the IT size from CPU specific tuning unless -mrestrict-it is used.  */
> +  if (!opts_set->x_arm_restrict_it
> +      && (opts_set->x_arm_cpu_string || opts_set->x_arm_tune_string))
> +    opts->x_arm_restrict_it = 0;
> +
>    /* Enable -munaligned-access by default for
>       - all ARMv6 architecture-based processors when compiling for a 32-bit ISA
>       i.e. Thumb2 and ARM state only.

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

* Re: [PATCH v2 2/2][ARM] Improve max_cond_insns setting for Cortex cores
  2019-12-06 10:38 ` Christophe Lyon
@ 2019-12-06 10:47   ` Wilco Dijkstra
  2019-12-06 11:03     ` Christophe Lyon
  0 siblings, 1 reply; 10+ messages in thread
From: Wilco Dijkstra @ 2019-12-06 10:47 UTC (permalink / raw)
  To: Christophe Lyon
  Cc: GCC Patches, Kyrylo Tkachov, Richard Earnshaw, Richard Sandiford

Hi Christophe,

> This patch (r278968) is causing regressions when building GCC
> --target arm-none-linux-gnueabihf
> --with-mode thumb
> --with-cpu cortex-a57
> --with-fpu crypto-neon-fp-armv8
> because the assembler (gas version 2.33.1) complains:
> /ccc7z5eW.s:4267: IT blocks containing more than one conditional
> instruction are performance deprecated in ARMv8-A and ARMv8-R
>
> I guess that's related to what you say about -mrestrict-it ?

Yes it looks like that unnecessary warning hasn't been silenced in latest binutils,
but it should be easy to turn off.

Cheers,
Wilco

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

* Re: [PATCH v2 2/2][ARM] Improve max_cond_insns setting for Cortex cores
  2019-12-06 10:47   ` Wilco Dijkstra
@ 2019-12-06 11:03     ` Christophe Lyon
  2019-12-06 15:03       ` Wilco Dijkstra
  0 siblings, 1 reply; 10+ messages in thread
From: Christophe Lyon @ 2019-12-06 11:03 UTC (permalink / raw)
  To: Wilco Dijkstra
  Cc: GCC Patches, Kyrylo Tkachov, Richard Earnshaw, Richard Sandiford

On Fri, 6 Dec 2019 at 11:47, Wilco Dijkstra <Wilco.Dijkstra@arm.com> wrote:
>
> Hi Christophe,
>
> > This patch (r278968) is causing regressions when building GCC
> > --target arm-none-linux-gnueabihf
> > --with-mode thumb
> > --with-cpu cortex-a57
> > --with-fpu crypto-neon-fp-armv8
> > because the assembler (gas version 2.33.1) complains:
> > /ccc7z5eW.s:4267: IT blocks containing more than one conditional
> > instruction are performance deprecated in ARMv8-A and ARMv8-R
> >
> > I guess that's related to what you say about -mrestrict-it ?
>
> Yes it looks like that unnecessary warning hasn't been silenced in latest binutils,
> but it should be easy to turn off.
>
Do you mean that binutils should be "fixed" not to emit this warning
(since you say it's unnecessary), or GCC made not to emit the
offending sequence?


> Cheers,
> Wilco

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

* Re: [PATCH v2 2/2][ARM] Improve max_cond_insns setting for Cortex cores
  2019-12-06 11:03     ` Christophe Lyon
@ 2019-12-06 15:03       ` Wilco Dijkstra
  2019-12-06 15:36         ` Christophe Lyon
  0 siblings, 1 reply; 10+ messages in thread
From: Wilco Dijkstra @ 2019-12-06 15:03 UTC (permalink / raw)
  To: Christophe Lyon
  Cc: GCC Patches, Kyrylo Tkachov, Richard Earnshaw, Richard Sandiford

Hi Christophe,

I've added an option to allow the warning to be enabled/disabled:
https://sourceware.org/ml/binutils/2019-12/msg00093.html

Cheers,
Wilco

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

* Re: [PATCH v2 2/2][ARM] Improve max_cond_insns setting for Cortex cores
  2019-12-06 15:03       ` Wilco Dijkstra
@ 2019-12-06 15:36         ` Christophe Lyon
  2019-12-06 18:47           ` Wilco Dijkstra
  0 siblings, 1 reply; 10+ messages in thread
From: Christophe Lyon @ 2019-12-06 15:36 UTC (permalink / raw)
  To: Wilco Dijkstra
  Cc: GCC Patches, Kyrylo Tkachov, Richard Earnshaw, Richard Sandiford

On Fri, 6 Dec 2019 at 16:03, Wilco Dijkstra <Wilco.Dijkstra@arm.com> wrote:
>
> Hi Christophe,
>
> I've added an option to allow the warning to be enabled/disabled:
> https://sourceware.org/ml/binutils/2019-12/msg00093.html
>
Thanks.

In practice, how do you activate it when running the GCC testsuite? Do
you plan to send a GCC patch to enable this assembler flag, or do you
locally enable that option by default in your binutils?
FWIW, I've also noticed that the whole libstdc++ testsuite is somehow
"deactivated" (I have 0 pass, 0 fail etc...)  after your GCC patch
when configuring GCC
--target arm-none-linux-gnueabihf
--with-mode thumb
--with-cpu cortex-a57
--with-fpu crypto-neon-fp-armv8

Or do you filter these warnings in dejagnu ?

> Cheers,
> Wilco

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

* Re: [PATCH v2 2/2][ARM] Improve max_cond_insns setting for Cortex cores
  2019-12-06 15:36         ` Christophe Lyon
@ 2019-12-06 18:47           ` Wilco Dijkstra
  2019-12-09  9:40             ` Christophe Lyon
  0 siblings, 1 reply; 10+ messages in thread
From: Wilco Dijkstra @ 2019-12-06 18:47 UTC (permalink / raw)
  To: Christophe Lyon
  Cc: GCC Patches, Kyrylo Tkachov, Richard Earnshaw, Richard Sandiford

Hi Christophe,

> In practice, how do you activate it when running the GCC testsuite? Do
> you plan to send a GCC patch to enable this assembler flag, or do you
> locally enable that option by default in your binutils?

The warning is off by default so there is no need to do anything in the testsuite,
you just need a fixed binutils.

> FWIW, I've also noticed that the whole libstdc++ testsuite is somehow
> "deactivated" (I have 0 pass, 0 fail etc...)  after your GCC patch
> when configuring GCC
> --target arm-none-linux-gnueabihf
> --with-mode thumb
> --with-cpu cortex-a57
> --with-fpu crypto-neon-fp-armv8

Well it's possible a configure check failed somehow.

Cheers,
Wilco

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

* Re: [PATCH v2 2/2][ARM] Improve max_cond_insns setting for Cortex cores
  2019-12-06 18:47           ` Wilco Dijkstra
@ 2019-12-09  9:40             ` Christophe Lyon
  2019-12-09 10:34               ` Wilco Dijkstra
  0 siblings, 1 reply; 10+ messages in thread
From: Christophe Lyon @ 2019-12-09  9:40 UTC (permalink / raw)
  To: Wilco Dijkstra
  Cc: GCC Patches, Kyrylo Tkachov, Richard Earnshaw, Richard Sandiford

On Fri, 6 Dec 2019 at 19:47, Wilco Dijkstra <Wilco.Dijkstra@arm.com> wrote:
>
> Hi Christophe,
>
> > In practice, how do you activate it when running the GCC testsuite? Do
> > you plan to send a GCC patch to enable this assembler flag, or do you
> > locally enable that option by default in your binutils?
>
> The warning is off by default so there is no need to do anything in the testsuite,
> you just need a fixed binutils.
>
Don't we want to fix GCC to stop generating the offending sequence?

> > FWIW, I've also noticed that the whole libstdc++ testsuite is somehow
> > "deactivated" (I have 0 pass, 0 fail etc...)  after your GCC patch
> > when configuring GCC
> > --target arm-none-linux-gnueabihf
> > --with-mode thumb
> > --with-cpu cortex-a57
> > --with-fpu crypto-neon-fp-armv8
>
> Well it's possible a configure check failed somehow.
>
Yes, it fails when compiling testsuite_abi.cc, resulting in tcl errors.


> Cheers,
> Wilco

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

* Re: [PATCH v2 2/2][ARM] Improve max_cond_insns setting for Cortex cores
  2019-12-09  9:40             ` Christophe Lyon
@ 2019-12-09 10:34               ` Wilco Dijkstra
  0 siblings, 0 replies; 10+ messages in thread
From: Wilco Dijkstra @ 2019-12-09 10:34 UTC (permalink / raw)
  To: Christophe Lyon
  Cc: GCC Patches, Kyrylo Tkachov, Richard Earnshaw, Richard Sandiford

Hi Christophe,

>> The warning is off by default so there is no need to do anything in the testsuite,
>> you just need a fixed binutils.
>>
>
> Don't we want to fix GCC to stop generating the offending sequence?

Why? All ARMv8 implementations have to support it, and despite the warning 
code actually runs significantly faster.

>> Well it's possible a configure check failed somehow.
>>
> Yes, it fails when compiling testsuite_abi.cc, resulting in tcl errors.

It's odd it's that sensitive to extra warnings, but anyway...

Cheers,
Wilco

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

end of thread, other threads:[~2019-12-09 10:34 UTC | newest]

Thread overview: 10+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-12-03 13:45 [PATCH v2 2/2][ARM] Improve max_cond_insns setting for Cortex cores Wilco Dijkstra
2019-12-03 17:56 ` Kyrill Tkachov
2019-12-06 10:38 ` Christophe Lyon
2019-12-06 10:47   ` Wilco Dijkstra
2019-12-06 11:03     ` Christophe Lyon
2019-12-06 15:03       ` Wilco Dijkstra
2019-12-06 15:36         ` Christophe Lyon
2019-12-06 18:47           ` Wilco Dijkstra
2019-12-09  9:40             ` Christophe Lyon
2019-12-09 10:34               ` Wilco Dijkstra

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