Batch of Scalars
-
template<class T, class A>
class batch : public types::simd_register<T, A>, public xsimd::types::integral_only_operators<T, A> batch of integer or floating point values.
Abstract representation of an SIMD register for floating point or integral value.
- Template Parameters:
T – the type of the underlying values.
A – the architecture this batch is tied too.
Public Types
-
using register_type = typename types::simd_register<T, A>::register_type
SIMD register type abstracted by this batch.
-
using batch_bool_type = batch_bool<T, A>
Associated batch type used to represented logical operations on this batch.
Public Functions
-
inline batch() = default
Create a batch initialized with undefined values.
-
template<class ...Ts>
inline batch(T val0, T val1, Ts... vals) noexcept Create a batch with elements initialized from
val0,val1,vals… There must be exactlysizeelements in total.
-
inline explicit batch(batch_bool_type const &b) noexcept
Converts a
bool_batchto abatchwhere each element is set to 1 (resp.0) if the corresponding element is
true(resp.false).
-
inline batch(register_type reg) noexcept
Wraps a compatible native simd register as a
batch.This is generally not needed but becomes handy when doing architecture-specific operations.
-
template<class U>
inline void store_aligned(U *mem) const noexcept Copy content of this batch to the buffer
mem.The memory needs to be aligned.
-
template<class U>
inline void store_unaligned(U *mem) const noexcept Copy content of this batch to the buffer
mem.The memory does not need to be aligned.
-
template<class U>
inline void store(U *mem, aligned_mode) const noexcept Equivalent to batch::store_aligned().
-
template<class U>
inline void store(U *mem, unaligned_mode) const noexcept Equivalent to batch::store_unaligned().
-
template<class U, class V>
inline void scatter(U *dst, batch<V, arch_type> const &index) const noexcept Scatter elements from this batch into addresses starting at
dstand offset by each element inindex.If
Tis not of the same size asU, astatic_castis performed at element scatter time.
-
inline T get(std::size_t i) const noexcept
Retrieve the
ith scalar element in this batch.warningThis is very inefficient and should only be used for debugging purpose.
-
template<class U>
inline batch<T, A> load_aligned(U const *mem) noexcept Loading from aligned memory.
May involve a conversion if
Uis different fromT.
-
template<class U>
inline batch<T, A> load_unaligned(U const *mem) noexcept Loading from unaligned memory.
May involve a conversion if
Uis different fromT.
-
template<class U>
inline batch<T, A> load(U const *mem, aligned_mode) noexcept Equivalent to batch::load_aligned().
Public Static Attributes
Friends
-
inline friend batch operator+(batch const &self, batch const &other) noexcept
Shorthand for xsimd::add().
-
inline friend batch operator-(batch const &self, batch const &other) noexcept
Shorthand for xsimd::sub().
-
inline friend batch operator*(batch const &self, batch const &other) noexcept
Shorthand for xsimd::mul().
-
inline friend batch operator/(batch const &self, batch const &other) noexcept
Shorthand for xsimd::div().
-
inline friend batch operator&(batch const &self, batch const &other) noexcept
Shorthand for xsimd::bitwise_and().
-
inline friend batch operator|(batch const &self, batch const &other) noexcept
Shorthand for xsimd::bitwise_or().
-
inline friend batch operator^(batch const &self, batch const &other) noexcept
Shorthand for xsimd::bitwise_xor().
-
template<typename T, std::size_t N>
struct make_sized_batch type utility to select a batch of given type and size
If one of the available architectures has a native vector type of the given type and size, sets the
typemember to the appropriate batch type. Otherwise set its tovoid.- Template Parameters:
T – the type of the underlying values.
N – the number of elements of that type in the batch.