Store each element of a given SIMD value v
in different memory address computed form a base SIMD compatible iterator ptr
and a SIMD integral value idx
used as indexes.
A call to eve::scatter(v,ptr,idx)
is semantically equivalent to:
for(std::size_t i=0;i<v.size();++i)
ptr[idx.get(i)] = v.get(i);
#include <eve/module/core.hpp>
{
template<simd_value T, integral_simd_value Idx, simd_compatible_ptr<T> Ptr>
requires(T::size() == Idx::size())
void scatter(T
const& v, Ptr ptr, Idx
const& idx)
noexcept;
}
constexpr auto scatter
Store a SIMD register to memory using scattered indexes.
Definition scatter.hpp:90
EVE Main Namespace.
Definition abi.hpp:18
Parameters
eve::scatter can be masked using Relative conditionals to skip scattering of certain elements.
The call eve::scatter[cond](v,p,i)
is semantically equivalent to:
auto m = cond.mask(
as<as_logical_t<T>>{} );
for(std::size_t n=0;n<v.size();++n)
{
if(m.get(n))
write(v.get(n),p+idx.get(n));
}
constexpr auto write
Callable object writing a scalar value to memory.
Definition write.hpp:78
Lightweight type-wrapper.
Definition as.hpp:29
#include <eve/module/core.hpp>
#include <iostream>
int main()
{
for(auto e : data)
std::cout << e << " ";
std::cout << "\n";
}
Wrapper for SIMD registers.
Definition wide.hpp:70
static constexpr size_type size() noexcept
Size of the wide in number of lanes.
Definition wide.hpp:376