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

◆ broadcast_lane

auto eve::broadcast_lane = detail::named_shuffle_1<broadcast_lane_t> {}
inlineconstexpr
Note
use eve::broadcast or a constructor to create a simd_value from a scalar value. This is a shuffle, for when the value is in register already.

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()

template <simd_value T, std::ptrdiff_t G, std::ptrdiff_t I>
T broadcast_lane(T x, eve::fixed<G>, eve::index_t<I>); // (1)
template <simd_value T, std::ptrdiff_t I>
T broadcast_lane(T x, eve::index_t<I>); // (2)
constexpr auto broadcast_lane
a named shuffle for duplicating the lane across a register.
Definition broadcast_lane.hpp:127
SIMD register cardinal type.
Definition cardinal.hpp:15

Parameters

  • x - simd_value to shuffle
  • G - (optional) - number of elements to treat as one.
  • I - index of the lane to broadcast

(2) calls (1) with G == 1; (1) broadcasts the group of size G in position I to all register.

Return value

shuffled register

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{1, 1, 1, 1} == eve::broadcast_lane(x, eve::index<1>)) );
TTS_EXPECT( eve::all( w_t{2, 3, 2, 3} == eve::broadcast_lane(x, eve::lane<2>, eve::index<1>)) );
TTS_EXPECT( eve::all( w_t{0, 1, 2, 3} == eve::broadcast_lane(x, eve::lane<4>, eve::index<0>)) );
}
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