simde icon indicating copy to clipboard operation
simde copied to clipboard

simde/x86/avx512/permutex2var.h still fails to compile in C++ mode on Visual C++

Open johnplatts opened this issue 2 years ago • 0 comments

While the fix in simde/x86/avx512/permutex2var.h that was applied to commit https://github.com/simd-everywhere/simde/commit/88931164bdb8b628702079bfa177087a614cc975 does partially fix the issue with getting simde/x86/avx512/permutex2var.h to compile with Visual C++, I am still getting the following error when simde/x86/avx512/permutex2var.h is included in C++ mode in Visual C++: error C2440: 'reinterpret_cast': cannot convert from '__m256i' to '__m256i'

Removing HEDLEY_REINTERPRET_CAST will fix the issue with getting simde/x86/avx512/permutex2var.h to compile with Visual C++ in C++ mode.

Lines 706, 707, 1181, and 1182 should be fixed as follows:

#ifdef _MSC_VER
    lo = _mm256_blend_epi16(_mm256_slli_epi32(hilo2, 16), hilo, 0x55);
    hi = _mm256_blend_epi16(hilo2, _mm256_srli_epi32(hilo, 16), 0x55);
#else
    lo = HEDLEY_REINTERPRET_CAST(__m256i, _mm256_blend_epi16(_mm256_slli_epi32(hilo2, 16), hilo, 0x55));
    hi = HEDLEY_REINTERPRET_CAST(__m256i, _mm256_blend_epi16(hilo2, _mm256_srli_epi32(hilo, 16), 0x55));
#endif

Note that Visual C++ does not support casting between __m256i, __m256, and __m256d using a HEDLEY_REINTERPRET_CAST in C++ mode.

johnplatts avatar May 04 '22 19:05 johnplatts