Intel® C++ Compiler
Community support and assistance for creating C++ code that runs on platforms based on Intel® processors.
7873 Discussions

Can I use __mmask8 in intrinsic functions without AVX512DQ?

AFog0
Beginner
753 Views

Some AVX512F intrinsic functions use __mmask8 masks, but 8-bit mask instructions like KMOVB and KANDB require AVX512DQ. How can I make sure the compiler uses 16-bit mask instructions (KMOVW, KANDW) and not 8-bit mask instructions when I have AVX512F but not AVX512DQ? Is it safe to write __mmask8, or is this the way to do it?:

    __mmask16 a, b, c;
    __m512i x, y, z;
    ...
    a = b & c;  // use KANDW, not KANDB
    z = _mm512_mask_mov_epi64(x, (__mmask8)a, y);

I may write _mm512_kand or _kand_mask16 to hopefully make this explicit, but the KMOV is implicit anyway and I want to avoid that a compiler uses KMOV8 if I write __mmask8.

Note that I am writing generic code and I want the code to work with all compilers, both Intel, Microsoft, Gnu and Clang. But since Intel have defined the instruction set and the intrinsics, I suppose that this is the authoritative place to ask.

0 Kudos
0 Replies
Reply