batch¶
- template <class T, class A>
-
class
xsimd::batch¶ 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.
Inherits from types::simd_register< T, A >, xsimd::types::integral_only_operators< T, A >
Public Types
-
template<>
usingvalue_type= T¶ Type of the scalar elements within this batch.
-
template<>
usingarch_type= A¶ SIMD Architecture abstracted by this batch.
-
template<>
usingregister_type= typename types::simd_register::register_type¶ SIMD register type abstracted by this batch.
-
template<>
usingbatch_bool_type= batch_bool<T, A>¶ Associated batch type used to represented logical operations on this batch.
Public Functions
-
batch()¶ Create a batch initialized with undefined values.
-
batch(T val)¶ Create a batch with all element initialized to
val.
- template <class… Ts>
-
batch(T val0, T val1, Ts... vals)¶ Create a batch with elements initialized from
val0,val1,vals…There must be exactly
sizeelements in total.
-
batch(batch_bool_type const &b)¶ Converts a
bool_batchto abatchwhere each element is set to 0xFF..FF (resp.0x00..00) if the corresponding element is
true(resp.false).
-
batch(register_type reg)¶ 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>
-
void
store_aligned(U *mem) const¶ Copy content of this batch to the buffer
mem.The memory needs to be aligned.
- template <class U>
-
void
store_unaligned(U *mem) const¶ Copy content of this batch to the buffer
mem.The memory does not need to be aligned.
- template <class U>
-
void
store(U *mem, aligned_mode) const¶ Equivalent to batch::store_aligned()
- template <class U>
-
void
store(U *mem, unaligned_mode) const¶ Equivalent to batch::store_unaligned()
- template <class U, class V>
-
void
scatter(U *dst, batch<V, arch_type> const &index) const¶ 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.
-
T
get(std::size_t i) const¶ Retrieve the
ith scalar element in this batch.warningThis is very inefficient and should only be used for debugging purpose.
- template <class U>
-
batch<T, A>
broadcast(U val)¶ Equivalent to batch::batch(T val).
- template <class U>
-
batch<T, A>
load_aligned(U const *mem)¶ Loading from aligned memory.
May involve a conversion if
Uis different fromT.
- template <class U>
-
batch<T, A>
load_unaligned(U const *mem)¶ Loading from unaligned memory.
May involve a conversion if
Uis different fromT.
- template <class U>
-
batch<T, A>
load(U const *mem, aligned_mode)¶ Equivalent to batch::load_aligned()
- template <class U>
-
batch<T, A>
load(U const *mem, unaligned_mode)¶ Equivalent to batch::load_unaligned()
Public Static Attributes
-
constexpr std::size_t
size= sizeof(types::simd_register<T, A>) / sizeof(T)¶ Number of scalar elements in this batch.
Friends
-
batch
operator+(batch const &self, batch const &other)¶ Shorthand for xsimd::add()
-
batch
operator-(batch const &self, batch const &other)¶ Shorthand for xsimd::sub()
-
batch
operator*(batch const &self, batch const &other)¶ Shorthand for xsimd::mul()
-
batch
operator/(batch const &self, batch const &other)¶ Shorthand for xsimd::div()
-
batch
operator&(batch const &self, batch const &other)¶ Shorthand for xsimd::bitwise_and()
-
batch
operator|(batch const &self, batch const &other)¶ Shorthand for xsimd::bitwise_or()
-
batch
operator^(batch const &self, batch const &other)¶ Shorthand for xsimd::bitwise_xor()
-
batch
operator&&(batch const &self, batch const &other)¶ Shorthand for xsimd::logical_and()
-
batch
operator||(batch const &self, batch const &other)¶ Shorthand for xsimd::logical_or()
- template <typename T, std::size_t N>
-
struct
xsimd::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.