# Intrinsics for Determining Minimum and Maximum FP 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_round_pd``_mm512_mask_max_round_pd``_mm512_maskz_max_round_pd` `_mm512_max_pd``_mm512_mask_max_pd``_mm512_maskz_max_pd` | Calculate maximum of rounded float64 values. | `VMAXPD`
`_mm512_max_round_ps``_mm512_mask_max_round_ps``_mm512_maskz_max_round_ps` `_mm512_max_ps``_mm512_mask_max_ps``_mm512_maskz_max_ps` | Calculate maximum of rounded float32 values. | `VMAXPS`
`_mm_mask_max_sd``_mm_maskz_max_sd` `_mm_max_round_sd`, `_mm_mask_max_round_sd`, `_mm_maskz_max_round_sd` | Calculate maximum of scalar float64 values. | `VMAXSD`
`_mm_mask_max_ss``_mm_maskz_max_ss` `_mm_max_round_ss`, `_mm_mask_max_round_ss`, `_mm_maskz_max_round_ss` | Calculate maximum of scalar float32 values. | `VMAXSS`
`_mm512_min_pd`, `_mm512_mask_min_pd`, `_mm512_maskz_min_pd` `_mm512_min_round_pd`, `_mm512_mask_min_round_pd`, `_mm512_maskz_min_round_pd` | Calculate minimum of packed float64 values. | `VMINPD`
`_mm512_min_ps`, `_mm512_mask_min_ps`, `_mm512_maskz_min_ps` `_mm512_min_round_ps`, `_mm512_mask_min_round_ps`, `_mm512_maskz_min_round_ps` | Calculate minimum of packed float32 values. | `VMINPS`
`_mm_mask_min_sd``_mm_maskz_min_sd` `_mm_min_round_sd`, `_mm_mask_min_round_sd`, `_mm_maskz_min_round_sd` | Calculate minimum of scalar float64 values. | `VMINSD`
`_mm_mask_min_ss``_mm_maskz_min_ss` `_mm_min_round_ss`, `_mm_mask_min_round_ss`, `_mm_maskz_min_round_ss` | Calculate minimum of scalar float32 values. | `VMINSS`

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
round | Rounding control values; these can be one of the following (along with the `sae` suppress all exceptions flag): `_MM_FROUND_TO_NEAREST_INT` - rounds to nearest even `_MM_FROUND_TO_NEG_INF` - rounds to negative infinity `_MM_FROUND_TO_POS_INF` - rounds to positive infinity `_MM_FROUND_TO_ZERO` - rounds to zero `_MM_FROUND_CUR_DIRECTION` - rounds using default from MXCSR register

_mm512_max_pd

    extern __m512d __cdecl _mm512_max_pd(__m512d a, __m512d b);

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

_mm512_mask_max_pd

    extern __m512d __cdecl _mm512_mask_max_pd(__m512d src, __mmask8 k, __m512d a, __m512d b);

Compares packed float64 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_pd

    extern __m512d __cdecl _mm512_maskz_max_pd(__mmask8 k, __m512d a, __m512d b);

Compares packed float64 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_round_pd

    extern __m512d __cdecl _mm512_max_round_pd(__m512d a, __m512d b, int round);

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

### Note

Pass `__MM_FROUND_NO_EXC` to round to suppress all exceptions.

_mm512_mask_max_round_pd

    extern __m512d __cdecl _mm512_mask_max_round_pd(__m512d src, __mmask8 k, __m512d a, __m512d b, int round);

Compares packed float64 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).

### Note

Pass `__MM_FROUND_NO_EXC` to round to suppress all exceptions.

_mm512_maskz_max_round_pd

    extern __m512d __cdecl _mm512_maskz_max_round_pd(__mmask8 k, __m512d a, __m512d b, int round);

Compares packed float64 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).

### Note

Pass `__MM_FROUND_NO_EXC` to round to suppress all exceptions.

_mm512_max_ps

    extern __m512 __cdecl _mm512_max_ps(__m512 a, __m512 b);

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

_mm512_mask_max_ps

    extern __m512 __cdecl _mm512_mask_max_ps(__m512 src, __mmask16 k, __m512 a, __m512 b);

Compares packed float32 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_ps

    extern __m512 __cdecl _mm512_maskz_max_ps(__mmask16 k, __m512 a, __m512 b);

Compares packed float32 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_round_ps

    extern __m512 __cdecl _mm512_max_round_ps(__m512 a, __m512 b, int round);

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

### Note

Pass `__MM_FROUND_NO_EXC` to round to suppress all exceptions.

_mm512_mask_max_round_ps

    extern __m512 __cdecl _mm512_mask_max_round_ps(__m512 src, __mmask16 k, __m512 a, __m512 b, int round);

Compares packed float32 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).

### Note

Pass `__MM_FROUND_NO_EXC` to round to suppress all exceptions.

_mm512_maskz_max_round_ps

    extern __m512 __cdecl _mm512_maskz_max_round_ps(__mmask16 k, __m512 a, __m512 b, int round);

Compares packed float32 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).

### Note

Pass `__MM_FROUND_NO_EXC` to round to suppress all exceptions.

_mm_mask_max_sd

    extern __m128d __cdecl _mm_mask_max_sd(__m128d src, __mmask8 k, __m128d a, __m128d b);

Compares the lower float64 elements in a and b, stores the maximum value in the lower destination element using writemask k (the element is copied from src when mask bit 0 is not set), and copies the upper element from a to the upper destination element.

_mm_maskz_max_sd

    extern __m128d __cdecl _mm_maskz_max_sd(__mmask8 k, __m128d a, __m128d b);

Compares the lower float64 elements in a and b, stores the maximum value in the lower destination element using zeromask k (the element is zeroed out when mask bit 0 is not set), and copies the upper element from a to the upper destination element.

_mm_max_round_sd

    extern __m128d __cdecl _mm_max_round_sd(__m128d a, __m128d b, int round);

Compares the lower float64 elements in a and b, stores the maximum value in the lower destination element, and copies the upper element from a to the upper destination element.

### Note

Pass `__MM_FROUND_NO_EXC` to round to suppress all exceptions.

_mm_mask_max_round_sd

    extern __m128d __cdecl _mm_mask_max_round_sd(__m128d src, __mmask8 k, __m128d a, __m128d b, int round);

Compares the lower float64 elements in a and b, stores the maximum value in the lower destination element using writemask k (the element is copied from src when mask bit 0 is not set), and copies the upper element from a to the upper destination element.

### Note

Pass `__MM_FROUND_NO_EXC` to round to suppress all exceptions.

_mm_maskz_max_round_sd

    extern __m128d __cdecl _mm_maskz_max_round_sd(__mmask8 k, __m128d a, __m128d b, int round);

Compares the lower float64 elements in a and b, stores the maximum value in the lower destination element using zeromask k (the element is zeroed out when mask bit 0 is not set), and copies the upper element from a to the upper destination element.

### Note

Pass `__MM_FROUND_NO_EXC` to round to suppress all exceptions.

_mm_mask_max_ss

    extern __m128 __cdecl _mm_mask_max_ss(__m128 src, __mmask8 k, __m128 a, __m128 b);

Compares the lower float32 elements in a and b, stores the maximum value in the lower destination element using writemask k (the element is copied from src when mask bit 0 is not set), and copies the upper element from a to the upper destination element.

_mm_maskz_max_ss

    extern __m128 __cdecl _mm_maskz_max_ss(__mmask8 k, __m128 a, __m128 b);

Compares the lower float32 elements in a and b, stores the maximum value in the lower destination element using zeromask k (the element is zeroed out when mask bit 0 is not set), and copies the upper element from a to the upper destination element.

_mm_max_round_ss

    extern __m128 __cdecl _mm_max_round_ss(__m128 a, __m128 b, int round);

Compares the lower float32 elements in a and b, stores the maximum value in the lower destination element, and copies the upper element from a to the upper destination element.

### Note

Pass `__MM_FROUND_NO_EXC` to round to suppress all exceptions.

_mm_mask_max_round_ss

    extern __m128 __cdecl _mm_mask_max_round_ss(__m128 src, __mmask8 k, __m128 a, __m128 b, int round);

Compares the lower float32 elements in a and b, stores the maximum value in the lower destination element using writemask k (the element is copied from src when mask bit 0 is not set), and copies the upper element from a to the upper destination element.

### Note

Pass `__MM_FROUND_NO_EXC` to round to suppress all exceptions.

_mm_maskz_max_round_ss

    extern __m128 __cdecl _mm_maskz_max_round_ss(__mmask8 k, __m128 a, __m128 b, int round);

Compares the lower float32 elements in a and b, stores the maximum value in the lower destination element using zeromask k (the element is zeroed out when mask bit 0 is not set), and copies the upper element from a to the upper destination element.

### Note

Pass `__MM_FROUND_NO_EXC` to round to suppress all exceptions.

_mm512_min_pd

    extern __m512d __cdecl _mm512_min_pd(__m512d a, __m512d b);

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

_mm512_mask_min_pd

    extern __m512d __cdecl _mm512_mask_min_pd(__m512d src, __mmask8 k, __m512d a,__m512d b);

Compares packed float64 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_pd

    extern __m512d __cdecl _mm512_maskz_min_pd(__mmask8 k, __m512d a, __m512d b);

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

_mm512_min_round_pd

    extern __m512d __cdecl _mm512_min_round_pd(__m512d a, __m512d b, int round);

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

### Note

Pass `__MM_FROUND_NO_EXC` to round to suppress all exceptions.

_mm512_mask_min_round_pd

    extern __m512d __cdecl _mm512_mask_min_round_pd(__m512d src, __mmask8 k, __m512d a, __m512d b, int round);

Compares packed float64 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).

### Note

Pass `__MM_FROUND_NO_EXC` to round to suppress all exceptions.

_mm512_maskz_min_round_pd

    extern __m512d __cdecl _mm512_maskz_min_round_pd(__mmask8 k, __m512d a, __m512d b, int round);

Compares packed float64 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).

### Note

Pass `__MM_FROUND_NO_EXC` to round to suppress all exceptions.

_mm512_min_ps

    extern __m512 __cdecl _mm512_min_ps(__m512 a, __m512 b);

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

_mm512_mask_min_ps

    extern __m512 __cdecl _mm512_mask_min_ps(__m512 src, __mmask16 k, __m512 a, __m512 b);

Compares packed float32 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_ps

    extern __m512 __cdecl _mm512_maskz_min_ps(__mmask16 k, __m512 a, __m512 b;

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

_mm512_min_round_ps

    extern __m512 __cdecl _mm512_min_round_ps( __m512 a, __m512 b, int round);

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

### Note

Pass `__MM_FROUND_NO_EXC` to round to suppress all exceptions.

_mm512_mask_min_round_ps

    extern __m512 __cdecl _mm512_mask_min_round_ps(__m512 src, __mmask16 k, __m512 a, __m512 b, int round);

Compares packed float32 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).

### Note

Pass `__MM_FROUND_NO_EXC` to round to suppress all exceptions.

_mm512_maskz_min_round_ps

    extern __m512 __cdecl _mm512_maskz_min_round_ps(__mmask16 k, __m512 a, __m512 b, int round);

Compares packed float32 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).

### Note

Pass `__MM_FROUND_NO_EXC` to round to suppress all exceptions.

_mm_mask_min_sd

    extern __m128d __cdecl _mm_mask_min_sd(__m128d src, __mmask8 k, __m128d a, __m128d b);

Compares the lower float64 elements in a and b, stores the minimum value in the lower destination element using writemask k (the element is copied from src when mask bit 0 is not set), and copies the upper element from a to the upper destination element.

_mm_maskz_min_sd

    extern __m128d __cdecl _mm_maskz_min_sd(__mmask8 k, __m128d a, __m128d b);

Compares the lower float64 elements in a and b, stores the minimum value in the lower destination element using zeromask k (the element is zeroed out when mask bit 0 is not set), and copies the upper element from a to the upper destination element.

_mm_min_round_sd

    extern __m128d __cdecl _mm_min_round_sd(__m128d a, __m128d b, int round);

Compares the lower float64 elements in a and b, stores the minimum value in the lower destination element, and copies the upper element from a to the upper destination element.

### Note

Pass `__MM_FROUND_NO_EXC` to round to suppress all exceptions.

_mm_mask_min_round_sd

    extern __m128d __cdecl _mm_mask_min_round_sd(__m128d src, __mmask8 k, __m128d a, __m128d b, int round);

Compares the lower float64 elements in a and b, stores the minimum value in the lower destination element of using writemask k (the element is copied from src when mask bit 0 is not set), and copies the upper element from a to the upper destination element.

### Note

Pass `__MM_FROUND_NO_EXC` to round to suppress all exceptions.

_mm_maskz_min_round_sd

    extern __m128d __cdecl _mm_maskz_min_round_sd(__mmask8 k, __m128d a, __m128d b, int round);

Compares the lower float64 elements in a and b, stores the minimum value in the lower destination element using zeromask k (the element is zeroed out when mask bit 0 is not set), and copies the upper element from a to the upper destination element.

### Note

Pass `__MM_FROUND_NO_EXC` to round to suppress all exceptions.

_mm_mask_min_ss

    extern __m128 __cdecl _mm_mask_min_ss(__m128 src, __mmask8 k, __m128 a, __m128 b);

Compares the lower float32 elements in a and b, stores the minimum value in the lower destination element using writemask k (the element is copied from src when mask bit 0 is not set), and copies the upper element from a to the upper destination element.

_mm_maskz_min_ss

    extern __m128 __cdecl _mm_maskz_min_ss(__mmask8 k, __m128 a, __m128 b);

Compares the lower float32 elements in a and b, stores the minimum value in the lower destination element using zeromask k (the element is zeroed out when mask bit 0 is not set), and copies the upper element from a to the upper destination element.

_mm_min_round_ss

    extern __m128 __cdecl _mm_min_round_ss(__m128 a, __m128 b, int round);

Compares the lower float32 elements in a and b, stores the minimum value in the lower destination element, and copies the upper element from a to the upper destination element.

### Note

Pass `__MM_FROUND_NO_EXC` to round to suppress all exceptions.

_mm_mask_min_round_ss

    extern __m128 __cdecl _mm_mask_min_round_ss(__m128 src, __mmask8 k, __m128 a, __m128 b, int round);

Compares the lower float32 elements in a and b, stores the minimum value in the lower destination element using writemask k (the element is copied from src when mask bit 0 is not set), and copies the upper element from a to the upper destination element.

### Note

Pass `__MM_FROUND_NO_EXC` to round to suppress all exceptions.

_mm_maskz_min_round_ss

    extern __m128 __cdecl _mm_maskz_min_round_ss(__mmask8 k, __m128 a, __m128 b, int round);

Compares the lower float32 elements in a and b, stores the minimum value in the lower destination element using zeromask k (the element is zeroed out when mask bit 0 is not set), and copies the upper element from a to the upper destination element.

### Note

Pass `__MM_FROUND_NO_EXC` to round to suppress all exceptions.

Parent topic: Intrinsics for Determining Minimum and Maximum Values