GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
gcc/aarch64 Performance Win

Improve -mcpu=native for unknown AArch64 CPUs with SVE2.

When -mcpu=native encounters an unknown AArch64 CPU with SVE2 support, GCC now defaults to generic-armv9-a instead of generic-armv8-a for a more accurate basel…

Previously, if GCC’s -mcpu=native encountered an unrecognized AArch64 CPU, it would fall back to generic-armv8-a and incorporate reported extensions. This change enhances the fallback for CPUs reporting SVE2 by using generic-armv9-a as the baseline. This provides a more accurate architectural starting point, while still respecting reported extensions and carefully handling features not explicitly reported by the CPU, such as PREDRES.

In Details

For unknown AArch64 CPUs, -mcpu=native currently uses generic-armv8-a as a base and adds extensions found in /proc/cpuinfo. This commit refines that logic: if SVE2 is detected (even without explicit Armv9 baseline features like PREDRES being directly queryable), it selects generic-armv9-a as the baseline. It then carefully applies reported extensions and avoids assuming un-reported Armv9 features for unknown CPUs, preventing over-generation of instructions. The goal is to provide a safe and reasonably accurate CPU baseline for heterogeneous or unrecognized systems.

For Context
AArch64
The 64-bit ARM architecture, commonly used in mobile devices and servers.
-mcpu=native
A GCC command-line option that instructs the compiler to detect the host CPU and optimize code specifically for it, using its features and instruction set.
SVE2
Scalable Vector Extension 2, an advanced vector processing instruction set for ARM architectures that allows for variable vector lengths.
generic-armv8-a
A generic CPU profile for the ARMv8-A architecture, representing a baseline set of features without specific microarchitectural optimizations.
generic-armv9-a
A generic CPU profile for the ARMv9-A architecture, which includes features beyond ARMv8-A, such as enhanced security and SVE2 support.
MIDR
Main Identification Register, a processor register on ARM systems that contains information about the processor's implementer, architecture, variant, and part number.
PREDRES
Predicate Register State preservation, a feature in some ARM architectures related to efficient handling of conditional operations in vector processing.
Filed Under: aarch64optimizationcpu detection