- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Compiler: Intel(R) oneAPI DPC++/C++ Compiler 2025.0.0 (2025.0.0.20241008)
OS: Windows (via Visual Studio 17.11.5)
The following code is incorrectly compiled:
#include <stdint.h>
#include <immintrin.h>
#include <iostream>
using namespace std;
#define NO_INLINE __declspec(noinline)
NO_INLINE void print(__m512i x){
const uint64_t* ptr = (const uint64_t*)&x;
for (size_t c = 0; c < 8; c++){
cout << ptr[c] << endl;
}
}
NO_INLINE void test(void* R){
const char* ptr = (const char*)R;
__m512i r0, r1, r2;
r0 = _mm512_castsi256_si512(_mm256_loadu_si256((const __m256i*)(ptr + 32)));
r0 = _mm512_inserti64x4(r0, _mm256_loadu_si256((const __m256i*)(ptr + 224)), 1);
r1 = _mm512_castsi256_si512(_mm256_loadu_si256((const __m256i*)(ptr + 128)));
r1 = _mm512_inserti64x4(r1, _mm256_loadu_si256((const __m256i*)(ptr + 320)), 1);
r2 = _mm512_mask_permutex_epi64(r1, 0x33, r0, 78);
print(r2);
}
int main(){
uint64_t R[48];
for (size_t c = 0; c < 48; c++){
R[c] = c;
}
test(R);
}
Compiler Flags:
/GS /W3 /Gy /Zc:wchar_t /Zi /O2 /D "NDEBUG" /D "_CONSOLE" /D "__INTEL_LLVM_COMPILER=20250000" /D "_UNICODE" /D "UNICODE" /Qipo /Zc:forScope /Oi /MD /Fa"x64\ICX2025\" /EHsc /nologo /Fo"x64\ICX2025\" /Fp"x64\ICX2025\ICX2025 Miscompile.pch" /Qxcannonlake
Expected Output: (MSVC, ICC, and ICX with optimizations disabled all produce this output)
6
7
18
19
30
31
42
43
Actual Output: (ICX2025 with the above flags)
18
19
6
7
42
43
30
31
Looking at the assembly, I suspect the compiler is trying to optimize away the mask in the `_mm512_mask_permutex_epi64` intrinsic by folding it into a `vpermi2q` instruction, but it's doing it incorrectly and is swapping the order of the operands.
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thanks for reporting this bug with the latest 2025.0 compiler. This will be further investigated and escalated to development team.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page