Various simd_x86 functions that handle double need to be adjusted to
match 64-bit long double as well.
This patch deals with _S_*_of, to test the concept.
There are many occurrences of double in simd_x86.h file, and we
probably have to adjust them all. But this is more than enough to get
pr109261_constexpr_simd.cc to compile with -mlong-double-64.
We probably need a better abstraction.
Regstrapped on x86_64-linux-gnu. With this change on top of the
previous one, experimental/simd/pr109261_constexpr_simd.cc compiles
successfully with -mlong-double-64. This works, but I realize it's ugly
and incomplete, so take this as a conversation starter about preferences
on how to spell out the long-double-64 equivalence to double all over
simd_x86.h. Unless you like it, in which case, ok to install? :-)
for libstdc++-v3/ChangeLog
PR libstdc++/124657
* include/experimental/bits/simd_x86.h (_S_all_of): Handle
long double like double.
(_S_any_of, _S_none_of, _S_some_of): Likewise.
---
libstdc++-v3/include/experimental/bits/simd_x86.h | 16 ++++++++++++----
1 file changed, 12 insertions(+), 4 deletions(-)
diff --git a/libstdc++-v3/include/experimental/bits/simd_x86.h
b/libstdc++-v3/include/experimental/bits/simd_x86.h
index 74c7a61998e0d..400b56e40b33f 100644
--- a/libstdc++-v3/include/experimental/bits/simd_x86.h
+++ b/libstdc++-v3/include/experimental/bits/simd_x86.h
@@ -5024,7 +5024,9 @@ template <typename _Abi, typename>
else if constexpr (is_same_v<_Tp, float>)
return (_mm_movemask_ps(__a) & ((1 << _Np) - 1))
== (1 << _Np) - 1;
- else if constexpr (is_same_v<_Tp, double>)
+ else if constexpr (is_same_v<_Tp, double>
+ || (sizeof (long double) == sizeof (double)
+ && is_same_v<_Tp, long double>))
return (_mm_movemask_pd(__a) & ((1 << _Np) - 1))
== (1 << _Np) - 1;
else
@@ -5086,7 +5088,9 @@ template <typename _Abi, typename>
}
else if constexpr (is_same_v<_Tp, float>)
return (_mm_movemask_ps(__a) & ((1 << _Np) - 1)) != 0;
- else if constexpr (is_same_v<_Tp, double>)
+ else if constexpr (is_same_v<_Tp, double>
+ || (sizeof (long double) == sizeof (double)
+ && is_same_v<_Tp, long double>))
return (_mm_movemask_pd(__a) & ((1 << _Np) - 1)) != 0;
else
return (_mm_movemask_epi8(__a) & ((1 << (_Np * sizeof(_Tp))) - 1))
@@ -5122,7 +5126,9 @@ template <typename _Abi, typename>
}
else if constexpr (is_same_v<_Tp, float>)
return (__movemask(__a) & ((1 << _Np) - 1)) == 0;
- else if constexpr (is_same_v<_Tp, double>)
+ else if constexpr (is_same_v<_Tp, double>
+ || (sizeof (long double) == sizeof (double)
+ && is_same_v<_Tp, long double>))
return (__movemask(__a) & ((1 << _Np) - 1)) == 0;
else
return (__movemask(__a) & int((1ull << (_Np * sizeof(_Tp))) - 1))
@@ -5156,7 +5162,9 @@ template <typename _Abi, typename>
const auto __tmp = _mm_movemask_ps(__a) & __allbits;
return __tmp > 0 && __tmp < __allbits;
}
- else if constexpr (is_same_v<_Tp, double>)
+ else if constexpr (is_same_v<_Tp, double>
+ || (sizeof (long double) == sizeof (double)
+ && is_same_v<_Tp, long double>))
{
constexpr int __allbits = (1 << _Np) - 1;
const auto __tmp = _mm_movemask_pd(__a) & __allbits;
--
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!