GCC Newspaper
JULY 29, 2026
Date
/
Architectures
Components
Topics
News & Policy
libstdc++

libstdc++: Refactor ScalarAbi into Abi<N, N>

SIMD ABI definitions are refactored to unify scalar and vector representations, improving consistency.

This commit refactors the SIMD infrastructure by replacing _ScalarAbi<N> with a more general _Abi<N, N> template. This change unifies the representation of scalar and vector types within the ABI definitions, addressing issues where scalar ABI properties were incorrectly applied to vector types. The refactoring improves the accuracy of bitmask detection and rebind operations for SIMD types.

In Details

The _ScalarAbi class, previously used to tag scalar SIMD types, has been removed and its functionality merged into the _Abi class. The __scalar_abi_tag trait now correctly identifies _Abi<N, N> types. This change fixes a bug where _Ap::_S_is_bitmask would incorrectly evaluate to true for scalar ABIs by adding a !__scalar_abi_tag<_Ap> condition. It also adjusts _M_and_neighbors and _M_or_neighbors in simd_mask.h to handle scalar bitmasks correctly.

For Context
SIMD
Single Instruction, Multiple Data. A type of parallel processing where a single operation is performed on multiple data points simultaneously, significantly speeding up computations on large datasets. In GCC, SIMD support is integrated into <code>libstdc++</code> for vectorized types.
ABI
Application Binary Interface. Defines how software components interact at the machine code level. In the context of SIMD, ABI variants specify how data is laid out and manipulated in vector registers.
_ScalarAbi
A previous helper class in <code>libstdc++</code>'s SIMD implementation that specifically marked scalar types within the SIMD framework. It has been removed and its logic integrated into the more general _Abi template class.
_Abi<N, N>
A refactored ABI tag in <code>libstdc++</code>'s SIMD implementation that represents both scalar and vector types, where N denotes the number of elements. This unification simplifies the ABI logic.
Filed Under: libstdc++SIMDABI