Intel® C++ Compiler
Support and discussions for creating C++ code that runs on platforms based on Intel® processors.
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
7679 Discussions

Can I use __mmask8 in intrinsic functions without AVX512DQ?


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