simdpp::make_shuffle_bytes16_mask

From libsimdpp-docs
8-bit element shuffle mask
template<int s0, int s1, unsigned N>
uint8<N> make_shuffle_bytes16_mask( uint8<N> &mask );
template<int s0, int s1, int s2, int s3, unsigned N>
uint8<N> make_shuffle_bytes16_mask( uint8<N> &mask );
template<int s0, int s1, int s2, int s3, int s4, int s5, int s6, int s7, unsigned N>
uint8<N> make_shuffle_bytes16_mask( uint8<N> &mask );
template<int s0, int s1, int s2, int s3, int s4, int s5, int s6, int s7,

         int s8, int s9, int s10, int s11, int s12, int s13, int s14, int s15,
         unsigned N>

uint8<N> make_shuffle_bytes16_mask( uint8<N> &mask );
16-bit element shuffle mask
template<int s0, int s1, unsigned N>
uint16<N> make_shuffle_bytes16_mask( uint16<N> &mask );
template<int s0, int s1, int s2, int s3, unsigned N>
uint16<N> make_shuffle_bytes16_mask( uint16<N> &mask );
template<int s0, int s1, int s2, int s3, int s4, int s5, int s6, int s7, unsigned N>
uint16<N> make_shuffle_bytes16_mask( uint16<N> &mask );
32-bit element shuffle mask
template<int s0, int s1, unsigned N>
uint32<N> make_shuffle_bytes16_mask( uint32<N> &mask );
template<int s0, int s1, int s2, int s3, unsigned N>
uint32<N> make_shuffle_bytes16_mask( uint32<N> &mask );
64-bit element shuffle mask
template<int s0, int s1, unsigned N>
uint64<N> make_shuffle_bytes16_mask( uint64<N> &mask );

Makes a mask to shuffle an vector elements within 16-byte lanes using permute_bytes16(), permute_zbytes16(), shuffle_bytes16() or shuffle_zbytes16() functions.

The type of the mask argument determines the type of the vector to create mask for.

The number of the selector template parameters (s0, s1, ...) determines the actual lane width within which the elements will be shuffled. The maximum size of the lane elements will be shuffled across is 16 bytes.

2 element selector template[edit]

Elements are shuffled across element pairs.

All elements within vectors are grouped into lanes of two adjacent elements. Elements within each lane of the resulting vector can be selected only from corresponding sets of the source vectors.

The template arguments define which elements to select from each element group:

The created mask will cause shuffle_zbytes16() to perform as follows:

r0 = (s0 == -1) ? 0 : (s0 < 2 ? a[s0] : b[s0-2])
r1 = (s1 == -1) ? 0 : (s1 < 2 ? a[s1] : b[s1-2])
r2 = (s0 == -1) ? 0 : (s0 < 2 ? a[s0+2] : b[s0])
r3 = (s1 == -1) ? 0 : (s1 < 2 ? a[s1+2] : b[s1])
...

4 element selector template[edit]

Elements are shuffled across element pairs.

All elements within vectors are grouped into lanes of 4 adjacent elements. Elements within each lane of the resulting vector can be selected only from corresponding sets of the source vectors.

The template arguments define which elements to select from each element group:

The created mask will cause shuffle_zbytes16() to perform as follows:

r0 = (s0 == -1) ? 0 : (s0 < 4 ? a[s0] : b[s0-4])
r1 = (s1 == -1) ? 0 : (s1 < 4 ? a[s1] : b[s1-4])
r2 = (s2 == -1) ? 0 : (s2 < 4 ? a[s2] : b[s2-4])
r3 = (s3 == -1) ? 0 : (s3 < 4 ? a[s3] : b[s3-4])
...

8 element selector template[edit]

Elements are shuffled across element pairs.

All elements within vectors are grouped into lanes of 8 adjacent elements. Elements within each lane of the resulting vector can be selected only from corresponding sets of the source vectors.

The template arguments define which elements to select from each element group:

The created mask will cause shuffle_zbytes16() to perform as follows:

r0 = (s0 == -1) ? 0 : (s0 < 8 ? a[s0] : b[s0-8])
...
r7 = (s7 == -1) ? 0 : (s7 < 8 ? a[s7] : b[s7-8])
...

16 element selector template[edit]

Elements are shuffled across element pairs.

All elements within vectors are grouped into lanes of 8 adjacent elements. Elements within each lane of the resulting vector can be selected only from corresponding sets of the source vectors.

The template arguments define which elements to select from each element group:

The created mask will cause shuffle_zbytes16() to perform as follows:

r0 = (s0 == -1) ? 0 : (s0 < 16 ? a[s0] : b[s0-16])
r1 = (s1 == -1) ? 0 : (s0 < 16 ? a[s1] : b[s1-16])
...
r15 = (s15 == -1) ? 0 : (s15 < 16 ? a[s15] : b[s15-16])
...

Parameters[edit]

mask - mask vector

Return value[edit]

mask

See also[edit]

selects elements from two vectors according to another vector
(function template)
selects or zeroes elements from two vectors according to another vector
(function template)
permutes elements in a vector according to another vector
(function template)
permutes or zeroes elements in a vector according to another vector
(function template)