Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compile error in: MSVC + #define __SSE4_1__ + 32bit_build #49

Open
wjssz opened this issue Dec 15, 2024 · 0 comments
Open

compile error in: MSVC + #define __SSE4_1__ + 32bit_build #49

wjssz opened this issue Dec 15, 2024 · 0 comments

Comments

@wjssz
Copy link

wjssz commented Dec 15, 2024

E:\dev\cpython\Modules\_blake2\impl\blake2b.c(31,23): error C2169: “_mm_set_epi64x”: intrinsic function, cannot be defined [E:\dev\cpython\PCbuild\
pythoncore.vcxproj]
E:\dev\cpython\Modules\_blake2\impl\blake2s.c(31,23): error C2169: “_mm_set_epi64x”: intrinsic function, cannot be defined [E:\dev\cpython\PCbuild\
pythoncore.vcxproj]

To fix, change in blake2b.c/blake2s.c:

 #if defined(HAVE_SSE2)
 #include <emmintrin.h>
 // MSVC only defines  _mm_set_epi64x for x86_64...
-#if defined(_MSC_VER) && !defined(_M_X64)
-static inline __m128i _mm_set_epi64x( const uint64_t u1, const uint64_t u0 )
+#if defined(_MSC_VER) && defined(_M_IX86)
+static inline __m128i b2_mm_set_epi64x( const uint64_t u1, const uint64_t u0 )
 {
-  return _mm_set_epi32( u1 >> 32, u1, u0 >> 32, u0 );
+  return _mm_set_epi32( u1 >> 32, ( uint32_t ) u1, u0 >> 32, ( uint32_t ) u0 );
 }
+#else
+#define b2_mm_set_epi64x _mm_set_epi64x
 #endif
 #endif

And change from _mm_set_epi64x to b2_mm_set_epi64x in blake2b-load-sse2.h.

_M_IX86 Defined as the integer literal value 600 for compilations that target x86 processors. This macro isn't defined for x64 or ARM compilation targets. (source)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant