# Intrinsics for Integer Shuffle 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_shuffle_epi32`, `_mm512_mask_shuffle_epi32`, `_mm512_maskz_shuffle_epi32` | Shuffle int32 vectors within 128-bit lanes using control value. | `VPSHUFD`
`_mm512_shuffle_i32x4`, `_mm512_mask_shuffle_i32x4`, `_mm512_maskz_shuffle_i32x4` | Shuffle four int32 values by specified value. | `VSHUFI32X4`
`_mm512_shuffle_i64x2`, `_mm512_mask_shuffle_i64x2`, `_mm512_maskz_shuffle_i64x2` | Shuffle two int64 values by specified value. | `VSHUFI64X2`

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
imm | control value for shuffle operation

_mm512_shuffle_epi32

    extern __m512i _cdecl __m512_shuffle_epi32(__m512i a, _MM_PERM_ENUM imm);

Shuffles int32 in a within 128-bit lanes using the control in imm, and stores the result.

_mm512_mask_shuffle_epi32

    extern __m512i _cdecl __m512_mask_shuffle_epi32(__m512i src, __mmask16 k, __m512i a, _MM_PERM_ENUM imm);

Shuffles int32 in a within 128-bit lanes using the control in imm, and stores the result using writemask k (elements are copied from src when the corresponding mask bit is not set).

_mm512_maskz_shuffle_epi32

    extern__m512i _cdecl __m512_maskz_shuffle_epi32(__mmask16 k, __m512i a, _MM_PERM_ENUM imm);

Shuffles int32 in a within 128-bit lanes using the control in imm, and stores the result using zeromask k (elements are zeroed out when the corresponding mask bit is not set).

_mm512_shuffle_i32x4

    extern __m512i _cdecl __m512_shuffle_i32x4(__m512i a, __m512i b, _MM_PERM_ENUM imm);

Shuffles 128-bits (composed of four int32) selected by imm from a and b, and stores the result.

_mm512_mask_shuffle_i32x4

    extern __m512i _cdecl __m512_mask_shuffle_i32x4(__m512i src, __mmask16 k, __m512i a, __m512i b, _MM_PERM_ENUM imm);

Shuffles 128-bits (composed of four int32) selected by imm from 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_shuffle_i32x4

    extern __m512i _cdecl __m512_maskz_shuffle_i32x4(__mmask16 k, __m512i a, __m512i b, _MM_PERM_ENUM imm);

Shuffles 128-bits (composed of four int32) selected by imm from a and b, and stores the result using zeromask k (elements are zeroed out when the corresponding mask bit is not set).

_mm512_shuffle_i64x2

    extern __m512i _cdecl __m512_shuffle_i64x2(__m512i a, __m512i b, _MM_PERM_ENUM imm);

Shuffles 128-bits (composed of two int64) selected by imm from a and b, and stores the result.

_mm512_mask_shuffle_i64x2

    extern __m512i _cdecl __m512_mask_shuffle_i64x2(__m512i src, __mmask8 k, __m512i b, __m512i b, _MM_PERM_ENUM imm);

Shuffles 128-bits (composed of two int64) selected by imm from 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_shuffle_i64x2

    extern __m512i _cdecl __m512_maskz_shuffle_i64x2(__mmask8 k, __m512i a, __m512i b, _MM_PERM_ENUM imm);

Shuffles 128-bits (composed of two int64) selected by imm from 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 Shuffle Operations