batch¶
-
template<class
T
, classA
= default_arch>
classxsimd
::
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
-
batch
(T val) noexcept¶ Create a batch with all element initialized to
val
.- Parameters
val
: broadcast value
-
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
-
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
-
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
>
voidstore_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
>
voidstore_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
, classV
>
voidscatter
(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 addressindex
: Indexes in which to store the elements to.
-
template<class
U
>
batch<T, A>load_aligned
(U const *mem) noexcept¶ Loading from aligned memory.
May involve a conversion if
U
is different fromT
.- Return
a new batch instance.
- Parameters
mem
: the memory buffer to read from.
-
template<class
U
>
batch<T, A>load_unaligned
(U const *mem) noexcept¶ Loading from unaligned memory.
May involve a conversion if
U
is different fromT
.- Return
a new batch instance.
- Parameters
mem
: the memory buffer to read from.
-
template<typename
U
, typenameV
>
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.- Return
a batch containing the gathered elements.
- Parameters
src
: Starting address.index
: Indexes of the elements to gather.
-
template<typename
T
, std::size_tN
>
structmake_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.