simdpp::shuffle4x2
From libsimdpp-docs
< shuffle
template<unsigned s0, unsigned s1, unsigned s2, unsigned s3,
unsigned N, class E1, class E2> |
||
Shuffles two vectors at 4x4 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
, s1
, s2
and s3
must be in range [0..7].
The vectors are shuffled at 4x4 block granularity as follows: the vectors are partitioned into N/4
groups. The n
-th group in the return vector will contain:
-
- elements only from
n
-th groups ofa
andb
vectors - the 0-th, 1-st, 2-nd and 3-rd elements are selected by the
s0
,s1
,s2
ands3
selectors respectively - values 0..3 correspond to the 0..3-th elements from
n
-th group froma
, 4..7 correspond to the 0..3-th elements fromn
-th group fromb
.
- elements only from
Parameters[edit]
a, b | - | source vectors |
s0, s1, s2, s3 | - | the permutation indices |
Return value[edit]
A vector expression evaluating to the shuffled vectors.
Equivalent operation[edit]
r0 = s0 < 4 ? a[s0] : b[s0-4] r1 = s1 < 4 ? a[s1] : b[s1-4] r2 = s2 < 4 ? a[s2] : b[s2-4] r3 = s3 < 4 ? a[s3] : b[s3-4] r4 = s0 < 4 ? a[s0+4] : b[s0] r5 = s1 < 4 ? a[s1+4] : b[s1] r6 = s2 < 4 ? a[s2+4] : b[s2] r7 = s3 < 4 ? a[s3+4] : b[s3] ...
See also[edit]
This section is incomplete |