batch¶
-
template<class T, class A = default_arch>
class xsimd::batch : public types::simd_register<T, default_arch>¶ 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 Functions
-
inline batch(T val) noexcept¶
Create a batch with all element initialized to
val
.- Parameters
val – broadcast value
-
inline batch(std::initializer_list<T> data) noexcept¶
Create a batch with elements initialized from
data
.It is an error to have `data.size() != size.
- Parameters
data – sequence of elements
-
inline explicit batch(batch_bool_type const &b) noexcept¶
Converts a
bool_batch
to abatch
where each element is set to 0xFF..FF (resp.0x00..00) if the corresponding element is
true
(resp.false
).- Parameters
b – batch of bool
-
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.
- Parameters
reg – native simd register to wrap
-
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.
- Parameters
mem – the memory buffer to read
-
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.
- Parameters
mem – the memory buffer to write to
-
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
dst
and offset by each element inindex
.If
T
is not of the same size asU
, astatic_cast
is performed at element scatter time.- Parameters
dst – Destination address
index – Indexes in which to store the elements to.
-
template<class U>
inline batch<T, A> load_aligned(U const *mem) noexcept¶ Loading from aligned memory.
May involve a conversion if
U
is different fromT
.- Parameters
mem – the memory buffer to read from.
- Returns
a new batch instance.
-
template<class U>
inline batch<T, A> load_unaligned(U const *mem) noexcept¶ Loading from unaligned memory.
May involve a conversion if
U
is different fromT
.- Parameters
mem – the memory buffer to read from.
- Returns
a new batch instance.
-
template<typename U, typename V>
inline batch<T, A> gather(U const *src, batch<V, A> const &index) noexcept¶ Create a new batch gathering elements starting at address
src
and offset by each element inindex
.If
T
is not of the same size asU
, astatic_cast
is performed at element gather time.- Parameters
src – Starting address.
index – Indexes of the elements to gather.
- Returns
a batch containing the gathered elements.
-
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
type
member 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.