- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
_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.
Link Copied
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
> 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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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,
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
As suggested by Viet, could you try with the ICX compiler and let us know if it helps?
Thanks,
Rahul
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Not sure if you are aware, but Intel C++ Classic Compiler will enter "Legacy Product Support" mode signaling the end of regular update.
Please see this article for details. https://www.intel.com/content/www/us/en/developer/articles/technical/adoption-of-llvm-complete-icx.h...
Here is a workaround:
#include <immintrin.h>
template <int P> __mmask8 cmp_epi16_mask(__m128i a, __m128i b)
{
return _mm_cmp_epi16_mask(a, b, P);
}
template <> __mmask8 cmp_epi16_mask<3>(__m128i a, __m128i b)
{
return 0;
}
template <> __mmask8 cmp_epi16_mask<7>(__m128i a, __m128i b)
{
return -1;
}
__mmask8 foo(__m128i a, __m128i b) {
return cmp_epi16_mask<4>(a, b);
}
__mmask8 f2(__m128i a, __m128i b) {
return cmp_epi16_mask<3>(a, b);
}
__mmask8 f3(__m128i a, __m128i b) {
return cmp_epi16_mask<7>(a, b);
}
Please let us know if we can close this case?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
We'll close this case as ICX works and workaround is provided. Please create a new thread if you have any other concerns/questions about Intel Compiler.
Thanks,

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page