[PATCH] libstdc++: add ARM SVE support to std::experimental::simd

Richard Sandiford richard.sandiford@arm.com
Mon Dec 11 11:02:07 GMT 2023


Richard Sandiford <richard.sandiford@arm.com> writes:
>   template <size_t _Bits, size_t _Width>
>     struct _SveMaskWrapper
>     {
>       ...
>
>       _GLIBCXX_SIMD_INTRINSIC constexpr value_type
>       operator[](size_t __i) const
>       {
>         return _BuiltinSveMaskType::__sve_mask_active_count(
>                 _BuiltinSveVectorType::__sve_active_mask(),
>                 svand_z(_BuiltinSveVectorType::__sve_active_mask(),
>                         svcmpeq(_BuiltinSveVectorType::__sve_active_mask(),
>                                 _BuiltinSveMaskType::__index0123,
>                                 typename _BuiltinSveMaskType::__sve_mask_uint_type(__i)),
>                         _M_data));
>       }
>
> A simpler way to do this might be to use svdup_u<width>_z (_M_data, 1, 0)
> and then svorrv on the result.

Sorry for the nonsense comment.  I was thinking of a different operation.
But GCC knows how to index a fixed-length data vector, so it might be
worth using:

  svdup_u<width>_z (_M_data, 1)[__i]

Thanks,
Richard


More information about the Libstdc++ mailing list