simdpp::store_last

From libsimdpp-docs
< mem
template<unsigned N, class V>
void store_last( void* ptr, const any_vec<N,V>& a, unsigned n );

Stores the last n elements the given vector to memory block starting at ptr. n must be in range [0..N].

The function may be implemented as read-modify-write operation that behaves as if store(ptr, blend(a, (V) load(ptr), store_mask) was executed.

The function is meant to be used in loop heads. It results in several instructions and is best not used in inner loops.

V must me a non-mask vector type. ptr must be aligned to vector size.

Parameters[edit]

ptr - pointer to location to store data to
a - vector to store
n - the number of elements to store

Return value[edit]

(none)

Equivalent operation[edit]

*(p+0) = (n > M)   ? a0 : *(p+0)
*(p+1) = (n > M-1) ? a1 : *(p+1)
...
*(p+M) = (n > 0)   ? aM : *(p+M)

Here M = N-1.

See also[edit]