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

aarch64: Use SVE2 ADALP for widening sums

Optimize widening sums on AArch64 by using the SVE2 SADALP/UADALP instructions.

The compiler now utilizes the SVE2 SADALP and UADALP instructions for widening sums on AArch64, replacing the less efficient sequence of SADDWB/SADDWT or UADDWB/UADDWT. This change is applicable to scenarios like the FLAC encoder’s residual sum calculation, where 32-bit values are accumulated into a 64-bit sum. The new instructions perform the pairwise widening accumulation in a single step, improving performance.

In Details

This commit introduces the use of SVE2's SADALP and UADALP instructions within the AArch64 backend's expanders for reduc_widen_ssum and reduc_widen_usum. Previously, these widening sums were expanded using two instructions (SADDWB/SADDWT or UADDWB/UADDWT), which added one half of a narrow vector to the accumulator. The SADALP/UADALP instructions perform this pairwise widening accumulation in a single instruction, offering a performance benefit. The patterns are adapted to use an all-true predicate since the optab is unpredicated.

For Context
SVE2
Scalable Vector Extension 2, an extension to the ARM architecture that provides advanced vector processing capabilities. It allows for vectors of variable length.
widening sum
A summation operation where the elements being added are of a narrower data type than the accumulator, requiring the result to be widened to avoid overflow.
SADALP/UADALP
ARM SVE2 instructions that perform a pairwise widening signed/unsigned accumulation. They add elements from a narrow vector register to corresponding elements in a wider vector register.
optab
Abbreviation for 'operation table'. A data structure in GCC that maps generic operations (like addition or multiplication) to specific machine instructions for a target architecture.
predicate
In SIMD architectures, a predicate is a mask that controls which elements of a vector operation are executed. An 'all-true' predicate means the operation is performed on all elements.
Filed Under: aarch64vectorizationperformanceSVE2