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

issue dergoegge opened 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:

    configure:23377: checking for SSE4.1 intrinsics
    configure:23396: clang++ -std=c++17 -c -msse4.1 -mno-sse4.1  conftest.cpp >&5
    configure:23396: $? = 0
    configure: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":

    In file included from /usr/lib/gcc/x86_64-linux-gnu/13/include/immintrin.h:39,
                     from crypto/sha256_x86_shani.cpp:12:
    In function 'void {anonymous}::Shuffle(__m128i&, __m128i&)',
        inlined from 'void sha256_x86_shani::Transform(uint32_t*, const unsigned char*, size_t)' at crypto/sha256_x86_shani.cpp:87:12:
    crypto/sha256_x86_shani.cpp:57:10: error: '__builtin_ia32_pblendw128' needs isa option -msse4.1
       57 |     s1 = _mm_blend_epi16(t2, t1, 0xF0);
          |          ^~~~~~~~~~~~~~~
    In function 'void {anonymous}::Unshuffle(__m128i&, __m128i&)',
        inlined from 'void sha256_x86_shani::Transform(uint32_t*, const unsigned char*, size_t)' at crypto/sha256_x86_shani.cpp:138:14:
    crypto/sha256_x86_shani.cpp:64:10: error: '__builtin_ia32_pblendw128' needs isa option -msse4.1
       64 |     s0 = _mm_blend_epi16(t1, t2, 0xF0);
          |          ^~~~~~~~~~~~~~~
    In function 'void {anonymous}::Unshuffle(__m128i&, __m128i&)',
        inlined from 'void sha256d64_x86_shani::Transform_2way(unsigned char*, const unsigned char*)' at crypto/sha256_x86_shani.cpp:270:14:
    crypto/sha256_x86_shani.cpp:64:10: error: '__builtin_ia32_pblendw128' needs isa option -msse4.1
       64 |     s0 = _mm_blend_epi16(t1, t2, 0xF0);
          |          ^~~~~~~~~~~~~~~
    In function 'void {anonymous}::Unshuffle(__m128i&, __m128i&)',
        inlined from 'void sha256d64_x86_shani::Transform_2way(unsigned char*, const unsigned char*)' at crypto/sha256_x86_shani.cpp:271:14:
    crypto/sha256_x86_shani.cpp:64:10: error: '__builtin_ia32_pblendw128' needs isa option -msse4.1
       64 |     s0 = _mm_blend_epi16(t1, t2, 0xF0);
          |          ^~~~~~~~~~~~~~~
    In function 'void {anonymous}::Unshuffle(__m128i&, __m128i&)',
        inlined from 'void sha256d64_x86_shani::Transform_2way(unsigned char*, const unsigned char*)' at crypto/sha256_x86_shani.cpp:348:14:
    crypto/sha256_x86_shani.cpp:64:10: error: '__builtin_ia32_pblendw128' needs isa option -msse4.1
       64 |     s0 = _mm_blend_epi16(t1, t2, 0xF0);
          |          ^~~~~~~~~~~~~~~
    In function 'void {anonymous}::Unshuffle(__m128i&, __m128i&)',
        inlined from 'void sha256d64_x86_shani::Transform_2way(unsigned char*, const unsigned char*)' at crypto/sha256_x86_shani.cpp:349:14:
    crypto/sha256_x86_shani.cpp:64:10: error: '__builtin_ia32_pblendw128' needs isa option -msse4.1
       64 |     s0 = _mm_blend_epi16(t1, t2, 0xF0);
          |          ^~~~~~~~~~~~~~~
    make[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:

    In file included from /usr/lib/gcc/x86_64-linux-gnu/13/include/immintrin.h:37,
                     from crypto/sha256_sse41.cpp:8:
    /usr/lib/gcc/x86_64-linux-gnu/13/include/tmmintrin.h: In function '__m128i sha256d64_sse41::{anonymous}::Read4(const unsigned char*, int)':
    /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
      136 | _mm_shuffle_epi8 (__m128i __X, __m128i __Y)
          | ^~~~~~~~~~~~~~~~
    crypto/sha256_sse41.cpp:55:28: note: called from here
       55 |     return _mm_shuffle_epi8(ret, _mm_set_epi32(0x0C0D0E0FUL, 0x08090A0BUL, 0x04050607UL, 0x00010203UL));
          |            ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /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
      136 | _mm_shuffle_epi8 (__m128i __X, __m128i __Y)
          | ^~~~~~~~~~~~~~~~
    crypto/sha256_sse41.cpp:55:28: note: called from here
       55 |     return _mm_shuffle_epi8(ret, _mm_set_epi32(0x0C0D0E0FUL, 0x08090A0BUL, 0x04050607UL, 0x00010203UL));
          |            ~~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    make[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: 2026-05-03 15:13 UTC

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