libstdc++: Avoid ill-formed types on ARM
Checks
Commit Message
Tested on arm-linux-gnueabihf, powerpc64le-linux-gnu, and aarch64-linux-gnu.
OK for trunk and backports?
----------------------------- 8< --------------------------
This resolves failing tests in check-simd.
Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
libstdc++-v3/ChangeLog:
PR libstdc++/114750
* include/experimental/bits/simd_builtin.h
(_SimdImplBuiltin::_S_load, _S_store): Fall back to copying
scalars if the memory type cannot be vectorized for the target.
---
libstdc++-v3/include/experimental/bits/simd_builtin.h | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
--
──────────────────────────────────────────────────────────────────────────
Dr. Matthias Kretz https://mattkretz.github.io
GSI Helmholtz Centre for Heavy Ion Research https://gsi.de
stdₓ::simd
──────────────────────────────────────────────────────────────────────────
Comments
On Wed, 17 Apr 2024 at 08:58, Matthias Kretz <m.kretz@gsi.de> wrote:
>
> Tested on arm-linux-gnueabihf, powerpc64le-linux-gnu, and aarch64-linux-gnu.
>
> OK for trunk and backports?
OK, thanks.
>
> ----------------------------- 8< --------------------------
>
> This resolves failing tests in check-simd.
>
> Signed-off-by: Matthias Kretz <m.kretz@gsi.de>
>
> libstdc++-v3/ChangeLog:
>
> PR libstdc++/114750
> * include/experimental/bits/simd_builtin.h
> (_SimdImplBuiltin::_S_load, _S_store): Fall back to copying
> scalars if the memory type cannot be vectorized for the target.
> ---
> libstdc++-v3/include/experimental/bits/simd_builtin.h | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
>
> --
> ──────────────────────────────────────────────────────────────────────────
> Dr. Matthias Kretz https://mattkretz.github.io
> GSI Helmholtz Centre for Heavy Ion Research https://gsi.de
> stdₓ::simd
> ──────────────────────────────────────────────────────────────────────────
@@ -1464,7 +1464,7 @@ _S_broadcast(_Tp __x) noexcept
[&](auto __i) constexpr {
return static_cast<_Tp>(__i < _Np ? __mem[__i] : 0);
});
- else if constexpr (sizeof(_Up) > 8)
+ else if constexpr (sizeof(_Up) > 8 or __vectorized_sizeof<_Up>() <= sizeof(_Up))
return __generate_vector<_Tp, _SimdMember<_Tp>::_S_full_size>(
[&](auto __i) constexpr _GLIBCXX_SIMD_ALWAYS_INLINE_LAMBDA {
return static_cast<_Tp>(__i < _Np ? __mem[__i] : 0);
@@ -1536,7 +1536,7 @@ _S_masked_load(_SimdWrapper<_Tp, _Np> __merge, _MaskMember<_Tp> __k,
for (size_t __i = 0; __i < _Np; ++__i)
__mem[__i] = __v[__i];
}
- else if constexpr (sizeof(_Up) > 8)
+ else if constexpr (sizeof(_Up) > 8 or __vectorized_sizeof<_Up>() <= sizeof(_Up))
__execute_n_times<_Np>([&](auto __i) constexpr _GLIBCXX_SIMD_ALWAYS_INLINE_LAMBDA {
__mem[__i] = __v[__i];
});