diff mbox

[AARCH64] Use selected cpu's tuning when no tuning parameter is specified.

Message ID 54770A95.2000108@arm.com
State New
Headers show

Commit Message

Renlin Li Nov. 27, 2014, 11:27 a.m. UTC
Hi all,

We have the following code in aarch64_override_options() function.

   /* The selected cpu may be an architecture, so lookup tuning by core 
ID.  */
   if (!selected_tune)
     selected_tune = &all_cores[selected_cpu->core];

However, the logic here is not right any more according to our current 
code. selected_cpu will never be an architecture at this point.

This patch will correct the behaviour and use selected_cpu's tuning 
directly if selected_tune is still not decided at this point.


We have the following consequence after the change.
Previously we have the following tuning settings with the following 
command line options:
-march=armv8-a --> selected_cpu = generic, aarch64_tune_params = 
cortexa53_tunings
Nothing specified and selected_cpu == generic --> aarch64_tune_params = 
cortexa53_tunings

After the change, we got something different:
-march=armv8-a --> selected_cpu = generic, aarch64_tune_params = 
generic_tunings
Nothing specified and selected_cpu == generic --> aarch64_tune_params = 
generic_tunings

All other configuration(-march, -mcpu, -mtune) combinations should be 
unaffected.


aarch64-none-elf has been built and tested on the model, no issue.

Is it Okay for trunk?


gcc/ChangeLog:

2014-11-27  Renlin Li  <Renlin.Li@arm.com>

     * config/aarch64/aarch64.c (aarch64_parse_cpu): Don't define 
selected_tune.
     (aarch64_override_options): Use selected_cpu's tuning.

Comments

Renlin Li Dec. 2, 2014, 5:01 p.m. UTC | #1
On 27/11/14 11:27, Renlin Li wrote:
> Hi all,
>
> We have the following code in aarch64_override_options() function.
>
>   /* The selected cpu may be an architecture, so lookup tuning by core 
> ID.  */
>   if (!selected_tune)
>     selected_tune = &all_cores[selected_cpu->core];
>
> However, the logic here is not right any more according to our current 
> code. selected_cpu will never be an architecture at this point.
>
> This patch will correct the behaviour and use selected_cpu's tuning 
> directly if selected_tune is still not decided at this point.
>
>
> We have the following consequence after the change.
> Previously we have the following tuning settings with the following 
> command line options:
> -march=armv8-a --> selected_cpu = generic, aarch64_tune_params = 
> cortexa53_tunings
> Nothing specified and selected_cpu == generic --> aarch64_tune_params 
> = cortexa53_tunings
>
> After the change, we got something different:
> -march=armv8-a --> selected_cpu = generic, aarch64_tune_params = 
> generic_tunings
> Nothing specified and selected_cpu == generic --> aarch64_tune_params 
> = generic_tunings
>
> All other configuration(-march, -mcpu, -mtune) combinations should be 
> unaffected.
>
>
> aarch64-none-elf has been built and tested on the model, no issue.
>
> Is it Okay for trunk?
>
>
> gcc/ChangeLog:
>
> 2014-11-27  Renlin Li  <Renlin.Li@arm.com>
>
>     * config/aarch64/aarch64.c (aarch64_parse_cpu): Don't define 
> selected_tune.
>     (aarch64_override_options): Use selected_cpu's tuning.
>
>

PING~

Regards,
Renlin
Marcus Shawcroft Dec. 4, 2014, 10:27 a.m. UTC | #2
On 27 November 2014 at 11:27, Renlin Li <renlin.li@arm.com> wrote:

> gcc/ChangeLog:
>
> 2014-11-27  Renlin Li  <Renlin.Li@arm.com>
>
>     * config/aarch64/aarch64.c (aarch64_parse_cpu): Don't define
> selected_tune.
>     (aarch64_override_options): Use selected_cpu's tuning.
>

OK and this is also broken in 4.9, could you prepare a backport please. /Marcus
diff mbox

Patch

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 1809513..0a8c303 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -6613,7 +6613,6 @@  aarch64_parse_cpu (void)
       if (strlen (cpu->name) == len && strncmp (cpu->name, str, len) == 0)
 	{
 	  selected_cpu = cpu;
-	  selected_tune = cpu;
 	  aarch64_isa_flags = selected_cpu->flags;
 
 	  if (ext != NULL)
@@ -6709,9 +6708,8 @@  aarch64_override_options (void)
 
   gcc_assert (selected_cpu);
 
-  /* The selected cpu may be an architecture, so lookup tuning by core ID.  */
   if (!selected_tune)
-    selected_tune = &all_cores[selected_cpu->core];
+    selected_tune = selected_cpu;
 
   aarch64_tune_flags = selected_tune->flags;
   aarch64_tune = selected_tune->core;