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

AArch64 vectorizer costs vec_deconstruct more accurately

Vectorizer cost model for AArch64 updated to better reflect hardware behavior for vec_deconstruct, fixing performance regressions.

The AArch64 vectorizer’s cost model for vec_deconstruct operations has been corrected. Previously, it was charged as one vec_to_scalar per lane, leading to overly high costs. The update aligns it with the hardware’s vec_deconstruct behavior, which is more efficient and prevents regressions seen in benchmarks and real-world applications like Calculix.

In Details

The AArch64 backend's vectorizer cost model in aarch64.cc incorrectly assigned costs to vec_deconstruct. It was treated as a vec_to_scalar operation per lane, whereas the AArch64 hook charges it per-vector based on elements/2 + 1. This change reverts to per-lane costing for vec_deconstruct by treating it as a scaled vec_to_scalar at the add_stmt_cost stage, restoring the original behavior and resolving performance regressions. The count_ops case for vec_deconstruct is now unreachable, relying on the scaled vec_to_scalar logic.

For Context
vec_deconstruct
An intermediate representation (IR) operation in GCC's vectorizer that represents extracting individual lanes from a vector register. This is often a key step in emulating gather, strided access, or reduction operations on vectors when direct hardware support is not available or optimal.
vec_to_scalar
An intermediate representation (IR) operation in GCC's vectorizer that represents converting a single lane of a vector register into a scalar value. This is a fundamental operation for processing vector data element by element.
vectorizer
A compiler optimization pass that transforms sequential scalar code into equivalent vector code. It identifies opportunities to perform the same operation on multiple data elements simultaneously using special SIMD (Single Instruction, Multiple Data) instructions.
AArch64
The 64-bit ARM architecture, which includes advanced SIMD (Advanced SIMD) and Scalable Vector Extension (SVE) instruction sets that support vector processing.
Filed Under: aarch64vectorizationperformance