Skip to content

Compiling blake2 on x86 #94594

Closed
Closed
@gvanem

Description

@gvanem

Compiling either Modules/_blake2/impl/blake2b.c or Modules/_blake2/impl/blake2s.c for 32-bit using either MSVC-2022
or clang-cl ver 13.0.1 have issues with prototyping _mm_set_epi64x().

First the error from clang-cl:

Modules/_blake2/impl/blake2b.c(31,23): error: conflicting types for '_mm_set_epi64x'
static inline __m128i _mm_set_epi64x( const uint64_t u1, const uint64_t u0 )
                      ^
F:\gv\VC_2022\VC\Tools\Llvm\lib\clang\13.0.1\include\emmintrin.h(3609,1): note: previous definition is here
_mm_set_epi64x(long long __q1, long long __q0)
^

Then compiling with cl:

Modules/_blake2/impl/blake2b.c(32): error C2169: '_mm_set_epi64x': intrinsic function, cannot be defined

Since _mm_set_epi64x is already prototyped in <emmintrin.h> as:

extern __m128i _mm_set_epi64x (__int64 _I1, __int64 _I0);

The same issue exist when compiling Modules/_blake2/impl/blake2s.c.

The fix for me was simply to disable those redefinitions with:

--- a/Modules/_blake2/impl/blake2b.c 2021-05-19 09:59:27
+++ b/Modules/_blake2/impl/blake2b.c 2022-07-06 08:07:47
@@ -27,7 +27,7 @@
 #if defined(HAVE_SSE2)
 #include <emmintrin.h>
 // MSVC only defines  _mm_set_epi64x for x86_64...
-#if defined(_MSC_VER) && !defined(_M_X64)
+#if defined(_MSC_VER) && !defined(_M_X64) && 0
 static inline __m128i _mm_set_epi64x( const uint64_t u1, const uint64_t u0 )
 {
   return _mm_set_epi32( u1 >> 32, u1, u0 >> 32, u0 );

--- a/Modules/_blake2/impl/blake2s.c 2021-05-19 09:59:27
+++ b/Modules/_blake2/impl/blake2s.c 2022-07-06 08:07:42
@@ -27,7 +27,7 @@
 #if defined(HAVE_SSE2)
 #include <emmintrin.h>
 // MSVC only defines  _mm_set_epi64x for x86_64...
-#if defined(_MSC_VER) && !defined(_M_X64)
+#if defined(_MSC_VER) && !defined(_M_X64) && 0
 static inline __m128i _mm_set_epi64x( const uint64_t u1, const uint64_t u0 )
 {
   return _mm_set_epi32( u1 >> 32, u1, u0 >> 32, u0 );

So the comment in those files // MSVC only defines _mm_set_epi64x for x86_64... is no longer true it seems.

Metadata

Metadata

Assignees

No one assigned

    Labels

    OS-windowsbuildThe build process and cross-buildtype-bugAn unexpected behavior, bug, or error

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions