# Intrinsics for Intel® Advanced Vector Extensions 512 (Intel® AVX-512) VPOPCNTDQ Instructions

The prototypes for Intel® Advanced Vector Extensions 512 (Intel® AVX-512) VPOPCNTDQ instruction intrinsics are located in the zmmintrin.h header file.

To use these intrinsics, include the immintrin.h file as follows:

    #include <immintrin.h>

_mm512_popcnt_epi32

    __mm512i _mm512_popcnt_epi32 (__m512i a)

variable | definition
--- | ---
a | a source vector

Instructions: vpopcntd zmm1, zmm2

Counts the number of bits set to one in each dword element of a and places it in the corresponding elements of the result.

_mm512_mask_popcnt_epi32

    __mm512i _mm512_mask_popcnt_epi32 (__m512 b, __mmask16 k, __m512i a)

variable | definition
--- | ---
a | a source vector
b | a second source vector
k | mask used as a selector

Instructions: vpopcntd zmm1 {k}, zmm2

Counts the number of bits set to one in each dword element of a using mask k and places it in the corresponding elements of the result. Elements are copied from b when the corresponding mask bit is not set.

_mm512_maskz_popcnt_epi32

    __mm512i _mm512_maskz_popcnt_epi32 (__mmask16 k, __m512i a)

variable | definition
--- | ---
a | a source vector
k | mask used as a selector

Instructions: vpopcntd zmm1 {k}, zmm2

Counts the number of bits set to one in each dword element of a using mask k and places it in the corresponding elements of the result. Elements are zeroed out when the corresponding mask bit is not set.

_mm512_popcnt_epi64

    __mm512i _mm512_popcnt_epi64 (__m512i a)

variable | definition
--- | ---
a | a source vector

Instructions: vpopcntd zmm1, zmm2

Counts the number of bits set to one in each quad word element of a and places it in the corresponding elements of the result.

_mm512_mask_popcnt_epi64

    __mm512i _mm512_mask_popcnt_epi64 (__m512 b, __mmask16 k, __m512i a)

variable | definition
--- | ---
a | a source vector
b | a second source vector
k | mask used as a selector

Instructions: vpopcntd zmm1 {k}, zmm2

Counts the number of bits set to one in each quad word element of a using mask k and places it in the corresponding elements of the result. Elements are copied from b when the corresponding mask bit is not set.

_mm512_maskz_popcnt_epi64

    __mm512i _mm512_maskz_popcnt_epi64 (__m512 b, __mmask16 k, __m512 a)

variable | definition
--- | ---
a | a source vector
b | a second source vector
k | mask used as a selector

Instructions: vpopcntd zmm2 {k}, zmm2

Counts the number of bits set to one in each quad word element of a using mask k and places it in the corresponding elements of the result. Elements are zeroed out when the corresponding mask bit is not set.

Parent topic: Intrinsics