GCC Newspaper
JUNE 15, 2026
Date
/
Architectures
Components
Topics
News & Policy
Other
libstdc++

Libstdc++: Adjust SIMD functions to handle 64-bit long double on x86

The libstdc++ SIMD functions now handle 64-bit long double types on x86 architectures.

This change updates the libstdc++ SIMD functions to correctly handle 64-bit long double types on x86 architectures, where long double may be as wide as double. The implementation introduces new type traits, __is_x86_ps<_Tp>() and __is_x86_pd<_Tp>(), to distinguish between float and double respectively, and maps long double to double when the -mlong-double-64 option is in effect. This ensures that the SIMD intrinsics work correctly with the extended precision type, avoiding potential errors or unexpected behavior when long double is used in SIMD operations.

In Details

The libstdc++ <experimental/simd> defines vector types exposing SIMD capabilities. When compiling for x86 with -mlong-double-64, the ABI maps long double onto a 64-bit double. This commit adjusts the underlying __intrinsic_type to ensure that the SIMD vectors correctly use double in this configuration. This commit touches <experimental/bits/simd_x86.h> and <experimental/bits/simd.h>. The interaction here isn't immediately obvious unless you're familiar with the x86's type ABI and the libstdc++ SIMD extensions.

For Context

SIMD (Single Instruction, Multiple Data) is a type of parallel processing where one instruction operates on multiple data points simultaneously, which can significantly speed up certain types of computations. The C++ standard library includes experimental SIMD support, which defines vector types that map to SIMD instructions on supported architectures. On x86 platforms, the long double type can be configured to be either 80-bit or 64-bit. When configured as 64-bit, it becomes ABI-compatible with double. This change ensures that the SIMD vector types correctly use double when long double is configured in this way. This affects code using the experimental SIMD features in libstdc++ on x86 platforms, especially when using long double.

Filed Under: libstdc++simdx86long doubleabi