https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122981
--- Comment #9 from Torbjorn SVENSSON <azoff at gcc dot gnu.org> ---
(In reply to Matthias Kretz (Vir) from comment #8)
> I'm regtesting the following patch right now:
>
> M libstdc++-v3/include/experimental/bits/simd.h
> @@ -608,7 +608,15 @@ struct __is_bitmask
> __int_for_sizeof()
> {
> static_assert(_Bytes > 0);
> - if constexpr (_Bytes == sizeof(int))
> + if constexpr (_Bytes == sizeof(int32_t))
> + return int32_t();
> + else if constexpr (_Bytes == sizeof(int8_t))
> + return int8_t();
> + else if constexpr (_Bytes == sizeof(int16_t))
> + return int16_t();
> + else if constexpr (_Bytes == sizeof(int64_t))
> + return int64_t();
> + else if constexpr (_Bytes == sizeof(int))
> return int();
> else if constexpr (_Bytes == sizeof(_SChar))
> return _SChar();
> M libstdc++-v3/include/experimental/bits/simd_neon.h
> @@ -480,27 +480,27 @@ _S_popcount(simd_mask<_Tp, _Abi> __k)
> {
> if constexpr (sizeof(_Tp) == 1)
> {
> - const auto __s8 = __vector_bitcast<_SChar>(__k._M_data);
> + const auto __s8 = __vector_bitcast<int8_t>(__k._M_data);
> int8x8_t __tmp = __lo64(__s8) + __hi64z(__s8);
> return -vpadd_s8(vpadd_s8(vpadd_s8(__tmp, int8x8_t()),
> int8x8_t()),
> int8x8_t())[0];
> }
> else if constexpr (sizeof(_Tp) == 2)
> {
> - const auto __s16 = __vector_bitcast<short>(__k._M_data);
> + const auto __s16 = __vector_bitcast<int16_t>(__k._M_data);
> int16x4_t __tmp = __lo64(__s16) + __hi64z(__s16);
> return -vpadd_s16(vpadd_s16(__tmp, int16x4_t()), int16x4_t())[0];
> }
> else if constexpr (sizeof(_Tp) == 4)
> {
> - const auto __s32 = __vector_bitcast<int>(__k._M_data);
> + const auto __s32 = __vector_bitcast<int32_t>(__k._M_data);
> int32x2_t __tmp = __lo64(__s32) + __hi64z(__s32);
> return -vpadd_s32(__tmp, int32x2_t())[0];
> }
> else if constexpr (sizeof(_Tp) == 8)
> {
> static_assert(sizeof(__k) == 16);
> - const auto __s64 = __vector_bitcast<long>(__k._M_data);
> + const auto __s64 = __vector_bitcast<int64_t>(__k._M_data);
> return -(__s64[0] + __s64[1]);
> }
> }
I've added this on top of r17-2833-g32657f29f91871 and it fixes
experimental/simd/pr109261_constexpr_simd.cc and
experimental/simd/pr115454_find_last_set.cc tests on arm-none-eabi for me. I
see no regression with this change.
Also, the test that I created in comment 2 works with this change, but is the
test worth keeping?