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

aarch64: Improve dot-product reduction latency cost

Optimizes integer vector reduction loops on AArch64 by better accounting for dot-product accumulator latency.

The aarch64 backend previously underestimated the cost of integer vector reductions that use dot products. This led to insufficient unrolling on cores with high dot-product accumulator latency. This change introduces a per-core reduc_dotprod_cost to accurately measure this latency, significantly improving performance for reduction loops, with a 1.9x to 2.7x speedup observed for certain loops at -O3.

In Details

The aarch64_in_loop_reduction_latency cost model, used in loop vectorization, incorrectly cost all integer vector reductions using int_stmt_cost. This patch introduces reduc_dotprod_cost to simd_vec_cost to specifically account for the accumulator latency of dot products (as used in DOT_PROD_EXPR, SAD_EXPR, and WIDEN_SUM_EXPR). This new cost is used by determine_suggested_unroll_factor, similar to the x86 implementation, improving unrolling for reduction-heavy loops. Tables for specific CPUs like ampere1 are updated to reflect higher latencies, increasing unroll factors and…

Filed Under: aarch64optimizationvectorization