Community
cancel
Showing results for 
Search instead for 
Did you mean: 
nemequ
New Contributor I
391 Views

_MM_CMPINT_FALSE and ..._TRUE missing, errors when values used

_MM_CMPINT_FALSE (= 3) and _MM_CMPINT_TRUE (= 7) are missing. ICC's zmmintrin.h defines an _MM_CMPINT_UNUSED as the third value in the _MM_CMPINT_ENUM enum, and the only 6 values are defined.

Furthermore, attempting to pass 3 or 7 to any (AFAICT) functions which accept a _MM_CMPINT_ENUM results in a "catastrophic error: Illegal value of immediate argument to intrinsic" error.  Here is a quick example (or on Compiler Explorer

#include <immintrin.h>

__mmask8 foo(__m128i a, __m128i b) {
  return _mm_cmp_epi16_mask(a, b, 3);
}

 The documentation in the Intrinsics Guide for _mm_cmp_epi16_mask (as well as all the other functions which take a _MM_CMPINT_ENUM) lists _MM_CMPINT_FALSE and _MM_CMPINT_TRUE as possible values, which map to 3 and 7 respectively.  Furthermore, they behave as expected in other compilers, with the result being a mask with all bits unset (for ..._FALSE) or set (for ..._TRUE), and the documentation in the Software Development Manual for the VPCMP* instructions (e.g., Volume 2C 5-325) confirm the mapping and that 3 and 7 are valid values for the instruction.

They may not be particularly useful, but the incompatibility with other compilers is rather annoying.

0 Kudos
6 Replies
RahulV_intel
Moderator
375 Views

Hi,


Thanks for reporting this issue. As rightly pointed out by you, the FALSE and TRUE values for 3 and 7 are missing in the "zmmintrin.h" header file (despite being present in the documentation) which is triggering the error.


Please note that I have escalated this issue to the concerned team, in order to get it fixed.



Thanks,

Rahul



nemequ
New Contributor I
356 Views

> Thanks for reporting this issue. As rightly pointed out by you, the FALSE and TRUE values for 3 and 7 are missing in the "zmmintrin.h" header file (despite being present in the documentation) which is triggering the error.

FWIW, I'm less concerned with the missing enum values than the fact that ICC emits an error when passing the numerical values (3 and 7).  The missing enum values are just a mismatch with the documentation which I really don't care about (it could even be considered a bug in the intrinsics guide not icc), but not being able to pass 3 or 7 there means I have to make significant changes to my code.

> Can you tell us how to compile with other compilers (e.g. gcc, any flags...)? 

Just enable required ISA extensions. For _mm_cmp_epi8_mask that would be AVX-512VL and AVX-512BW, so:

 

icc -mavx512vl -avx512bw -c -o test.o test.c
gcc -mavx512vl -avx512bw -c -o test.o test.c
clang -mavx512vl -avx512bw -c -o test.o test.c
pgcc -mavx512vl -mavx512bw -c -o test.o test.c

 

MSVC doesn't require any flags.

Here is a Compiler Explorer link where you can see the flags, and results, for gcc/clang/icc/msvc: https://godbolt.org/z/Kj13h8

 

Viet_H_Intel
Moderator
367 Views

I could see the "Illegal value of immediate argument to intrinsic" with icc.

Can you tell us how to compile with other compilers (e.g. gcc, any flags...)?

Thanks,



Viet_H_Intel
Moderator
352 Views

I'll report this to the compiler Developer. If you are using 19.1 compiler, then you can use icx instead.

$ icc -mavx512vl -mavx512bw -c -o t3.o t3.c

t3.c(4): (col. 10) catastrophic error: Illegal value of immediate argument to intrinsic

compilation aborted for t3.c (code 1)


$icx -mavx512vl -mavx512bw -c -o t3.o t3.c

$ icc -V

Intel(R) C Intel(R) 64 Compiler for applications running on Intel(R) 64, Version 19.1.2.254 Build 20200623

Copyright (C) 1985-2020 Intel Corporation. All rights reserved.



RahulV_intel
Moderator
83 Views

Hi,


As suggested by Viet, could you try with the ICX compiler and let us know if it helps?


Thanks,

Rahul


nemequ
New Contributor I
72 Views

It works, but it doesn't help.  I still need to support ICC, which means I still need a work-around in my code. I don't have control over which compiler people use to compile my code.

I didn't post because I was stuck and couldn't find a work-around, I posted so Intel could fix their compiler and nobody else would run into the issue and re-create a work-around.

Reply