T-SIMD v31.1.0
A C++ template SIMD library
Loading...
Searching...
No Matches
Zip and Unpack

Description

Zip, unzip and unpack functions.

Functions

template<size_t PART, size_t NUM_ELEMS, typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::unpack (const Vec< T, SIMD_WIDTH > &a, const Vec< T, SIMD_WIDTH > &b)
 Interleaves blocks of elements from the high or low half of two Vec's.
 
template<size_t PART, size_t NUM_ELEMS, typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::unpack16 (const Vec< T, SIMD_WIDTH > &a, const Vec< T, SIMD_WIDTH > &b)
 Interleaves blocks of elements from the high or low half of each 16-byte lane of two Vec's.
 
template<size_t NUM_ELEMS, typename T , size_t SIMD_WIDTH>
static void simd::unzip (const Vec< T, SIMD_WIDTH > a, const Vec< T, SIMD_WIDTH > b, Vec< T, SIMD_WIDTH > &l, Vec< T, SIMD_WIDTH > &h)
 Deinterleaves blocks of elements two Vec's.
 
template<size_t NUM_ELEMS, typename T , size_t SIMD_WIDTH>
static void simd::zip (const Vec< T, SIMD_WIDTH > a, const Vec< T, SIMD_WIDTH > b, Vec< T, SIMD_WIDTH > &l, Vec< T, SIMD_WIDTH > &h)
 Interleaves blocks of elements of two Vec's.
 
template<size_t NUM_ELEMS, typename T , size_t SIMD_WIDTH>
static void simd::zip16 (const Vec< T, SIMD_WIDTH > a, const Vec< T, SIMD_WIDTH > b, Vec< T, SIMD_WIDTH > &l, Vec< T, SIMD_WIDTH > &h)
 Interleaves blocks of elements of each 16-byte lane of two Vec's.
 

Function Documentation

◆ unpack()

template<size_t PART, size_t NUM_ELEMS, typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::unpack ( const Vec< T, SIMD_WIDTH > & a,
const Vec< T, SIMD_WIDTH > & b )
inlinestatic

Interleaves blocks of elements from the high or low half of two Vec's.

This function interleaves blocks of elements from the high or low half of two Vec's, starting with the lowest block of the selected half of the first input Vec.

To get both halves of the input Vec's interleaved, use zip().

Example: TODO?

Template Parameters
PARTselects which half of the input Vec's to use. A value of 0 selects the low half, a value of 1 selects the high half
NUM_ELEMSnumber of elements in a block, this must be a power of two (including 1) and be at most half of one Vec
Parameters
afirst input Vec
bsecond input Vec
Returns
interleaved Vec

◆ unpack16()

template<size_t PART, size_t NUM_ELEMS, typename T , size_t SIMD_WIDTH>
static Vec< T, SIMD_WIDTH > simd::unpack16 ( const Vec< T, SIMD_WIDTH > & a,
const Vec< T, SIMD_WIDTH > & b )
inlinestatic

Interleaves blocks of elements from the high or low half of each 16-byte lane of two Vec's.

This function interleaves blocks of elements from the high or low half of each 16-byte lane of two Vec's, starting with the lowest block of the selected half of the first input Vec.

This function is the lane-oriented equivalent of unpack().

If the blocks of elements to be interleaved are larger than half of a 16-byte lane the behavior of this function is undefined.

To get both halves of the input Vec's interleaved, use zip16().

Example: TODO?

Template Parameters
PARTselects which half of the lanes of the input Vec's to use. A value of 0 selects the low half, a value of 1 selects the high half
NUM_ELEMSnumber of elements in a block, must be a power of two (including 1) and be at most half of one 16-byte lane of one Vec (i.e. at most 8 bytes)
Parameters
afirst input Vec
bsecond input Vec
Returns
interleaved Vec

◆ unzip()

template<size_t NUM_ELEMS, typename T , size_t SIMD_WIDTH>
static void simd::unzip ( const Vec< T, SIMD_WIDTH > a,
const Vec< T, SIMD_WIDTH > b,
Vec< T, SIMD_WIDTH > & l,
Vec< T, SIMD_WIDTH > & h )
inlinestatic

Deinterleaves blocks of elements two Vec's.

This function deinterleaves blocks of elements from two Vec's. This is the inverse of zip().

Example: TODO?

See also
zip()
Template Parameters
NUM_ELEMSnumber of elements in a block, must be a power of two (including 1) and be at most half of one Vec
Parameters
afirst input Vec
bsecond input Vec
[out]loutput Vec containing the low half of the deinterleaved blocks
[out]houtput Vec containing the high half of the deinterleaved blocks

◆ zip()

template<size_t NUM_ELEMS, typename T , size_t SIMD_WIDTH>
static void simd::zip ( const Vec< T, SIMD_WIDTH > a,
const Vec< T, SIMD_WIDTH > b,
Vec< T, SIMD_WIDTH > & l,
Vec< T, SIMD_WIDTH > & h )
inlinestatic

Interleaves blocks of elements of two Vec's.

This function interleaves blocks of elements from two Vec's, starting with the lowest block of the first input Vec. The interleaved blocks are returned in two output Vec's.

This function is semantically equivalent to calling unpack() twice for both parts, but may be more efficient on some platforms (such as arm NEON).

Example: TODO?

See also
unpack()
unzip()
Template Parameters
NUM_ELEMSnumber of elements in a block, must be a power of two (including 1) and be at most half of one Vec
Parameters
afirst input Vec
bsecond input Vec
[out]loutput Vec containing the low half of the interleaved blocks
[out]houtput Vec containing the high half of the interleaved blocks

◆ zip16()

template<size_t NUM_ELEMS, typename T , size_t SIMD_WIDTH>
static void simd::zip16 ( const Vec< T, SIMD_WIDTH > a,
const Vec< T, SIMD_WIDTH > b,
Vec< T, SIMD_WIDTH > & l,
Vec< T, SIMD_WIDTH > & h )
inlinestatic

Interleaves blocks of elements of each 16-byte lane of two Vec's.

This function interleaves blocks of elements from the high or low half of each 16-byte lane of two Vec's, starting with the lowest block of the selected half of the first input Vec. The interleaved blocks are returned in two output Vec's.

This function is the lane-oriented equivalent of zip().

This function is semantically equivalent to calling unpack16() twice for both parts, but may be more efficient on some platforms (such as arm NEON).

Example: TODO?

See also
unpack16()
Template Parameters
NUM_ELEMSnumber of elements in a block, must be a power of two (including 1) and be at most half of one Vec
Parameters
afirst input Vec
bsecond input Vec
[out]loutput Vec containing the low half of the interleaved blocks
[out]houtput Vec containing the high half of the interleaved blocks