Subject: bug#63079: closed (Re: bug#63079: coreutils-9.3: build failure with -mno-ssse3)

From: [email-masked] (GNU bug Tracking System)
Date: Wed, 26 Apr 2023 15:24:02 +0000

Your bug report

#63079: coreutils-9.3: build failure with -mno-ssse3

which was filed against the coreutils package, has been closed.

The explanation is attached below, along with your original report.
If you require more details, please reply to [email-masked].

-- 
63079: https://debbugs.gnu.org/cgi/bugreport.cgi?bug=63079
GNU Bug Tracking System
Contact [email-masked] with problems

Subject: Re: bug#63079: coreutils-9.3: build failure with -mno-ssse3
From: Pádraig Brady <[email-masked]>
To: Jaroslav Skarvada <[email-masked]>, [email-masked]
Date: Wed, 26 Apr 2023 16:23:21 +0100
List-Id: <debbugs-submit.debbugs.gnu.org>

On 26/04/2023 00:22, Jaroslav Skarvada wrote:
> Hi,
> 
> building with the -mno-ssse3 causes build failure, e.g.:
> CFLAGS="-O2 -march=bonnell -mtune=bonnell -mno-ssse3"
> ...
> gcc  -I. -I./lib  -Ilib -I./lib -Isrc -I./src  -mavx -mpclmul   -O2
> -march=bonnell -mtune=bonnell -mno-ssse3 -c -o
> src/libcksum_pclmul_a-cksum_pclmul.o `test -f 'src/cksum_pclmul.c' ||
> echo './'`src/cksum_pclmul.c
> In file included from /usr/lib/gcc/i686-pc-linux-gnu/12/include/immintrin.h:37,
>                   from /usr/lib/gcc/i686-pc-linux-gnu/12/include/x86intrin.h:32,
>                   from src/cksum_pclmul.c:22:
> /usr/lib/gcc/i686-pc-linux-gnu/12/include/tmmintrin.h: In function
> 'cksum_pclmul':
> /usr/lib/gcc/i686-pc-linux-gnu/12/include/tmmintrin.h:136:1: error:
> inlining failed in call to 'always_inline' '_mm_shuffle_epi8': target
> specific option mismatch
>    136 | _mm_shuffle_epi8 (__m128i __X, __m128i __Y)
>        | ^~~~~~~~~~~~~~~~
> src/cksum_pclmul.c:103:19: note: called from here
>    103 |           data7 = _mm_shuffle_epi8 (data7, shuffle_constant);
>        |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> /usr/lib/gcc/i686-pc-linux-gnu/12/include/tmmintrin.h:136:1: error:
> inlining failed in call to 'always_inline' '_mm_shuffle_epi8': target
> specific option mismatch
> 
> The problem is in the pclmul optimization. The configure.ac autodetect
> script checks for the pclmul, but not for the ssse3 instructions which
> are later utilized in the pclmul optimized code. Unfortunately, it
> also seems there is no way to override the configure.ac check result
> (e.g. by the ./configure --without-pclmul option). The attached patch
> added the ssse3 detection and fixed the problem for me. Maybe it would
> be better to split it into two checks - pclmul and ssse3, but I didn't
> want to complicate it. The patch was initially created for
> coreutils-9.1 where the problem initially manifested, but it also
> applies to coreutils-9.3 which is also affected

Pushed.

Marking this as done.

thanks!
Pádraig

Subject: coreutils-9.3: build failure with -mno-ssse3
From: Jaroslav Skarvada <[email-masked]>
To: [email-masked]
Date: Wed, 26 Apr 2023 01:22:05 +0200
List-Id: <debbugs-submit.debbugs.gnu.org>

Hi,

building with the -mno-ssse3 causes build failure, e.g.:
CFLAGS="-O2 -march=bonnell -mtune=bonnell -mno-ssse3"
...
gcc  -I. -I./lib  -Ilib -I./lib -Isrc -I./src  -mavx -mpclmul   -O2
-march=bonnell -mtune=bonnell -mno-ssse3 -c -o
src/libcksum_pclmul_a-cksum_pclmul.o `test -f 'src/cksum_pclmul.c' ||
echo './'`src/cksum_pclmul.c
In file included from /usr/lib/gcc/i686-pc-linux-gnu/12/include/immintrin.h:37,
                 from /usr/lib/gcc/i686-pc-linux-gnu/12/include/x86intrin.h:32,
                 from src/cksum_pclmul.c:22:
/usr/lib/gcc/i686-pc-linux-gnu/12/include/tmmintrin.h: In function
'cksum_pclmul':
/usr/lib/gcc/i686-pc-linux-gnu/12/include/tmmintrin.h:136:1: error:
inlining failed in call to 'always_inline' '_mm_shuffle_epi8': target
specific option mismatch
  136 | _mm_shuffle_epi8 (__m128i __X, __m128i __Y)
      | ^~~~~~~~~~~~~~~~
src/cksum_pclmul.c:103:19: note: called from here
  103 |           data7 = _mm_shuffle_epi8 (data7, shuffle_constant);
      |                   ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/lib/gcc/i686-pc-linux-gnu/12/include/tmmintrin.h:136:1: error:
inlining failed in call to 'always_inline' '_mm_shuffle_epi8': target
specific option mismatch

The problem is in the pclmul optimization. The configure.ac autodetect
script checks for the pclmul, but not for the ssse3 instructions which
are later utilized in the pclmul optimized code. Unfortunately, it
also seems there is no way to override the configure.ac check result
(e.g. by the ./configure --without-pclmul option). The attached patch
added the ssse3 detection and fixed the problem for me. Maybe it would
be better to split it into two checks - pclmul and ssse3, but I didn't
want to complicate it. The patch was initially created for
coreutils-9.1 where the problem initially manifested, but it also
applies to coreutils-9.3 which is also affected

thanks & regards

Jaroslav
--- ./configure.ac.old	2023-04-26 00:42:37.840034913 +0200
+++ ./configure.ac	2023-04-26 00:43:13.828730731 +0200
@@ -577,6 +577,7 @@
     {
       __m128i a, b;
       a = _mm_clmulepi64_si128 (a, b, 0x00);
+      a = _mm_shuffle_epi8 (a, b);
       return 1;
     }
   ]])