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

Refactor AArch64 vector statement costing to use fractional costs.

AArch64 vector statement costing is refactored to use fractional costs, resolving a bug that incorrectly scaled statement costs and enabling easier extension b…

The AArch64 cost model’s handling of vector statements that expand to multiple instructions was previously bugged, leading to incorrect cost calculations by double-counting statement repetition. This commit refactors the relevant helper function (aarch64_ifn_vect_stmt_p renamed to aarch64_vect_stmt_cost) to use fractional_cost. This aligns it with the rest of the cost model, fixes the bug where statement counts were applied twice, and simplifies the integration of future costing enhancements.

In Details

The AArch64 cost model uses fractional_cost to represent costs that are not necessarily whole instructions, allowing for finer-grained optimization decisions. The aarch64_ifn_vect_stmt_p helper, which estimated extra instructions for vector statements, returned an integer count. Callers then multiplied this by statement cost and instruction count, leading to a double-counting bug. This patch renames the helper to aarch64_vect_stmt_cost and makes it accept and return fractional_cost, applying the cost adjustment directly to the statement's base cost rather than returning an additive in…

For Context
AArch64
The 64-bit ARM architecture, commonly used in mobile devices and servers.
cost model
A component of a compiler's optimization phase that estimates the performance cost (e.g., latency, instruction count) of different code sequences to guide optimization decisions.
fractional_cost
A data type or representation used in compiler cost models to express costs that are not whole numbers, allowing for more precise cost estimations.
vector statement
A programming statement that operates on multiple data elements simultaneously, often through SIMD (Single Instruction, Multiple Data) instructions.
SIMD
Single Instruction, Multiple Data. A class of parallel computers in Flynn's taxonomy. It describes computers with multiple processing elements that perform the same operation on multiple data points simultaneously.
dotproduct accumulator
A specific optimization pattern related to calculating dot products, often involving accumulator registers for improved performance.
Filed Under: aarch64optimizationcost modelbugfix