[PATCH] libstdc++: simd: allow x86 -mlong-double-64
Jonathan Wakely
jwakely.gcc@gmail.com
Wed Mar 25 09:36:50 GMT 2026
On Tue, 24 Mar 2026 at 06:30, Alexandre Oliva <oliva@adacore.com> wrote:
>
>
> On a target that defaults to -mlong-double-64 -msse,
> standard_abi_usable.cc and other tests fail to compile because of the
> assert that rejects long double. As on ppc, we can trivially make
> things work for -mlong-double-64.
>
> Regstrapped on x86_64-linux-gnu. Also tested with -mlong-double-64 on
> libstdc++ tests that triggered the static_assert. Ok to install?
>
>
> for libstdc++-v3/ChangeLog
>
> * include/experimental/bits/simd.h (__intrinsic_type): Accept
> 64-bit long doubles on x86 SSE.
> ---
> libstdc++-v3/include/experimental/bits/simd.h | 4 +++-
> 1 file changed, 3 insertions(+), 1 deletion(-)
>
> diff --git a/libstdc++-v3/include/experimental/bits/simd.h b/libstdc++-v3/include/experimental/bits/simd.h
> index c2ac5adedaccf..b96818af6e6ff 100644
> --- a/libstdc++-v3/include/experimental/bits/simd.h
> +++ b/libstdc++-v3/include/experimental/bits/simd.h
> @@ -2469,7 +2469,9 @@ template <>
> template <typename _Tp, size_t _Bytes>
> struct __intrinsic_type<_Tp, _Bytes, enable_if_t<__is_vectorizable_v<_Tp> && _Bytes <= 64>>
> {
> - static_assert(!is_same_v<_Tp, long double>,
> + // allow _Tp == long double with -mlong-double-64
> + static_assert(!(is_same_v<_Tp, long double>
> + && sizeof(long double) > sizeof(double)),
> "no __intrinsic_type support for long double on x86");
Would this be a little easier to understand as:
if constexpr (sizeof(long double) > sizeof(double))
static_assert(!is_same_v<_Tp, long double>, "...");
>
> static constexpr size_t _S_VBytes = _Bytes <= 16 ? 16 : _Bytes <= 32 ? 32 : 64;
>
>
> --
> Alexandre Oliva, happy hacker https://blog.lx.oliva.nom.br/
> Free Software Activist FSFLA co-founder GNU Toolchain Engineer
> More tolerance and less prejudice are key for inclusion and diversity.
> Excluding neuro-others for not behaving ""normal"" is *not* inclusive!
More information about the Libstdc++
mailing list