https://gcc.gnu.org/bugzilla/show_bug.cgi?id=122981

--- Comment #8 from Matthias Kretz (Vir) <mkretz at gcc dot gnu.org> ---
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]);
          }
       }

Reply via email to