simdpp::shuffle2x2
From libsimdpp-docs
< shuffle
template<unsigned s0, unsigned s1, unsigned N, class E1, class E2>
Ret<N,_DETAIL_> shuffle2x2( const Vec1<N,E1>& a, const Vec2<N,E2& b ); |
||
Shuffles two vectors at 2x2 element block granularity.
The implementation behaves as if the following set of overloads is provided:
Ret
|
Vec1
|
Vec2
|
---|---|---|
promoted 32-bit vector | any 32-bit vector | any 32-bit vector |
promoted 64-bit vector | any 64-bit vector | any 64-bit vector |
The type of the return vector is governed by the expression promotion rules. The return type is a vector expression.
The selectors s0
and s1
must be in range [0..3].
The vectors are shuffled at 2x2 block granularity as follows: the vectors are partitioned into N/2
groups. The n
-th group in the return vector will contain:
-
- elements only from
n
-th groups ofa
andb
vectors - the first and second elements are selected by the
s0
ands1
selectors respectively - values 0 and 1 correspond to the 0 and 1 elements from
n
-th group froma
, 2 and 3 correspond to the 0 and 1 elements fromn
-th group fromb
.
- elements only from
Parameters[edit]
a, b | - | source vectors |
s0, s1 | - | the permutation indices |
Return value[edit]
A vector expression evaluating to the shuffled vectors.
Equivalent operation[edit]
r0 = s0 < 2 ? a[s0] : b[s0-2] r1 = s1 < 2 ? a[s1] : b[s1-2] r2 = s0 < 2 ? a[s0+2] : b[s0] r3 = s1 < 2 ? a[s1+2] : b[s1] r4 = s0 < 2 ? a[s0+4] : b[s0+2] r5 = s1 < 2 ? a[s1+4] : b[s1+2] ...
See also[edit]
This section is incomplete |