[PATCH] libstdc++: simd: map 64-bit long double to double on sse [PR124657]

Alexandre Oliva oliva@adacore.com
Thu Apr 9 22:11:02 GMT 2026


On Mar 26, 2026, Matthias Kretz <MatthiasKretz@gmx.net> wrote:

> For whatever reason, this is the first email I received of this thread.

I guess I could have copied you.

> I fear that this might lead to problems further down in the implementation. I 
> think this should rather map '__intrinsic_type<long double, N>' to 
> '[[gnu::vector_size(16/32/64)]] double'. PPC has to do a similar thing 
> (below).

Indeed, I had filed PR124657 about the remaining compile failure with my
previous change, and your point above was exactly the solution for that
bit.  But it got me to a subsequent problem that I'm addressing in a
later patch.


When long double is as wide as double on x86 (-mlong-double-64), make
the __intrinsic_type a vector of double.

Regstrapped on x86_64-linux-gnu.  This is not enough to enable
experimental/simd/pr109261_constexpr_simd.cc to compile with
-mlong-double-64.  Ok to install?


for  libstdc++-v3/ChangeLog

	PR libstdc++/124657
	* include/experimental/bits/simd.h (__intrinsic_type::type):
	Map long double to double.
---
 libstdc++-v3/include/experimental/bits/simd.h |    3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/libstdc++-v3/include/experimental/bits/simd.h b/libstdc++-v3/include/experimental/bits/simd.h
index b96818af6e6ff..8c30c8af26881 100644
--- a/libstdc++-v3/include/experimental/bits/simd.h
+++ b/libstdc++-v3/include/experimental/bits/simd.h
@@ -2477,7 +2477,8 @@ template <typename _Tp, size_t _Bytes>
     static constexpr size_t _S_VBytes = _Bytes <= 16 ? 16 : _Bytes <= 32 ? 32 : 64;
 
     using type [[__gnu__::__vector_size__(_S_VBytes)]]
-      = conditional_t<is_integral_v<_Tp>, long long int, _Tp>;
+      = conditional_t<is_integral_v<_Tp>, long long int,
+		      conditional_t<is_same_v<_Tp, long double>, double, _Tp> >;
   };
 #endif // _GLIBCXX_SIMD_HAVE_SSE
 


-- 
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