15#include <xvec/detail/config.hpp>
16#include <xvec/detail/utilities.hpp>
17#include <xvec/detail/core.hpp>
19namespace _XVEC_NAMESPACE::simd::x86 {
30template<
typename _Vec,
typename _Tp =
typename _Vec::value_type>
31concept xmm_register = (
sizeof(_Vec) <= 16) && (std::same_as<_Tp, typename _Vec::value_type>);
36template<
typename _Vec,
typename _Tp =
typename _Vec::value_type>
37concept ymm_register = (
sizeof(_Vec) > 16 &&
sizeof(_Vec) <= 32) && (std::same_as<_Tp, typename _Vec::value_type>);
42template<
typename _Vec,
typename _Tp =
typename _Vec::value_type>
43concept zmm_register = (
sizeof(_Vec) > 32 &&
sizeof(_Vec) <= 64) && (std::same_as<_Tp, typename _Vec::value_type>);
62template<std::u
int8_t imm_
byte = 0, vec_type _Bytes, vec_type _Matrix>
63requires ((
sizeof(
typename _Bytes::value_type) == 1) &&
64 (
sizeof(
typename _Matrix::value_type) == 8) &&
65 ((_Matrix::size() * 8) == _Bytes::size()))
66inline _Bytes gf2p8affine(
const _Bytes& b,
const _Matrix& m)
70 target_overloads impl {
72 {
return _mm_gf2p8affine_epi64_epi8 (x.to_register(), y.to_register(), imm_byte); },
74 {
return _mm256_gf2p8affine_epi64_epi8 (x.to_register(), y.to_register(), imm_byte); },
76 {
return _mm512_gf2p8affine_epi64_epi8 (x.to_register(), y.to_register(), imm_byte); },
78 [=](
auto unhandled,
auto) {
static_assert(dependent_false<
decltype(unhandled)>,
"No target intrinsics");
return unhandled; }
81 return std::bit_cast<_Bytes>(
chunked_invoke([=](
auto x,
auto y) {
return decltype(x)(impl(x, y)); },
93template<std::u
int8_t imm_
byte = 0, vec_type _Bytes>
94requires (
sizeof(
typename _Bytes::value_type) == 1)
95inline _Bytes gf2p8affine(
const _Bytes& b, std::uint64_t m)
97 constexpr int roundedTo8 = ((_Bytes::size() + 7) / 8) * 8;
104inline auto gf2p8affine(
auto unhandled,
auto);
111namespace _XVEC_NAMESPACE::simd::detail {
112 using x86::xmm_register;
113 using x86::ymm_register;
114 using x86::zmm_register;
Detect a vector occupying at most an xmm-sized register.
Definition intrin.hpp:31
Detect a vector larger than xmm and no larger than ymm.
Definition intrin.hpp:37
Detect a vector larger than ymm and no larger than zmm.
Definition intrin.hpp:43
basic_vec< _Tp, simd_fixed_size_abi< _Np > > vec
Definition core.hpp:379
constexpr auto permute(const _Vp &v, detail::index_generator_function auto &&fn)
Permute the elements in a vec value using a generator function to compute the indexing.
Definition permute.hpp:94
constexpr auto chunked_invoke(_Fn fn, const _Arg0 &arg0, const _Args &... args)
Invoke a callable on corresponding vector or mask chunks.
Definition invoke.hpp:61
constexpr auto take(const vec_or_mask_type auto &in)
Definition named_permute.hpp:237
constexpr auto simd_bit_cast(const _From &v) noexcept
A simd-generic version of simd_bit_cast which directly invokes std::bit_cast.
Definition core.hpp:585
Detect a scoped enum. This will be provided in C++23 onwards.
Definition compat.hpp:27