# Intrinsics for Determining Minimum and Maximum Integer Values

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_max_epi32`, `_mm512_mask_max_epi32`, `_mm512_maskz_max_epi32` | Calculate maximum of packed int32 values. | `VPMAXSD`
`_mm512_min_epi32`, `_mm512_mask_min_epi32`, `_mm512_maskz_min_epi32` | Calculate minimum of packed int32 values. | `VPMINSD`
`_mm512_max_epu32`, `_mm512_mask_max_epu32`, `_mm512_maskz_max_epu32` | Calculate maximum of unpacked int32 values. | `VPMAXUD`
`_mm512_min_epu32`, `_mm512_mask_min_epu32`, `_mm512_maskz_min_epu32` | Calculate minimum of unpacked int32 values. | `VPMINUD`
`_mm512_max_epi64`, `_mm512_mask_max_epi64`, `_mm512_maskz_max_epi64` | Calculate maximum of packed signed int64 values. | `VPMAXSQ`
`_mm512_max_epu64`, `_mm512_mask_max_epu64`, `_mm512_maskz_max_epu64` | Calculate maximum of unpacked unsigned int64 values. | `VPMAXUQ`
`_mm512_min_epi64`, `_mm512_mask_min_epi64`, `_mm512_maskz_min_epi64` | Calculate minimum of packed signed int64 values. | `VPMINSQ`
`_mm512_min_epu64`, `_mm512_mask_min_epu64`, `_mm512_maskz_min_epu64` | Calculate minimum of unpacked unsigned int64 values. | `VPMINUQ`

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_max_epi32

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

Compares packed int32 elements in a and b, and stores packed maximum values.

_mm512_mask_max_epi32

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

Compares packed int32 elements in a and b, and stores packed maximum values using writemask k (elements are copied from src when the corresponding mask bit is not set).

_mm512_maskz_max_epi32

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

Compares packed int32 elements in a and b, and stores packed maximum values using zeromask k (elements are zeroed out when the corresponding mask bit is not set).

_mm512_max_epi64

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

Compares packed int64 elements in a and b, and stores packed maximum values.

_mm512_mask_max_epi64

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

Compares packed int64 elements in a and b, and stores packed maximum values using writemask k (elements are copied from src when the corresponding mask bit is not set).

_mm512_maskz_max_epi64

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

Compares packed int64 elements in a and b, and stores packed maximum values using zeromask k (elements are zeroed out when the corresponding mask bit is not set).

_mm512_max_epu32

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

Compares packed uint32 elements in a and b, and stores packed maximum values.

_mm512_mask_max_epu32

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

Compares packed uint32 elements in a and b, and stores packed maximum values using writemask k (elements are copied from src when the corresponding mask bit is not set).

_mm512_maskz_max_epu32

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

Compares packed uint32 elements in a and b, and stores packed maximum values using zeromask k (elements are zeroed out when the corresponding mask bit is not set).

_mm512_max_epu64

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

Compares packed uint64 elements in a and b, and stores packed maximum values.

_mm512_mask_max_epu64

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

Compares packed uint64 elements in a and b, and stores packed maximum values in using writemask k (elements are copied from src when the corresponding mask bit is not set).

_mm512_maskz_max_epu64

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

Compares packed uint64 elements in a and b, and stores packed maximum values using zeromask k (elements are zeroed out when the corresponding mask bit is not set).

_mm512_min_epi32

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

Compares packed int32 elements in a and b, and stores packed minimum values.

_mm512_mask_min_epi32

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

Compares packed int32 elements in a and b, and stores packed minimum values using writemask k (elements are copied from src when the corresponding mask bit is not set).

_mm512_maskz_min_epi32

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

Compares packed int32 elements in a and b, and stores packed minimum values using zeromask k (elements are zeroed out when the corresponding mask bit is not set).

_mm512_min_epi64

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

Compares packed int64 elements in a and b, and stores packed minimum values.

_mm512_mask_min_epi64

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

Compares packed int64 elements in a and b, and stores packed minimum values using writemask k (elements are copied from src when the corresponding mask bit is not set).

_mm512_maskz_min_epi64

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

Compares packed int64 elements in a and b, and stores packed minimum values using zeromask k (elements are zeroed out when the corresponding mask bit is not set).

_mm512_min_epu32

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

Compares packed uint32 elements in a and b, and stores packed minimum values.

_mm512_mask_min_epu32

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

Compares packed uint32 elements in a and b, and stores packed minimum values using writemask k (elements are copied from src when the corresponding mask bit is not set).

_mm512_maskz_min_epu32

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

Compares packed uint32 elements in a and b, and stores packed minimum values using zeromask k (elements are zeroed out when the corresponding mask bit is not set).

_mm512_min_epu64

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

Compares packed uint64 elements in a and b, and stores packed minimum values.

_mm512_mask_min_epu64

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

Compares packed uint64 elements in a and b, and stores packed minimum values using writemask k (elements are copied from src when the corresponding mask bit is not set).

_mm512_maskz_min_epu64

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

Compares packed uint64 elements in a and b, and stores packed minimum values using zeromask k (elements are zeroed out when the corresponding mask bit is not set).

Parent topic: Intrinsics for Determining Minimum and Maximum Values