0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-12-25 15:04:10 +01:00

ircd::simd: Inline accoutrements for lane_cast; cleanup asm annotes.

This commit is contained in:
Jason Volk 2021-08-11 09:11:15 -07:00
parent 705c1cc776
commit 26a6fb50b6

View file

@ -15,27 +15,28 @@ namespace ircd::simd
{
template<class R,
class T>
R lane_cast(const T &);
R lane_cast(const T);
}
/// Convert each lane from a smaller type to a larger type
template<class R,
class T>
inline R
ircd::simd::lane_cast(const T &in)
[[using gnu: always_inline, gnu_inline, artificial]]
extern inline R
ircd::simd::lane_cast(const T in)
{
#if __has_builtin(__builtin_convertvector)
return __builtin_convertvector(in, R);
#else
R ret;
for(size_t i(0); i < lanes<R>(); ++i)
ret[i] = in[i];
return ret;
#endif
static_assert
(
lanes<R>() == lanes<T>(), "Types must have matching number of lanes."
);
#if __has_builtin(__builtin_convertvector)
return __builtin_convertvector(in, R);
#endif
R ret;
for(size_t i(0); i < lanes<R>(); ++i)
ret[i] = in[i];
return ret;
}