build: Configuring with -mno-sse4.1 does not fail the sse4.1 instrinsics check #28864

issue dergoegge openend this issue on November 13, 2023
  1. dergoegge commented at 4:59 pm on November 13, 2023: member

    I would have expected that CXXFLAGS="-mno-sse4.1" ./configure would make the sse4.1 intrinsics check fail but it doesn’t:

    0configure:23377: checking for SSE4.1 intrinsics
    1configure:23396: clang++ -std=c++17 -c -msse4.1 -mno-sse4.1  conftest.cpp >&5
    2configure:23396: $? = 0
    3configure:23398: result: yes
    

    Not sure what is going on here, seems like a bug.

  2. dergoegge renamed this:
    build: Compiling with `-mno-sse4.1` does not fail the sse4.1 instrinsics check
    build: Configuring with `-mno-sse4.1` does not fail the sse4.1 instrinsics check
    on Nov 13, 2023
  3. fanquake commented at 3:52 pm on November 14, 2023: member

    Note that this ultimately results in compile failure, but because we try and compile the sha256_x86_shani.cpp code, but fail because it "needs isa option -msse4.1":

     0In file included from /usr/lib/gcc/x86_64-linux-gnu/13/include/immintrin.h:39,
     1                 from crypto/sha256_x86_shani.cpp:12:
     2In function 'void {anonymous}::Shuffle(__m128i&, __m128i&)',
     3    inlined from 'void sha256_x86_shani::Transform(uint32_t*, const unsigned char*, size_t)' at crypto/sha256_x86_shani.cpp:87:12:
     4crypto/sha256_x86_shani.cpp:57:10: error: '__builtin_ia32_pblendw128' needs isa option -msse4.1
     5   57 |     s1 = _mm_blend_epi16(t2, t1, 0xF0);
     6      |          ^~~~~~~~~~~~~~~
     7In function 'void {anonymous}::Unshuffle(__m128i&, __m128i&)',
     8    inlined from 'void sha256_x86_shani::Transform(uint32_t*, const unsigned char*, size_t)' at crypto/sha256_x86_shani.cpp:138:14:
     9crypto/sha256_x86_shani.cpp:64:10: error: '__builtin_ia32_pblendw128' needs isa option -msse4.1
    10   64 |     s0 = _mm_blend_epi16(t1, t2, 0xF0);
    11      |          ^~~~~~~~~~~~~~~
    12In function 'void {anonymous}::Unshuffle(__m128i&, __m128i&)',
    13    inlined from 'void sha256d64_x86_shani::Transform_2way(unsigned char*, const unsigned char*)' at crypto/sha256_x86_shani.cpp:270:14:
    14crypto/sha256_x86_shani.cpp:64:10: error: '__builtin_ia32_pblendw128' needs isa option -msse4.1
    15   64 |     s0 = _mm_blend_epi16(t1, t2, 0xF0);
    16      |          ^~~~~~~~~~~~~~~
    17In function 'void {anonymous}::Unshuffle(__m128i&, __m128i&)',
    18    inlined from 'void sha256d64_x86_shani::Transform_2way(unsigned char*, const unsigned char*)' at crypto/sha256_x86_shani.cpp:271:14:
    19crypto/sha256_x86_shani.cpp:64:10: error: '__builtin_ia32_pblendw128' needs isa option -msse4.1
    20   64 |     s0 = _mm_blend_epi16(t1, t2, 0xF0);
    21      |          ^~~~~~~~~~~~~~~
    22In function 'void {anonymous}::Unshuffle(__m128i&, __m128i&)',
    23    inlined from 'void sha256d64_x86_shani::Transform_2way(unsigned char*, const unsigned char*)' at crypto/sha256_x86_shani.cpp:348:14:
    24crypto/sha256_x86_shani.cpp:64:10: error: '__builtin_ia32_pblendw128' needs isa option -msse4.1
    25   64 |     s0 = _mm_blend_epi16(t1, t2, 0xF0);
    26      |          ^~~~~~~~~~~~~~~
    27In function 'void {anonymous}::Unshuffle(__m128i&, __m128i&)',
    28    inlined from 'void sha256d64_x86_shani::Transform_2way(unsigned char*, const unsigned char*)' at crypto/sha256_x86_shani.cpp:349:14:
    29crypto/sha256_x86_shani.cpp:64:10: error: '__builtin_ia32_pblendw128' needs isa option -msse4.1
    30   64 |     s0 = _mm_blend_epi16(t1, t2, 0xF0);
    31      |          ^~~~~~~~~~~~~~~
    32make[2]: *** [Makefile:14527: crypto/libbitcoin_crypto_x86_shani_la-sha256_x86_shani.lo] Error 1
    

    and also because we then try and compile the sse4.1 code anyways:

     0In file included from /usr/lib/gcc/x86_64-linux-gnu/13/include/immintrin.h:37,
     1                 from crypto/sha256_sse41.cpp:8:
     2/usr/lib/gcc/x86_64-linux-gnu/13/include/tmmintrin.h: In function '__m128i sha256d64_sse41::{anonymous}::Read4(const unsigned char*, int)':
     3/usr/lib/gcc/x86_64-linux-gnu/13/include/tmmintrin.h:136:1: error: inlining failed in call to 'always_inline' '__m128i _mm_shuffle_epi8(__m128i, __m128i)': target specific option mismatch
     4  136 | _mm_shuffle_epi8 (__m128i __X, __m128i __Y)
     5      | ^~~~~~~~~~~~~~~~
     6crypto/sha256_sse41.cpp:55:28: note: called from here
     7   55 |     return _mm_shuffle_epi8(ret, _mm_set_epi32(0x0C0D0E0FUL, 0x08090A0BUL, 0x04050607UL, 0x00010203UL));
     8      |            ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
     9/usr/lib/gcc/x86_64-linux-gnu/13/include/tmmintrin.h:136:1: error: inlining failed in call to 'always_inline' '__m128i _mm_shuffle_epi8(__m128i, __m128i)': target specific option mismatch
    10  136 | _mm_shuffle_epi8 (__m128i __X, __m128i __Y)
    11      | ^~~~~~~~~~~~~~~~
    12crypto/sha256_sse41.cpp:55:28: note: called from here
    13   55 |     return _mm_shuffle_epi8(ret, _mm_set_epi32(0x0C0D0E0FUL, 0x08090A0BUL, 0x04050607UL, 0x00010203UL));
    14      |            ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    15make[2]: *** [Makefile:14520: crypto/libbitcoin_crypto_sse41_la-sha256_sse41.lo] Error 1
    

    Both of these can / should be fixed up.

  4. hebasto commented at 12:06 pm on November 16, 2023: member
    FWIW, adding -O1 to the test makes it fail with CXXFLAGS="-mno-sse4.1".
  5. luke-jr commented at 1:13 am on December 5, 2023: member
    This is fixed by #13789 which was inexplicably closed for no reason
  6. maflcko commented at 7:49 am on December 5, 2023: member

    This is fixed by #13789 which was inexplicably closed for no reason

    It was closed due to #13758 (comment)

  7. willcl-ark added the label Build system on Jan 24, 2024
  8. willcl-ark added the label Bug on Jan 24, 2024
  9. fanquake closed this on Jul 17, 2024

  10. fanquake referenced this in commit 3679fa167f on Jul 17, 2024
  11. bitcoin locked this on Jul 18, 2025

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-08-22 18:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me