[Bug c++/88602] Consider adding ext_vector_type for better clang compatibility

pinskia at gcc dot gnu.org gcc-bugzilla@gcc.gnu.org
Tue May 21 03:36:50 GMT 2024


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

--- Comment #5 from Andrew Pinski <pinskia at gcc dot gnu.org> ---
(In reply to Jean-Michaël Celerier from comment #4)
> Another vote for this. It's used in the KFR DSP library which for this
> reason gets restricted to clang in some configurations...
> 
> Compare
> 
> https://github.com/kfrlib/kfr/blob/main/include/kfr/simd/impl/backend_clang.
> hpp
> 
> and
> 
> https://github.com/kfrlib/kfr/blob/main/include/kfr/simd/impl/
> backend_generic.hpp

Hmm, backend_clang.hpp does not use the .xyzw syntax (or anything that is not
supported by GCC's normal vector, it only uses __builtin_shufflevector (since
GCC 12) and __builtin_convertvector (since GCC 9) both which have been
supported in GCC for a few releases already.
So it could just use vector_size there instead.

Something like:
```
template <typename TT, size_t NN>
using simd = unwrap_bit<TT>
__attribute__((vector_size(NN*sizeof(unwrap_bit<TT>))));
```

And use the header for GCC >= 12.1.0


More information about the Gcc-bugs mailing list