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

AArch64 now initializes vectors from a common starting subsequence.

GCC now initializes AArch64 vectors more efficiently when elements can be generated from a common starting subsequence.

This commit enables more efficient vector initialization on AArch64 when elements can be generated from a common starting subsequence. It detects the shortest subsequence and then duplicates it using vec_duplicate, reducing the number of insert instructions. This optimization improves code generation for vector constructors with repeating patterns.

In Details

This patch introduces new instruction patterns (aarch64_simd_dup_subvector<vconq><mode>, aarch64_simd_dup_subvector<vcond><mode>, @aarch64_simd_vec_set<mode>) in aarch64-simd.md. It also modifies aarch64_expand_vector_init_fallback in aarch64.cc to implement the subsequence detection and duplication logic. This change leverages vec_duplicate and vec_set optabs to streamline vector initialization.

For Context

Vector initialization involves assigning initial values to the elements of a vector. This commit optimizes the process for AArch64 architectures when a repeating pattern exists within the initial values. By identifying and duplicating the common subsequence, GCC reduces the number of instructions required, leading to faster and more efficient code execution.

Filed Under: aarch64vectorizationoptimization