Data transfer¶
-
template<class
T
, classA
= default_arch>
batch<T, A>xsimd
::
broadcast
(T v)¶ Creates a batch from the single value
v
.- Return
- a new batch instance
- Parameters
v
: the value used to initialize the batch
-
template<class
To
, classA
= default_arch, classFrom
>
simd_return_type<From, To, A>xsimd
::
broadcast_as
(From v)¶ Creates a batch from the single value
v
and the specified batch value typeTo
.- Return
- a new batch instance
- Parameters
v
: the value used to initialize the batch
-
template<class
T
, classA
, size_tI
>
batch<T, A>xsimd
::
insert
(batch<T, A> const &x, T val, index<I> pos)¶ Create a new batch equivalent to
x
but with elementval
set at positionpos
.- Return
- copy of
x
with positionpos
set toval
- Parameters
x
: batchval
: value to setpos
: index of the updated slot
-
template<class
To
, classA
= default_arch, classFrom
>
simd_return_type<From, To, A>xsimd
::
load_as
(From const *ptr, aligned_mode)¶ Creates a batch from the buffer
ptr
and the specifed batch value typeTo
.The memory needs to be aligned.
- Return
- a new batch instance
- Parameters
ptr
: the memory buffer to read
-
template<class
To
, classA
= default_arch, classFrom
>
simd_return_type<From, To, A>xsimd
::
load_as
(From const *ptr, unaligned_mode)¶ Creates a batch from the buffer
ptr
and the specifed batch value typeTo
.The memory does not need to be aligned.
- Return
- a new batch instance
- Parameters
ptr
: the memory buffer to read
-
template<class
A
= default_arch, classFrom
>
batch<From, A>xsimd
::
load
(From const *ptr, aligned_mode = {})¶ Creates a batch from the buffer
ptr
.The memory needs to be aligned.
- Return
- a new batch instance
- Parameters
ptr
: the memory buffer to read
-
template<class
A
= default_arch, classFrom
>
batch<From, A>xsimd
::
load
(From const *ptr, unaligned_mode)¶ Creates a batch from the buffer
ptr
.The memory does not need to be aligned.
- Return
- a new batch instance
- Parameters
ptr
: the memory buffer to read
-
template<class
A
= default_arch, classFrom
>
batch<From, A>xsimd
::
load_aligned
(From const *ptr)¶ Creates a batch from the buffer
ptr
.The memory needs to be aligned.
- Return
- a new batch instance
- Parameters
ptr
: the memory buffer to read
-
template<class
A
= default_arch, classFrom
>
batch<From, A>xsimd
::
load_unaligned
(From const *ptr)¶ Creates a batch from the buffer
ptr
.The memory does not need to be aligned.
- Return
- a new batch instance
- Parameters
ptr
: the memory buffer to read
-
template<size_t
N
, classT
, classA
>
batch<T, A>xsimd
::
slide_left
(batch<T, A> const &x)¶ Slide the whole batch to the left by
n
bytes.This is different from
bitwise_lshift
that shifts each batch element to the left.- Return
- slided batch.
- Template Parameters
N
: Amount of bytes to slide to the left.
- Parameters
x
: batch of integer values.
-
template<size_t
N
, classT
, classA
>
batch<T, A>xsimd
::
slide_right
(batch<T, A> const &x)¶ Slide the whole batch to the right by
N
bytes.This is different from
bitwise_rshift
that shifts each batch element to the right.- Return
- slided batch.
- Template Parameters
N
: Amount of bytes to slide to the right.
- Parameters
x
: batch of integer values.
-
template<class
To
, classA
= default_arch, classFrom
>
voidxsimd
::
store_as
(To *dst, batch<From, A> const &src, aligned_mode)¶ Copy content of batch
src
to the bufferdst
.The memory needs to be aligned.
- Parameters
dst
: the memory buffer to write tosrc
: the batch to copy
-
template<class
To
, classA
= default_arch, classFrom
>
voidxsimd
::
store_as
(To *dst, batch<From, A> const &src, unaligned_mode)¶ Copy content of batch
src
to the bufferdst
.The memory does not need to be aligned.
- Parameters
dst
: the memory buffer to write tosrc
: the batch to copy
-
template<class
A
, classT
>
voidxsimd
::
store
(T *mem, batch<T, A> const &val, aligned_mode = {})¶ Copy content of batch
val
to the buffermem
.The memory does not need to be aligned.
- Parameters
mem
: the memory buffer to write toval
: the batch to copy from
-
template<class
A
, classT
>
voidxsimd
::
store
(T *mem, batch<T, A> const &val, unaligned_mode)¶ Copy content of batch
val
to the buffermem
.The memory does not need to be aligned.
- Parameters
mem
: the memory buffer to write toval
: the batch to copy from
-
template<class
A
, classT
>
voidxsimd
::
store_aligned
(T *mem, batch<T, A> const &val)¶ Copy content of batch
val
to the buffermem
.The memory needs to be aligned.
- Parameters
mem
: the memory buffer to write toval
: the batch to copy from
-
template<class
A
, classT
>
voidxsimd
::
store_unaligned
(T *mem, batch<T, A> const &val)¶ Copy content of batch
val
to the buffermem
.The memory does not need to be aligned.
- Parameters
mem
: the memory buffer to write toval
: the batch to copy
-
template<class
T
, classA
, classVt
, Vt...Values
>
std::enable_if<std::is_arithmetic<T>::value, batch<T, A>>::typexsimd
::
swizzle
(batch<T, A> const &x, batch_constant<batch<Vt, A>, Values...> mask)¶ Rearrange elements from
x
according to maskmask
.- Return
- swizzled batch
- Parameters
x
: batchmask
: constant batch mask of integer elements of the same size as element ofx
-
template<class
T
, classA
>
batch<T, A>xsimd
::
zip_hi
(batch<T, A> const &x, batch<T, A> const &y)¶ Unpack and interleave data from the HIGH half of batches
x
andy
.Store the results in the Return value.
- Return
- a batch of the high part of shuffled values.
- Parameters
x
: a batch of integer or floating point or double precision values.y
: a batch of integer or floating point or double precision values.
-
template<class
T
, classA
>
batch<T, A>xsimd
::
zip_lo
(batch<T, A> const &x, batch<T, A> const &y)¶ Unpack and interleave data from the LOW half of batches
x
andy
.Store the results in the Return value.
- Return
- a batch of the low part of shuffled values.
- Parameters
x
: a batch of integer or floating point or double precision values.y
: a batch of integer or floating point or double precision values.
The following empty types are used for tag dispatching:
-
struct
aligned_mode
¶ tag for load and store of aligned memory.
-
struct
unaligned_mode
¶ tag for load and store of unaligned memory.