AArch64: Fix GCC 13 backport of big.Little CPU detection [PR118800]

Message ID patch-19214-tamar@arm.com
State Committed
Headers
Series AArch64: Fix GCC 13 backport of big.Little CPU detection [PR118800] |

Checks

Context Check Description
linaro-tcwg-bot/tcwg_gcc_build--master-aarch64 success Build passed
linaro-tcwg-bot/tcwg_simplebootstrap_build--master-aarch64-bootstrap success Build passed
linaro-tcwg-bot/tcwg_gcc_check--master-aarch64 fail Test failed
linaro-tcwg-bot/tcwg_simplebootstrap_build--master-arm-bootstrap success Build passed
linaro-tcwg-bot/tcwg_gcc_build--master-arm success Build passed
linaro-tcwg-bot/tcwg_gcc_check--master-arm success Test passed

Commit Message

Tamar Christina Feb. 10, 2025, 9:52 a.m. UTC
  Hi All,

It seems I ran regressions but forgot to check them last time `(*>?<*)?

On the GCC-13 branch the backport caused a failure due to the branch not having
generic-armv8-a and also it still treating the generic cpu special.  This made
it return NULL when trying to find the default CPU.

In GCC 13 we still had multiple structures with the same information and in this
case aarch64_cpu_data was missing the generic CPU which is in all_cores.

This corrects it by using "generc" instead and also adding it to
aarch64_cpu_data.

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

Ok for master?

Thanks,
Tamar

gcc/ChangeLog:

	PR target/118800
	* config/aarch64/driver-aarch64.cc (DEFAULT_CPU): Use generic instead of
	generic-armv8-a.
	(aarch64_cpu_data): Add generic.

gcc/testsuite/ChangeLog:

	PR target/118800
	* gcc.target/aarch64/cpunative/native_cpu_34.c: Update order.

---




--
  

Comments

Richard Sandiford Feb. 11, 2025, 10 p.m. UTC | #1
Tamar Christina <tamar.christina@arm.com> writes:
> Hi All,
>
> It seems I ran regressions but forgot to check them last time `(*>?<*)?
>
> On the GCC-13 branch the backport caused a failure due to the branch not having
> generic-armv8-a and also it still treating the generic cpu special.  This made
> it return NULL when trying to find the default CPU.
>
> In GCC 13 we still had multiple structures with the same information and in this
> case aarch64_cpu_data was missing the generic CPU which is in all_cores.
>
> This corrects it by using "generc" instead and also adding it to
> aarch64_cpu_data.
>
> Bootstrapped Regtested on aarch64-none-linux-gnu on GCC-13 branch and no issues.
>
> Ok for master?
>
> Thanks,
> Tamar
>
> gcc/ChangeLog:
>
> 	PR target/118800
> 	* config/aarch64/driver-aarch64.cc (DEFAULT_CPU): Use generic instead of
> 	generic-armv8-a.
> 	(aarch64_cpu_data): Add generic.
>
> gcc/testsuite/ChangeLog:
>
> 	PR target/118800
> 	* gcc.target/aarch64/cpunative/native_cpu_34.c: Update order.

OK, thanks.  Reading this made me think that INVALID_IMP and INVALID_CORE
might be better for the generic entries, rather than 0x0 and 0x0.
But that applies to trunk and gcc-14 too, so isn't something to change here.

Richard

>
> ---
>
> diff --git a/gcc/config/aarch64/driver-aarch64.cc b/gcc/config/aarch64/driver-aarch64.cc
> index ff4660f469cd5caaaa899c981ee8181d1794fade..acc44536629e814a2aea0e4b21e327da3fa5d6ea 100644
> --- a/gcc/config/aarch64/driver-aarch64.cc
> +++ b/gcc/config/aarch64/driver-aarch64.cc
> @@ -60,7 +60,7 @@ struct aarch64_core_data
>  #define ALL_VARIANTS ((unsigned)-1)
>  /* Default architecture to use if -mcpu=native did not detect a known CPU.  */
>  #define DEFAULT_ARCH "8A"
> -#define DEFAULT_CPU "generic-armv8-a"
> +#define DEFAULT_CPU "generic"
>  
>  #define AARCH64_CORE(CORE_NAME, CORE_IDENT, SCHED, ARCH, FLAGS, COSTS, IMP, PART, VARIANT) \
>    { CORE_NAME, #ARCH, IMP, PART, VARIANT, feature_deps::cpu_##CORE_IDENT },
> @@ -68,6 +68,7 @@ struct aarch64_core_data
>  static CONSTEXPR const aarch64_core_data aarch64_cpu_data[] =
>  {
>  #include "aarch64-cores.def"
> +  { "generic", "armv8-a", 0, 0, ALL_VARIANTS, 0},
>    { NULL, NULL, INVALID_IMP, INVALID_CORE, ALL_VARIANTS, 0 }
>  };
>  
> diff --git a/gcc/testsuite/gcc.target/aarch64/cpunative/native_cpu_34.c b/gcc/testsuite/gcc.target/aarch64/cpunative/native_cpu_34.c
> index 168140002a0f0205c0f552de0cce9b2d356e09e2..d2ff8156d8fc14fcc14ddd91f43f0b0fea15cc7b 100644
> --- a/gcc/testsuite/gcc.target/aarch64/cpunative/native_cpu_34.c
> +++ b/gcc/testsuite/gcc.target/aarch64/cpunative/native_cpu_34.c
> @@ -7,6 +7,6 @@ int main()
>    return 0;
>  }
>  
> -/* { dg-final { scan-assembler {\.arch armv8-a\+dotprod\+crc\+crypto\+sve2\n} } } */
> +/* { dg-final { scan-assembler {\.arch armv8-a\+crc\+dotprod\+crypto\+sve2\n} } } */
>  
>  /* Test a normal looking procinfo.  */
  

Patch

diff --git a/gcc/config/aarch64/driver-aarch64.cc b/gcc/config/aarch64/driver-aarch64.cc
index ff4660f469cd5caaaa899c981ee8181d1794fade..acc44536629e814a2aea0e4b21e327da3fa5d6ea 100644
--- a/gcc/config/aarch64/driver-aarch64.cc
+++ b/gcc/config/aarch64/driver-aarch64.cc
@@ -60,7 +60,7 @@  struct aarch64_core_data
 #define ALL_VARIANTS ((unsigned)-1)
 /* Default architecture to use if -mcpu=native did not detect a known CPU.  */
 #define DEFAULT_ARCH "8A"
-#define DEFAULT_CPU "generic-armv8-a"
+#define DEFAULT_CPU "generic"
 
 #define AARCH64_CORE(CORE_NAME, CORE_IDENT, SCHED, ARCH, FLAGS, COSTS, IMP, PART, VARIANT) \
   { CORE_NAME, #ARCH, IMP, PART, VARIANT, feature_deps::cpu_##CORE_IDENT },
@@ -68,6 +68,7 @@  struct aarch64_core_data
 static CONSTEXPR const aarch64_core_data aarch64_cpu_data[] =
 {
 #include "aarch64-cores.def"
+  { "generic", "armv8-a", 0, 0, ALL_VARIANTS, 0},
   { NULL, NULL, INVALID_IMP, INVALID_CORE, ALL_VARIANTS, 0 }
 };
 
diff --git a/gcc/testsuite/gcc.target/aarch64/cpunative/native_cpu_34.c b/gcc/testsuite/gcc.target/aarch64/cpunative/native_cpu_34.c
index 168140002a0f0205c0f552de0cce9b2d356e09e2..d2ff8156d8fc14fcc14ddd91f43f0b0fea15cc7b 100644
--- a/gcc/testsuite/gcc.target/aarch64/cpunative/native_cpu_34.c
+++ b/gcc/testsuite/gcc.target/aarch64/cpunative/native_cpu_34.c
@@ -7,6 +7,6 @@  int main()
   return 0;
 }
 
-/* { dg-final { scan-assembler {\.arch armv8-a\+dotprod\+crc\+crypto\+sve2\n} } } */
+/* { dg-final { scan-assembler {\.arch armv8-a\+crc\+dotprod\+crypto\+sve2\n} } } */
 
 /* Test a normal looking procinfo.  */