E.V.E
v2023.02.15
 
Loading...
Searching...
No Matches

◆ gather

auto eve::gather = functor<gather_t>
inlineconstexpr

Header file

#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<arithmetic_value T, integral_value U>
as_wide_as_t<T, U> gather(T const* ptr, U idx);
template<arithmetic_value T, integral_value U, typename N>
auto gather(aligned_ptr<T, N> ptr, U idx);
}
constexpr auto gather
Load a SIMD value with values selected from a memory region at the given offsets.
Definition gather.hpp:74
EVE Main Namespace.
Definition abi.hpp:18
Wrapper for non-owning aligned pointers.
Definition aligned_ptr.hpp:50

Parameters

  • idx: An instance of an integral value.
  • ptr: A pointer to the memory region to load from.

Return value

  • A value equivalent to:
    as_wide_as_t<T, U> res = { ptr[idx[0]], ptr[idx[1]], ..., ptr[idx[N-1]] };

Example

#include <iostream>
#include <eve/module/core.hpp>
int main()
{
std::vector<int> v{1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12};
eve::wide<int, eve::fixed<4>> res = eve::gather(v.data(), eve::wide<char, eve::fixed<4>>{0, 2, 2, 11});
std::cout << "res -> " << res << std::endl;
}
SIMD register cardinal type.
Definition cardinal.hpp:15
Wrapper for SIMD registers.
Definition wide.hpp:93