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

aarch64: Use standard RTL for FADDP

Enable better optimization of FADDP on AArch64 by using standard RTL representations.

Floating-point pairwise addition (FADDP) on AArch64 previously used a custom UNSPEC_FADDV, preventing RTL optimizations from recognizing its behavior. This commit modifies FADDP to use standard RTL patterns, similar to integer ADDP, allowing optimizations like combine to recognize and improve FADDP usage. This leads to more efficient code, for example, by packing two scalar FADDP reductions into a single vector FADDP instruction.

In Details

The AArch64 backend's FADDP instruction patterns used UNSPEC_FADDV, which is opaque to RTL-level optimizations like combine. This commit refactors FADDP to use standard RTL, specifically leveraging vec_select and subreg to represent the addition of the low elements of vector pairs. This allows combine to recognize FADDP for scalar reductions and vector packings, similar to how ADDP is handled. It also introduces new patterns and helper functions to manage the standard RTL representation and associated checks.

For Context
FADDP
AArch64 SIMD instruction that performs a floating-point pairwise addition. It adds pairs of elements within a vector register.
RTL
Register Transfer Language. GCC's primary internal representation for code, used between parsing and machine code generation. It describes operations on registers and memory.
UNSPEC
A placeholder in GCC's RTL that represents an operation not directly mapped to a standard RTL construct, often specific to a particular architecture or optimization.
combine
An optimization pass in GCC that performs instruction combining, merging multiple simple instructions into a single more complex one where beneficial.
vec_select
An RTL construct used to select specific elements from a vector.
subreg
A 'subregister' in RTL, representing a portion of a larger register. Used here to access the low element of a vector.
Filed Under: aarch64optimizationSIMDperformance