# Intrinsics for Integer Pack and Unpack Operations

The prototypes for Intel® Advanced Vector Extensions 512 (Intel® AVX-512) intrinsics are located in the zmmintrin.h header file.
To use these intrinsics, include the immintrin.h file as follows:

    #include <immintrin.h>

Intrinsic Name | Operation | Corresponding Intel® AVX-512 Instruction
--- | --- | ---
`_mm512_unpackhi_epi32`, `_mm512_mask_unpackhi_epi32`, `_mm512_maskz_unpackhi_epi32` | Unpacks and interleaves high packed int32 values. | `VPUNPCKHQD`, `VUNPCKHQD`, `UNPCKHQD`
`_mm512_unpackhi_epi64`, `_mm512_mask_unpackhi_epi64`, `_mm512_maskz_unpackhi_epi64` | Unpacks and interleaves high packed int64 values. | `VPUNPCKHQDQ`, `VUNPCKHQDQ`, `UNPCKHQDQ`
`_mm512_unpacklo_epi32`, `_mm512_mask_unpacklo_epi32`, `_mm512_maskz_unpacklo_epi32` | Unpacks and interleaves low packed int32 values. | `VPUNPCKLQD`, `VUNPCKLQD`, `UNPCKLQD`
`_mm512_unpacklo_epi64`, `_mm512_mask_unpacklo_epi64`, `_mm512_maskz_unpacklo_epi64` | Unpacks and interleaves low packed int64 values. | `VPUNPCKLQDQ`, `VUNPCKLQDQ`, `UNPCKLQDQ`

variable | definition
--- | ---
k | writemask used as a selector
a | first source vector element
b | second source vector element
src | source element to use based on writemask result

_mm512_unpackhi_epi32

    extern __m512i __cdecl _mm512_unpackhi_epi32(__m512i a, __m512i b);

Unpacks and interleaves int32 elements from the high half of each 128-bit lane in a and b, and stores the result.

_mm512_mask_unpackhi_epi32

    extern __m512i __cdecl _mm512_mask_unpackhi_epi32(__m512i src, __mmask16 k, __m512i a, __m512i b);

Unpacks and interleaves int32 elements from the high half of each 128-bit lane in a and b, and stores the result using writemask k (elements are copied from src when the corresponding mask bit is not set).

_mm512_maskz_unpackhi_epi32

    extern __m512i __cdecl _mm512_maskz_unpackhi_epi32(__mmask16 k, __m512i a, __m512i b);

Unpacks and interleaves int32 elements from the high half of each 128-bit lane in a and b, and stores the result using zeromask k (elements are zeroed out when the corresponding mask bit is not set).

_mm512_unpackhi_epi64

    extern __m512i __cdecl _mm512_unpackhi_epi64(__m512i a, __m512i b);

Unpacks and interleaves int64 elements from the high half of each 128-bit lane in a and b, and stores the result.

_mm512_mask_unpackhi_epi64

    extern __m512i __cdecl _mm512_mask_unpackhi_epi64(__m512i src, __mmask8 k, __m512i a, __m512i b);

Unpacks and interleaves int64 elements from the high half of each 128-bit lane in a and b, and stores the result using writemask k (elements are copied from src when the corresponding mask bit is not set).

_mm512_maskz_unpackhi_epi64

    extern __m512i __cdecl _mm512_maskz_unpackhi_epi64(__mmask8 k, __m512i a, __m512i b);

Unpacks and interleaves int64 elements from the high half of each 128-bit lane in a and b, and stores the result using zeromask k (elements are zeroed out when the corresponding mask bit is not set).

_mm512_unpacklo_epi32

    extern __m512i __cdecl _mm512_unpacklo_epi32(__m512i a, __m512i b);

Unpacks and interleaves int32 elements from the low half of each 128-bit lane in a and b, and stores the result.

_mm512_mask_unpacklo_epi32

    extern __m512i __cdecl _mm512_mask_unpacklo_epi32(__m512i src, __mmask16 k, __m512i a, __m512i b);

Unpacks and interleaves int32 elements from the low half of each 128-bit lane in a and b, and stores the result using writemask k (elements are copied from src when the corresponding mask bit is not set).

_mm512_maskz_unpacklo_epi32

    extern __m512i __cdecl _mm512_maskz_unpacklo_epi32(__mmask16 k, __m512i a, __m512i b);

Unpacks and interleaves int32 elements from the low half of each 128-bit lane in a and b, and stores the result using zeromask k (elements are zeroed out when the corresponding mask bit is not set).

_mm512_unpacklo_epi64

    extern __m512i __cdecl _mm512_unpacklo_epi64(__m512i a, __m512i b);

Unpacks and interleaves int64 elements from the low half of each 128-bit lane in a and b, and stores the result.

_mm512_mask_unpacklo_epi64

    extern __m512i __cdecl _mm512_mask_unpacklo_epi64(__m512i src, __mmask8 k, __m512i a, __m512i b);

Unpacks and interleaves int64 elements from the low half of each 128-bit lane in a and b, and stores the result using writemask k (elements are copied from src when the corresponding mask bit is not set).

_mm512_maskz_unpacklo_epi64

    extern __m512i __cdecl _mm512_maskz_unpacklo_epi64(__mmask8 k, __m512i a, __m512i b);

Unpacks and interleaves int64 elements from the low half of each 128-bit lane in a and b, and stores the result using zeromask k (elements are zeroed out when the corresponding mask bit is not set).

Parent topic: Intrinsics for Pack and Unpack Operations