Intel® C++ Compiler Classic Developer Guide and Reference

ID 767249
Date 3/31/2023
Public

A newer version of this document is available. Customers should click here to go to the newest version.

Document Table of Contents

Intrinsics for Vector Mask 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_kand

Bitwise logical AND masks.

KANDW

_mm512_kandn

Bitwise logical AND NOT masks.

KANDNW

_mm512_kmov

Move to and from mask registers.

KMOVW

_mm512_kunpackb

Unpack mask registers.

KUNPCKBW

_mm512_knot

Bitwise logical NOT masks.

KNOTW

_mm512_kor

Bitwise logical OR masks.

KORW

_mm512_kortestc

_mm512_kortestz

Bitwise logical OR mask and set flag.

KORTESTW

_mm512_kxnor

Bitwise logical XNOR masks.

KXNORW

_mm512_kxor

Bitwise logical XOR masks.

KXORW


variable definition
k

writemask used as a selector

a

first source vector element

b

second source vector element


_mm512_kand

extern __mmask16 __cdecl _mm512_kand(__mmask16 a, __mmask16 b);

Computes the bitwise AND of 16-bit masks a and b, and stores the result in k.



_mm512_kandn

extern __mmask16 __cdecl _mm512_kandn(__mmask16 a, __mmask16 b);

Computes the bitwise AND NOT of 16-bit masks a and b, and stores the result in k.



_mm512_knot

extern __mmask16 __cdecl _mm512_knot(__mmask16 a);

Computes the bitwise NOT of 16-bit mask a, and stores the result in k.



_mm512_kor

extern __mmask16 __cdecl _mm512_kor(__mmask16 a, __mmask16 b);

Computes the bitwise OR of 16-bit masks a and b, and stores the result in k.



_mm512_kxnor

extern __mmask16 __cdecl _mm512_kxnor(__mmask16 a, __mmask16 b);

Computes the bitwise XNOR of 16-bit masks a and b, and stores the result in k.



_mm512_kxor

extern __mmask16 __cdecl _mm512_kxor(__mmask16 a, __mmask16 b);

Computes the bitwise XOR of 16-bit masks a and b, and stores the result in k.



_mm512_kmov

extern __mmask16 __cdecl _mm512_kmov(__mmask16 a);

Copies 16-bit mask a to k.



_mm512_kunpackb

extern __mmask16 __cdecl _mm512_kunpackb(__mmask16 a, __mmask16 b);

Unpacks and interleaves eight bits from 16-bit masks a and b, and stores the 16-bit result in mask register.