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

◆ rotate

callable_rotate_ eve::rotate = {}
inlineconstexpr
#include <eve/module/core.hpp>

Callable Signatures

namespace eve
{
template<simd_value T, std::ptrdiff_t M>
T rotate(T x, index<N> const &) noexcept;
constexpr callable_rotate_ rotate
rotates two halves of the register by a chosen number of elements.
Definition rotate.hpp:59
EVE Main Namespace.
Definition abi.hpp:18

Parameters

  • x : simd value to rotate
  • M : position of the middle. In std::rotate(f, m, l) -> this is std::distance(f, m);

Return value

Return T which is a permutation of x such that elements x[M: T::size()) come first followed by x[0:M) and the relative order in those halves is preserved.

Example

#include <iostream>
#include <eve/module/core.hpp>
int main()
{
wide_it x = {1, 2, 3, 4};
std::cout << "---- simd" << '\n'
<< "<- x = " << x << '\n'
<< "-> rotate(x, eve::index<0>) = " << eve::rotate(x, eve::index<0>) << '\n'
<< "-> rotate(x, eve::index<1>) = " << eve::rotate(x, eve::index<1>) << '\n'
<< "-> rotate(x, eve::index<2>) = " << eve::rotate(x, eve::index<2>) << '\n'
<< "-> rotate(x, eve::index<3>) = " << eve::rotate(x, eve::index<3>) << '\n'
<< "-> rotate(x, eve::index<4>) = " << eve::rotate(x, eve::index<4>) << '\n';
}
Wrapper for SIMD registers.
Definition wide.hpp:70