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

◆ reverse_in_subgroups

auto eve::reverse_in_subgroups = detail::named_shuffle_1<reverse_in_subgroups_t> {}
inlineconstexpr

Defined in Header

#include <eve/module/core.hpp>

As any named shuffle, allows to pass a group size, to treat multiple elements as one. Group size has to be 0 < G <= T::size() Subgroup size has to be 1 <= SubG <= T::size() / G

Note
SubG == T::size() makes this function equivalent eve::reverse.
template <simd_value T, std::ptrdiff_t G, std::ptrdiff_t SubG>
template <simd_value T, std::ptrdiff_t SubG>
constexpr auto reverse_in_subgroups
a named shuffle for reversing all subgroups in a register
Definition reverse_in_subgroups.hpp:133
SIMD register cardinal type.
Definition cardinal.hpp:15

Parameters

  • x - simd_value to shuffle
  • G - (optional) - number of elements to treat as one.
  • SubG - size of a subgroup

(2) calls (1) with G == 1; (1) within each SubG reverses positions elements

Return value

Returns x where each subgroup is reversed.

Example

#include <eve/module/core.hpp>
#include <tts/tts.hpp>
int
main()
{
w_t x {0, 1, 2, 3};
TTS_EXPECT(eve::all(w_t {0, 1, 2, 3} == eve::reverse_in_subgroups(x, eve::lane<1>)));
TTS_EXPECT(eve::all(w_t {1, 0, 3, 2} == eve::reverse_in_subgroups(x, eve::lane<2>)));
TTS_EXPECT(eve::all(w_t {3, 2, 1, 0} == eve::reverse_in_subgroups(x, eve::lane<4>)));
TTS_EXPECT(
eve::all(w_t {2, 3, 0, 1} == eve::reverse_in_subgroups(x, eve::lane<2>, eve::lane<2>)));
}
constexpr callable_all_ all
Computes a bool value which is true if and only if all elements of x are not zero.
Definition all.hpp:58
Wrapper for SIMD registers.
Definition wide.hpp:70