namespace xsimd
{ template <typename T, class A, bool... Values> struct batch_bool_constant;
template <class T_out, class T_in, class A>
XSIMD_INLINE batch<T_out, A> bitwise_cast(batch<T_in, A> const& x) noexcept;
template <typename T, class A, T... Values> struct batch_constant;
namespace kernel
{ usingnamespace types;
// fwd template <class A, class T, size_t I>
XSIMD_INLINE batch<T, A> insert(batch<T, A> const& self, T val, index<I>, requires_arch<common>) noexcept; template <class A, typename T, typename ITy, ITy... Indices>
XSIMD_INLINE batch<T, A> shuffle(batch<T, A> const& x, batch<T, A> const& y, batch_constant<ITy, A, Indices...>, requires_arch<common>) noexcept;
namespace detail
{ template <size_t I, class F, class... Bs> auto emulated_apply(F func, Bs const&... bs)
{ return func(bs.data[I]...);
}
template <class B, class F, class... Bs> auto emulated_apply(F func, B const& b, Bs const&... bs)
{ return emulated_apply(func, std::make_index_sequence<B::size>(), b, bs...);
}
}
// abs template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
XSIMD_INLINE batch<T, A> abs(batch<T, A> const& self, requires_arch<emulated<N>>) noexcept
{ return detail::emulated_apply([](T v)
{ return xsimd::abs(v); },
self);
}
// add template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
XSIMD_INLINE batch<T, A> add(batch<T, A> const& self, batch<T, A> const& other, requires_arch<emulated<N>>) noexcept
{ return detail::emulated_apply([](T v0, T v1)
{ return xsimd::add(v0, v1); },
self, other);
}
// all template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
XSIMD_INLINE bool all(batch_bool<T, A> const& self, requires_arch<emulated<N>>) noexcept
{ return std::all_of(self.data.begin(), self.data.end(), [](T v)
{ returnbool(v); });
}
// any template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
XSIMD_INLINE bool any(batch_bool<T, A> const& self, requires_arch<emulated<N>>) noexcept
{ return std::any_of(self.data.begin(), self.data.end(), [](T v)
{ returnbool(v); });
}
// batch_bool_cast template <class A, class T_out, class T_in, size_t N = 8 * sizeof(T_in) * batch<T_in, A>::size>
XSIMD_INLINE batch_bool<T_out, A> batch_bool_cast(batch_bool<T_in, A> const& self, batch_bool<T_out, A> const&, requires_arch<emulated<N>>) noexcept
{ return { self.data };
}
// bitwise_and template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
XSIMD_INLINE batch<T, A> bitwise_and(batch<T, A> const& self, batch<T, A> const& other, requires_arch<emulated<N>>) noexcept
{ return detail::emulated_apply([](T v0, T v1)
{ return xsimd::bitwise_and(v0, v1); },
self, other);
}
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
XSIMD_INLINE batch_bool<T, A> bitwise_and(batch_bool<T, A> const& self, batch_bool<T, A> const& other, requires_arch<emulated<N>>) noexcept
{ return detail::emulated_apply([](bool v0, bool v1)
{ return xsimd::bitwise_and(v0, v1); },
self, other);
}
// bitwise_andnot template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
XSIMD_INLINE batch<T, A> bitwise_andnot(batch<T, A> const& self, batch<T, A> const& other, requires_arch<emulated<N>>) noexcept
{ return detail::emulated_apply([](T v0, T v1)
{ return xsimd::bitwise_andnot(v0, v1); },
self, other);
}
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
XSIMD_INLINE batch_bool<T, A> bitwise_andnot(batch_bool<T, A> const& self, batch_bool<T, A> const& other, requires_arch<emulated<N>>) noexcept
{ return detail::emulated_apply([](bool v0, bool v1)
{ return xsimd::bitwise_andnot(v0, v1); },
self, other);
}
// bitwise_lshift template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
XSIMD_INLINE batch<T, A> bitwise_lshift(batch<T, A> const& self, int32_t other, requires_arch<emulated<N>>) noexcept
{ return detail::emulated_apply([other](T v)
{ return xsimd::bitwise_lshift(v, other); },
self);
}
// bitwise_not template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
XSIMD_INLINE batch<T, A> bitwise_not(batch<T, A> const& self, requires_arch<emulated<N>>) noexcept
{ return detail::emulated_apply([](T v)
{ return xsimd::bitwise_not(v); },
self);
}
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
XSIMD_INLINE batch_bool<T, A> bitwise_not(batch_bool<T, A> const& self, requires_arch<emulated<N>>) noexcept
{ return detail::emulated_apply([](bool v)
{ return xsimd::bitwise_not(v); },
self);
}
// bitwise_or template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
XSIMD_INLINE batch<T, A> bitwise_or(batch<T, A> const& self, batch<T, A> const& other, requires_arch<emulated<N>>) noexcept
{ return detail::emulated_apply([](T v0, T v1)
{ return xsimd::bitwise_or(v0, v1); },
self, other);
}
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
XSIMD_INLINE batch_bool<T, A> bitwise_or(batch_bool<T, A> const& self, batch_bool<T, A> const& other, requires_arch<emulated<N>>) noexcept
{ return detail::emulated_apply([](bool v0, bool v1)
{ return xsimd::bitwise_or(v0, v1); },
self, other);
}
// bitwise_rshift template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
XSIMD_INLINE batch<T, A> bitwise_rshift(batch<T, A> const& self, int32_t other, requires_arch<emulated<N>>) noexcept
{ return detail::emulated_apply([other](T v)
{ return xsimd::bitwise_rshift(v, other); },
self);
}
// bitwise_xor template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
XSIMD_INLINE batch<T, A> bitwise_xor(batch<T, A> const& self, batch<T, A> const& other, requires_arch<emulated<N>>) noexcept
{ return detail::emulated_apply([](T v0, T v1)
{ return xsimd::bitwise_xor(v0, v1); },
self, other);
}
template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
XSIMD_INLINE batch_bool<T, A> bitwise_xor(batch_bool<T, A> const& self, batch_bool<T, A> const& other, requires_arch<emulated<N>>) noexcept
{ return detail::emulated_apply([](bool v0, bool v1)
{ return xsimd::bitwise_xor(v0, v1); },
self, other);
}
// bitwise_cast template <class A, class T_in, class T_out, size_t N = 8 * sizeof(T_in) * batch<T_in, A>::size>
XSIMD_INLINE batch<T_out, A> bitwise_cast(batch<T_in, A> const& self, batch<T_out, A> const&, requires_arch<emulated<N>>) noexcept
{
constexpr size_t size = batch<T_out, A>::size;
std::array<T_out, size> result; char* raw_data = reinterpret_cast<char*>(result.data()); constchar* raw_input = reinterpret_cast<constchar*>(self.data.data());
memcpy(raw_data, raw_input, size * sizeof(T_out)); return result;
}
// broadcast template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
batch<T, A> XSIMD_INLINE broadcast(T val, requires_arch<emulated<N>>) noexcept
{
constexpr size_t size = batch<T, A>::size;
std::array<T, size> r;
std::fill(r.begin(), r.end(), val); return r;
}
// first template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
T XSIMD_INLINE first(batch<T, A> const& self, requires_arch<emulated<N>>) noexcept
{ return self.data[0];
}
// haddp template <class A, typename T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
XSIMD_INLINE batch<T, A> haddp(batch<T, A> const* row, requires_arch<emulated<N>>) noexcept
{
constexpr size_t size = batch<T, A>::size;
std::array<T, size> r; for (size_t i = 0; i < size; ++i)
r[i] = std::accumulate(row[i].data.begin() + 1, row[i].data.end(), row[i].data.front()); return r;
}
// incr_if template <class A, class T, size_t N = 8 * sizeof(T) * batch<T, A>::size>
XSIMD_INLINE batch<T, A> incr_if(batch<T, A> const& self, batch_bool<T, A> const& mask, requires_arch<emulated<N>>) noexcept
{ return self + batch<T, A>(mask.data);
}
// insert template <class A, class T, size_t I, size_t N = 8 * sizeof(T) * batch<T, A>::size>
XSIMD_INLINE batch<T, A> insert(batch<T, A> const& self, T val, index<I>, requires_arch<emulated<N>>) noexcept
{
batch<T, A> other = self;
other.data[I] = val; return other;
}
// isnan template <class A, typename T, size_t N = 8 * sizeof(T) * batch<T, A>::size, class = std::enable_if_t<std::is_floating_point<T>::value>>
XSIMD_INLINE batch_bool<T, A> isnan(batch<T, A> const& self, requires_arch<emulated<N>>) noexcept
{ return detail::emulated_apply([](T v)
{ return xsimd::isnan(v); },
self);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.