# Intrinsics for Scale 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_scalef_pd`, `_mm512_mask_scalef_pd`, `_mm512_maskz_scalef_pd` `_mm512_scalef_round_pd`, `_mm512_mask_scalef_round_pd`, `_mm512_maskz_scalef_round_pd` | Scale packed float64 values with float64 values. | `VSCALEFPD`
`_mm512_scalef_ps`, `_mm512_mask_scalef_ps`, `_mm512_maskz_scalef_ps` `_mm512_scalef_round_ps`, `_mm512_mask_scalef_round_ps`, `_mm512_maskz_scalef_round_ps` | Scale packed float32 values with float32 values. | `VSCALEFSD`
`_mm_scalef_sd`, `_mm_mask_scalef_sd`, `_mm_maskz_scalef_sd` `_mm_scalef_round_sd`, `_mm_mask_scalef_round_sd`, `_mm_maskz_scalef_round_sd` | Scale scalar float64 values with float64 values. | `VSCALEFPS`
`_mm_scalef_round_ss`, `_mm_mask_scalef_round_ss`, `_mm_maskz_scalef_round_ss` `_mm_scalef_ss`, `_mm_mask_scalef_ss`, `_mm_maskz_scalef_ss` | Scale scalar float32 values with float32 values. | `VSCALEFSS`
`_mm512_roundscale_pd`, `_mm512_mask_roundscale_pd`, `_mm512_maskz_roundscale_pd` | Scale packed float64 values with float64 values. | `VRNDSCALEPD`
`_mm512_roundscale_ps`, `_mm512_mask_roundscale_ps`, `_mm512_maskz_roundscale_ps` | Scale packed float32 values with float32 values. | `VRNDSCALEPS`
`_mm_roundscale_sd`, `_mm_mask_roundscale_sd`, `_mm_maskz_roundscale_sd` `_mm_roundscale_round_sd`, `_mm_mask_roundscale_round_sd`, `_mm_maskz_roundscale_round_sd` | Scale scalar float64 values with float64 values. | `VRNDSCALESD`
`_mm_roundscale_ss`, `_mm_mask_roundscale_ss`, `_mm_maskz_roundscale_ss` `_mm_roundscale_round_ss`, `_mm_mask_roundscale_round_ss`, `_mm_maskz_roundscale_round_ss` | Scale scalar float32 values with float32 values. | `VRNDSCALE`

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
imm | 8-bit immediate integer specifies offset for destination

_mm512_roundscale_pd

    extern __m512d __cdecl _mm512_roundscale_pd(__m512d a, int imm);

Performs a floating point scale of packed float64 elements in a to the number of fraction bits specified by imm, and stores the result.

_mm512_mask_roundscale_pd

    extern __m512d __cdecl _mm512_mask_roundscale_pd(__m512d src, __mmask8 k, __m512d a, int imm);

Performs a floating point scale of packed float64 elements in a to the number of fraction bits specified by imm, and stores the result using writemask k (elements are copied from src when the corresponding mask bit is not set).

_mm512_maskz_roundscale_pd

    extern __m512d __cdecl _mm512_maskz_roundscale_pd(__mmask8 k, __m512d a, int imm);

Performs a floating point scale of packed float64 elements in a to the number of fraction bits specified by imm, and stores the result using zeromask k (elements are zeroed out when the corresponding mask bit is not set).

_mm512_roundscale_ps

    extern __m512 __cdecl _mm512_roundscale_ps(__m512 a, int imm);

Performs a floating point scale of packed float32 elements in a to the number of fraction bits specified by imm, and stores the result.

_mm512_mask_roundscale_ps

    extern __m512 __cdecl _mm512_mask_roundscale_ps(__m512 src, __mmask16 k, __m512 a, int imm);

Performs a floating point scale of packed float32 elements in a to the number of fraction bits specified by imm, and stores the result using writemask k (elements are copied from src when the corresponding mask bit is not set).

_mm512_maskz_roundscale_ps

    extern __m512 __cdecl _mm512_maskz_roundscale_ps(__mmask16 k, __m512 a, int imm);

Performs a floating point scale of packed float32 elements in a to the number of fraction bits specified by imm, and stores the result using zeromask k (elements are zeroed out when the corresponding mask bit is not set).

_mm_roundscale_round_sd

    extern __m128d __cdecl _mm_roundscale_round_sd(__m128d a, __m128d b, const int imm, const int round);

Rounds the lower float64 element in a to the number of fraction bits specified by imm, stores the result in the lower destination element, and copies the upper element from b to the upper destination element.

_mm_mask_roundscale_round_sd

    extern __m128d __cdecl _mm_mask_roundscale_round_sd(__m128d src, __mmask8 k, __m128d a, __m128d b, const int imm, const int round);

Rounds the lower float64 element in a to the number of fraction bits specified by imm, stores the result 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 b to the upper destination element.

_mm_maskz_roundscale_round_sd

    extern __m128d __cdecl _mm_maskz_roundscale_round_sd(__mmask8 k, __m128d a, __m128d b, const int imm, const int round);

Rounds the lower float64 element in a to the number of fraction bits specified by imm, stores the result 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 b to the upper destination element.

_mm_roundscale_sd

    extern __m128d __cdecl _mm_roundscale_sd(__m128d a, __m128d b, const int imm);

Rounds the lower float64 element in a to the number of fraction bits specified by imm, stores the result in the lower destination element, and copies the upper element from b to the upper destination element.

_mm_mask_roundscale_sd

    extern __m128d __cdecl _mm_mask_roundscale_sd(__m128d old, __mmask8 k, __m128d a, __m128d b, const int imm);

Rounds the lower float64 element in a to the number of fraction bits specified by imm, stores the result 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 b to the upper destination element.

_mm_maskz_roundscale_sd

    extern __m128d __cdecl _mm_maskz_roundscale_sd(__mmask8 k, __m128d a, __m128d b, const int imm);

Rounds the lower float64 element in a to the number of fraction bits specified by imm, stores the result 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 b to the upper destination element.

_mm_roundscale_round_ss

    extern __m128 __cdecl _mm_roundscale_round_ss(__m128 a, __m128 b, const int imm, const int round);

Rounds the lower float32 element in a to the number of fraction bits specified by imm, stores the result in the lower destination element, and copies the upper three packed elements from b to the upper destination elements.

_mm_mask_roundscale_round_ss

    extern __m128 __cdecl _mm_mask_roundscale_round_ss(__m128 src, __mmask8 k, __m128 a, __m128 b, const int imm, const int round);

Rounds the lower float32 element in a to the number of fraction bits specified by imm, stores the result 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 three packed elements from b to the upper destination elements.

_mm_maskz_roundscale_round_ss

    extern __m128 __cdecl _mm_maskz_roundscale_round_ss(__mmask8 k, __m128 a, __m128 b, const int imm, const int round);

Rounds the lower float32 element in a to the number of fraction bits specified by imm, stores the result in the lower destination element using zeromask k (the element is zeroed out when mask bit 0 is not set), and copies the upper three packed elements from b to the upper destination elements.

_mm_roundscale_ss

    extern __m128 __cdecl _mm_roundscale_ss(__m128 a, __m128 b, const int imm);

Rounds the lower float32 element in a to the number of fraction bits specified by imm, stores the result in the lower destination element, and copies the upper three packed elements from b to the upper destination elements.

_mm_mask_roundscale_ss

    extern __m128 __cdecl _mm_mask_roundscale_ss(__m128 src, __mmask8 k, __m128 a, __m128 b, const int imm);

Rounds the lower float32 element in a to the number of fraction bits specified by imm, stores the result 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 three packed elements from b to the upper destination elements.

_mm_maskz_roundscale_ss

    extern __m128 __cdecl _mm_maskz_roundscale_ss(__mmask8 k, __m128 a, __m128 b, const int imm);

Rounds the lower float32 element in a to the number of fraction bits specified by imm, stores the result in the lower destination element using zeromask k (the element is zeroed out when mask bit 0 is not set), and copies the upper three packed elements from b to the upper destination elements.

_mm512_scalef_pd

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

Performs a floating point scale of the packed float64 elements in source a by multiplying by 2b, and stores the result.

_mm512_mask_scalef_pd

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

Performs a floating point scale of the packed float64 elements in source a by multiplying by 2b, and stores the result using writemask k (elements are copied from src when the corresponding mask bit is not set).

_mm512_maskz_scalef_pd

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

Performs a floating point scale of the packed float64 elements in source a by multiplying by 2b, and stores the result using zeromask k (elements are zeroed out when the corresponding mask bit is not set).

_mm512_scalef_round_pd

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

Performs a floating point scale of the rounded packed float64 elements in source a by multiplying by 2b, and stores the result.

_mm512_mask_scalef_round_pd

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

Performs a floating point scale of the rounded packed float64 elements in source a by multiplying by 2b, and stores the result using writemask k (elements are copied from src when the corresponding mask bit is not set).

_mm512_maskz_scalef_round_pd

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

Performs a floating point scale of the rounded packed float64 elements in source a by multiplying by 2b, and stores the result using zeromask k (elements are zeroed out when the corresponding mask bit is not set).

_mm512_scalef_ps

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

Performs a floating point scale of the packed float32 elements in source a by multiplying by 2b, and stores the result.

_mm512_mask_scalef_ps

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

Performs a floating point scale of the packed float32 elements in source a by multiplying by 2b, and stores the result, using writemask k (elements are copied from src when the corresponding mask bit is not set).

_mm512_maskz_scalef_ps

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

Performs a floating point scale of the packed single-precision (64-bit) floating-point elements in source a by multiplying by 2b, and stores the result, using zeromask k (elements are zeroed out when the corresponding mask bit is not set).

_mm512_scalef_round_ps

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

Performs a floating point scale of the rounded packed single-precision (64-bit) floating-point elements in source a by multiplying by 2b, and stores the results.

_mm512_mask_scalef_round_ps

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

Performs a floating point scale of the rounded packed single-precision (64-bit) floating-point elements in source a by multiplying by 2b, and stores the results, using writemask k (elements are copied from src when the corresponding mask bit is not set).

_mm512_maskz_scalef_round_ps

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

Performs a floating point scale of the rounded packed single-precision (64-bit) floating-point elements in source a by multiplying by 2b, and stores the results, using zeromask k (elements are zeroed out when the corresponding mask bit is not set).

_mm_scalef_round_sd

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

Performs a floating point scale of the rounded scalar float64 elements in source a by multiplying by 2b, stores the result in the lower destination element, and copies the upper element from b to the upper destination element.

_mm_mask_scalef_round_sd

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

Performs a floating point scale of the rounded scalar float64 elements in source a by multiplying by 2b, stores the result 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 b to the upper destination element.

_mm_maskz_scalef_round_sd

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

Performs a floating point scale of the rounded scalar float64 elements in source a by multiplying by 2b, stores the result 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 b to the upper destination element.

_mm_scalef_sd

    extern __m128d __cdecl _mm_scalef_sd(__m128d a, __m128d b);

Performs a floating point scale of the scalar float64 elements in source a using values from b, stores the result in the lower destination element, and copies the upper element from b to the upper destination element.

_mm_mask_scalef_sd

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

Performs a floating point scale of the scalar float64 elements in source a using values from b, stores the result 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 b to the upper destination element.

_mm_maskz_scalef_sd

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

Performs a floating point scale of the scalar float64 elements in source a using values from b, stores the result 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 b to the upper destination element.

_mm_scalef_round_ss

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

Performs a floating point scale of the rounded scalar float32 elements in source a by multiplying by 2b, stores the result in the lower destination element, and copies the upper element from b to the upper destination elements.

_mm_mask_scalef_round_ss

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

Performs a floating point scale of the rounded scalar float32 elements in source a by multiplying by 2b, stores the result 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 three packed elements from b to the upper destination elements.

_mm_maskz_scalef_round_ss

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

Performs a floating point scale of the rounded scalar float32 elements in source a by multiplying by 2b, stores the result in the lower destination element using zeromask k (the element is zeroed out when mask bit 0 is not set), and copies the upper three packed elements from b to the upper destination elements.

_mm_scalef_ss

    extern __m128 __cdecl _mm_scalef_ss(__m128 a, __m128 b);

Performs a floating point scale of the scalar float32 elements in source a using values from b, stores the result in the lower destination element, and copies the upper three packed elements from b to the upper destination elements.

_mm_mask_scalef_ss

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

Performs a floating point scale of the scalar float32 elements in source a using values from b, stores the result 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 three packed elements from b to the upper destination elements.

_mm_maskz_scalef_ss

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

Performs a floating point scale of the scalar float32 elements in source a using values from b, stores the result in the lower destination element, using zeromask k (the element is zeroed out when mask bit 0 is not set), and copies the upper three packed elements from b to the upper destination elements.

Parent topic: Intrinsics for Other Mathematics Operations