GCC Newspaper
NOVEMBER 30, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
simplify-rtx

Check mode tieability when merging VEC_CONCAT of subregs

Ensures correct handling of vector concatenations with subregisters on AArch64 to prevent incorrect code generation.

This change modifies the VEC_CONCAT simplification in simplify-rtx to verify if target modes can be tied before merging subregisters. Previously, on AArch64, this could lead to incorrect code generation for vector types like V2x8QI and V16QI, which have the same size but incompatible tying. The fix ensures that the target’s mode tieability is checked, preventing the generation of inefficient stack-based code and enabling direct register manipulation with instructions like ‘zip1’. This resolves test failures in aarch64 NEON and SIMD tests.

In Details

The simplify-rtx pass, specifically the handling of VEC_CONCAT operations involving subregs, was too aggressive. It would rewrite (vec_concat:N (subreg:N/2 OP 0) (subreg:N/2 OP N/2)) into a lowpart of OP. This rewrite incorrectly assumed that the target mode of OP could accommodate the resulting tied vector mode. The fix introduces a call to targetm.modes_tieable_p to validate this assumption, preventing incorrect code generation on targets like AArch64 where certain vector modes, despite having the same size, cannot be tied together. This impacts the generation of NEON instructions.

For Context
VEC_CONCAT
An RTX (Representation Tree) construct representing the concatenation of two vectors into a wider vector. It's part of GCC's internal representation of code.
subreg
In GCC's RTX, a subregister refers to a portion of a larger register, often used for accessing specific fields or parts of a vector or scalar register.
RTX
Representation Tree. GCC's internal intermediate representation for code, used after parsing and before machine code generation.
mode tieability
A target-specific property indicating whether two vector modes of the same size can be combined or interoperated without issue. For example, on AArch64, V2x8QI and V16QI are not tieable despite being the same size.
AArch64
The 64-bit ARM architecture, commonly used in mobile devices and servers. GCC has specific backends for generating code for this architecture.
NEON
ARM's Advanced SIMD (Single Instruction, Multiple Data) extension, providing vector processing capabilities. GCC's AArch64 backend utilizes NEON instructions.
Filed Under: aarch64simplificationvectorization