diff mbox

[AArch64,01/14] Use "generic" target, if no other default.

Message ID 1392757787-25629-2-git-send-email-philipp.tomsich@theobroma-systems.com
State New
Headers show

Commit Message

Philipp Tomsich Feb. 18, 2014, 9:09 p.m. UTC
The default target should be "generic", as Cortex-A53 includes
optional ISA features (CRC and CRYPTO) that are not required for
architectural compliance. The key difference between generic (which
already uses the cortexa53 pipeline model for scheduling) is the
absence of any optional ISA features in the "generic" target.
---
 gcc/config/aarch64/aarch64.c | 2 +-
 gcc/config/aarch64/aarch64.h | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)

Comments

Kyrylo Tkachov Feb. 21, 2014, 2:02 p.m. UTC | #1
Hi Philipp,

On 18/02/14 21:09, Philipp Tomsich wrote:
> The default target should be "generic", as Cortex-A53 includes
> optional ISA features (CRC and CRYPTO) that are not required for
> architectural compliance. The key difference between generic (which
> already uses the cortexa53 pipeline model for scheduling) is the
> absence of any optional ISA features in the "generic" target.
> ---
>   gcc/config/aarch64/aarch64.c | 2 +-
>   gcc/config/aarch64/aarch64.h | 4 ++--
>   2 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
> index 784bfa3..70dda00 100644
> --- a/gcc/config/aarch64/aarch64.c
> +++ b/gcc/config/aarch64/aarch64.c
> @@ -5244,7 +5244,7 @@ aarch64_override_options (void)
>   
>     /* If the user did not specify a processor, choose the default
>        one for them.  This will be the CPU set during configuration using
> -     --with-cpu, otherwise it is "cortex-a53".  */
> +     --with-cpu, otherwise it is "generic".  */
>     if (!selected_cpu)
>       {
>         selected_cpu = &all_cores[TARGET_CPU_DEFAULT & 0x3f];
> diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
> index 13c424c..b66a6b4 100644
> --- a/gcc/config/aarch64/aarch64.h
> +++ b/gcc/config/aarch64/aarch64.h
> @@ -472,10 +472,10 @@ enum target_cpus
>     TARGET_CPU_generic
>   };
>   
> -/* If there is no CPU defined at configure, use "cortex-a53" as default.  */
> +/* If there is no CPU defined at configure, use "generic" as default.  */
>   #ifndef TARGET_CPU_DEFAULT
>   #define TARGET_CPU_DEFAULT \
> -  (TARGET_CPU_cortexa53 | (AARCH64_CPU_DEFAULT_FLAGS << 6))
> +  (TARGET_CPU_generic | (AARCH64_CPU_DEFAULT_FLAGS << 6))
>   #endif
>   
>   /* The processor for which instructions should be scheduled.  */

I don't think this approach will work. The bug we have here is that in 
config.gcc when processing a --with-arch directive it will use the CPU flags of 
the sample cpu given for the architecture in aarch64-arches.def. This will cause 
it to use cortex-a53+fp+simd+crypto+crc when asked to configure for 
--with-arch=armv8-a. Instead it should be using the 4th field of the 
AARCH64_ARCH which specifies the ISA flags implied by the architecture. Then we 
would get cortex-a53+fp+simd.

Also, if no --with-arch or --with-cpu is specified, config.gcc will still 
specify TARGET_CPU_DEFAULT as TARGET_CPU_generic but without encoding the ISA 
flags (AARCH64_FL_FOR_ARCH8 in this case) for it in the upper bits of 
TARGET_CPU_DEFAULT, leading to an always defined TARGET_CPU_DEFAULT which will 
cause the last hunk in this patch to never be used and configuring.

I'm working on a fix for these issues.

HTH,
Kyrill
diff mbox

Patch

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index 784bfa3..70dda00 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -5244,7 +5244,7 @@  aarch64_override_options (void)
 
   /* If the user did not specify a processor, choose the default
      one for them.  This will be the CPU set during configuration using
-     --with-cpu, otherwise it is "cortex-a53".  */
+     --with-cpu, otherwise it is "generic".  */
   if (!selected_cpu)
     {
       selected_cpu = &all_cores[TARGET_CPU_DEFAULT & 0x3f];
diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
index 13c424c..b66a6b4 100644
--- a/gcc/config/aarch64/aarch64.h
+++ b/gcc/config/aarch64/aarch64.h
@@ -472,10 +472,10 @@  enum target_cpus
   TARGET_CPU_generic
 };
 
-/* If there is no CPU defined at configure, use "cortex-a53" as default.  */
+/* If there is no CPU defined at configure, use "generic" as default.  */
 #ifndef TARGET_CPU_DEFAULT
 #define TARGET_CPU_DEFAULT \
-  (TARGET_CPU_cortexa53 | (AARCH64_CPU_DEFAULT_FLAGS << 6))
+  (TARGET_CPU_generic | (AARCH64_CPU_DEFAULT_FLAGS << 6))
 #endif
 
 /* The processor for which instructions should be scheduled.  */