# Intrinsics for Bitwise Logical 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_and_epi32`, `_mm512_mask_and_epi32``_mm512_maskz_and_epi32` | Computes the bitwise `AND` of packed int32 elements. | `VPANDD`
`_mm512_and_epi64`, `_mm512_mask_and_epi64`, `_mm512_maskz_and_epi64` | Computes the bitwise `AND` of packed int64 elements. | `VPANDQ`
`_mm512_or_epi32`, `_mm512_mask_or_epi32`, `_mm512_maskz_or_epi32` | Computes the bitwise `OR` of packed int32 elements. | `VPORD`
`_mm512_or_epi64`, `_mm512_mask_or_epi64`, `_mm512_maskz_or_epi64` | Computes the bitwise `OR` of packed int64 elements. | `VPORQ`
`_mm512_andnot_epi32`, `_mm512_mask_andnot_epi32`, `_mm512_maskz_andnot_epi32` | Computes the bitwise `AND NOT` of packed int32 elements. | `VPANDND`
`_mm512_andnot_epi64`, `_mm512_mask_andnot_epi64`, `_mm512_maskz_andnot_epi64` | Computes the bitwise `AND NOT` of packed int64 elements. | `VPANDNQ`
`_mm512_xor_epi32`, `_mm512_mask_xor_epi32`, `_mm512_maskz_xor_epi32` | Computes the bitwise `XOR` of packed int 32 elements. | `VPXORD`
`_mm512_xor_epi64`, `_mm512_mask_xor_epi64`, `_mm512_maskz_xor_epi64` | Computes the bitwise `XOR` of packed int64 elements. | `VPXORQ`

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_and_epi32

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

Computes the bitwise `AND` of packed 32-bit integers in a and b, and stores the result.

_mm512_mask_and_epi32

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

Computes the bitwise `AND` of packed 32-bit integers in a and b, and stores the result using zeromask k (elements are zeroed out when the corresponding mask bit is not set).

_mm512_maskz_and_epi32

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

Computes the bitwise `AND` of packed 32-bit integers in a and b, and stores the result using zeromask k (elements are zeroed out when the corresponding mask bit is not set).

_mm512_and_epi64

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

Computes the bitwise `AND` of 512 bits (composed of packed 64-bit integers) in a and b, and stores the result.

_mm512_mask_and_epi64

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

Computes the bitwise `AND` of packed 64-bit integers in 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_and_epi64

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

Computes the bitwise `AND` of packed 64-bit integers in a and b, and stores the result using zeromask k (elements are zeroed out when the corresponding mask bit is not set).

_mm512_andnot_epi32

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

Computes the bitwise `AND NOT` of packed 32-bit integers in a and b, and stores the result.

_mm512_mask_andnot_epi32

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

Computes the bitwise `AND NOT` of packed 32-bit integers in 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_andnot_epi32

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

Computes the bitwise `AND NOT` of packed 32-bit integers in a and b, and stores the result using zeromask k (elements are zeroed out when the corresponding mask bit is not set).

_mm512_andnot_epi64

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

Computes the bitwise `AND NOT` of 512 bits (composed of packed 64-bit integers) in a and b, and stores the result.

_mm512_mask_andnot_epi64

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

Computes the bitwise `AND NOT` of packed 64-bit integers in 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_andnot_epi64

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

Computes the bitwise `AND NOT` of packed 64-bit integers in a and b, and stores the result using zeromask k (elements are zeroed out when the corresponding mask bit is not set).

_mm512_or_epi32

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

Computes the bitwise `OR` of packed 32-bit integers in a and b, and stores the result.

_mm512_mask_or_epi32

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

Computes the bitwise `OR` of packed 32-bit integers in 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_or_epi32

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

Computes the bitwise `OR` of packed 32-bit integers in a and b, and stores the result using zeromask k (elements are zeroed out when the corresponding mask bit is not set).

_mm512_or_epi64

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

Computes the bitwise `OR` of packed 64-bit integers in a and b, and store the result.

_mm512_mask_or_epi64

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

Computes the bitwise `OR` of packed 64-bit integers in 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_or_epi64

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

Computes the bitwise `OR` of packed 64-bit integers in a and b, and stores the result using zeromask k (elements are zeroed out when the corresponding mask bit is not set).

_mm512_xor_epi32

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

Computes the bitwise `XOR` of packed 32-bit integers in a and b, and stores the result.

_mm512_mask_xor_epi32

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

Computes the bitwise `XOR` of packed 32-bit integers in 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_xor_epi32

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

Computes the bitwise `XOR` of packed 32-bit integers in a and b, and stores the result using zeromask k (elements are zeroed out when the corresponding mask bit is not set).

_mm512_xor_epi64

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

Computes the bitwise `XOR` of packed 64-bit integers in a and b, and stores the result.

_mm512_mask_xor_epi64

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

Computes the bitwise `XOR` of packed 64-bit integers in 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_xor_epi64

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

Computes the bitwise `XOR` of packed 64-bit integers in 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 Bit Manipulation Operations