Hello, Matthias, On May 26, 2023, Matthias Kretz via Libstdc++ <libstd...@gcc.gnu.org> wrote:
> OK for master and all backports (after 11.4 is done)? > tested on powerpc64le-linux-gnu and x86_64-pc-linux-gnu > * testsuite/experimental/simd/pr109822_cast_functions.cc: New > test. This testcase fails to compile on PowerPC targets without VSX: 64-bit integer and floating-point types cannot be vectorized. I wonder if the test is malformed (and should be amended to test for available simd types), or whether a patch like this would be desirable to make simd constructs more portable. I'm not sure about the requirements. [libstdc++] [simd] [ppc] use nonvector intrinsic fallback types From: Alexandre Oliva <ol...@adacore.com> Compiling such tests as pr109822_cast_functions.cc on powerpc targets that don't support VSX fails because some intrinsic types that are expected to be vectorizable are not defined without VSX. Introduce fallback non-vector types to enable the code to compile. for libstdc++-v3/ChangeLog * include/experimental/bits/simd.h: Introduce fallback non-vector intrinsic_type_impl specializations for PowerPC without VSX. --- libstdc++-v3/include/experimental/bits/simd.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/libstdc++-v3/include/experimental/bits/simd.h b/libstdc++-v3/include/experimental/bits/simd.h index 834fe923065bd..2691823e869e8 100644 --- a/libstdc++-v3/include/experimental/bits/simd.h +++ b/libstdc++-v3/include/experimental/bits/simd.h @@ -2431,9 +2431,14 @@ template <typename _Tp> #define _GLIBCXX_SIMD_PPC_INTRIN(_Tp) \ template <> \ struct __intrinsic_type_impl<_Tp> { using type = __vector _Tp; } +#define _GLIBCXX_SIMD_PPC_INTRIN_NOVEC(_Tp) \ + template <> \ + struct __intrinsic_type_impl<_Tp> { using type = _Tp; } _GLIBCXX_SIMD_PPC_INTRIN(float); #ifdef __VSX__ _GLIBCXX_SIMD_PPC_INTRIN(double); +#else +_GLIBCXX_SIMD_PPC_INTRIN_NOVEC(double); #endif _GLIBCXX_SIMD_PPC_INTRIN(signed char); _GLIBCXX_SIMD_PPC_INTRIN(unsigned char); @@ -2444,12 +2449,19 @@ _GLIBCXX_SIMD_PPC_INTRIN(unsigned int); #if defined __VSX__ || __SIZEOF_LONG__ == 4 _GLIBCXX_SIMD_PPC_INTRIN(signed long); _GLIBCXX_SIMD_PPC_INTRIN(unsigned long); +#else +_GLIBCXX_SIMD_PPC_INTRIN_NOVEC(signed long); +_GLIBCXX_SIMD_PPC_INTRIN_NOVEC(unsigned long); #endif #ifdef __VSX__ _GLIBCXX_SIMD_PPC_INTRIN(signed long long); _GLIBCXX_SIMD_PPC_INTRIN(unsigned long long); +#else +_GLIBCXX_SIMD_PPC_INTRIN_NOVEC(signed long long); +_GLIBCXX_SIMD_PPC_INTRIN_NOVEC(unsigned long long); #endif #undef _GLIBCXX_SIMD_PPC_INTRIN +#undef _GLIBCXX_SIMD_PPC_INTRIN_NOVEC template <typename _Tp, size_t _Bytes> struct __intrinsic_type<_Tp, _Bytes, enable_if_t<__is_vectorizable_v<_Tp> && _Bytes <= 16>> -- Alexandre Oliva, happy hacker https://FSFLA.org/blogs/lxo/ Free Software Activist GNU Toolchain Engineer Disinformation flourishes because many people care deeply about injustice but very few check the facts. Ask me about <https://stallmansupport.org>