[libgcrypt-1.7.0] SSE4.1 in crc-intel-pclmul.c

Jeremie Courreges-Anglas jca at wxcvbn.org
Mon May 9 04:22:14 CEST 2016


Hi,

compilation of crc-intel-pclmul.c from libgcrypt-1.7.0 fails on
OpenBSD/amd64:

$ ./configure && make
[...]
/bin/sh ../libtool  --tag=CC    --mode=compile gcc -DHAVE_CONFIG_H  -I. -I..  -I../src -I../src   -I/usr/local/include -g -O2 -fvisibility=hidden -Wall -MT crc-intel-pclmul.lo -MD -MP -MF .deps/crc-intel-pclmul.Tpo -c -o crc-intel-pclmul.lo crc-intel-pclmul.c
libtool: compile:  gcc -DHAVE_CONFIG_H -I. -I.. -I../src -I../src -I/usr/local/include -g -O2 -fvisibility=hidden -Wall -MT crc-intel-pclmul.lo -MD -MP -MF .deps/crc-intel-pclmul.Tpo -c crc-intel-pclmul.c  -fPIC -DPIC -o .libs/crc-intel-pclmul.o
/tmp//ccK05MkC.s: Assembler messages:
/tmp//ccK05MkC.s:113: Error: no such instruction: `pextrd $2,%xmm0,(%rdi)'
/tmp//ccK05MkC.s:130: Error: no such instruction: `pinsrd $1,-4(%rsi,%rcx),%xmm0'
/tmp//ccK05MkC.s:153: Error: no such instruction: `pextrd $2,%xmm0,(%rdi)'
/tmp//ccK05MkC.s:210: Error: no such instruction: `pextrd $1,%xmm0,(%rdi)'
/tmp//ccK05MkC.s:359: Error: no such instruction: `pextrd $1,%xmm0,(%rdi)'
/tmp//ccK05MkC.s:530: Error: no such instruction: `pinsrd $1,-4(%rsi,%rcx),%xmm0'
*** Error 1 in cipher (Makefile:643 'crc-intel-pclmul.lo')
*** Error 1 in . (Makefile:502 'all-recursive')
*** Error 1 in /tmp/libgcrypt-1.7.0 (Makefile:408 'all')

(This is after applying the diff from
http://git.gnupg.org/cgi-bin/gitweb.cgi?p=libgcrypt.git;a=commitdiff_plain;h=4545372c0f8dd35aef2a7abc12b588ed1a4a0363;hp=eecc081f8ae02c43454abaee4a4f72efaee42745)

The problem is that PCLMUL support is activated, since the OpenBSD
compiler supports it, but the asm also uses SSE4.1 instructions,
which the compiler doesn't support.

One possible way to fix this would be to implement autoconf tests for
the SSE4.1 instructions used above, and disable the PCLMUL CRC code if
appropriate.  Please find attached a patch for this, tested against gcc
from OpenBSD (pclmul/no sse4.1) and clang-3.7.1 (pclmul/sse4.1).


-------------- next part --------------
A non-text attachment was scrubbed...
Name: 0001-Check-for-compiler-SSE4.1-support-in-PCLMUL-CRC-code.patch
Type: text/x-patch
Size: 5357 bytes
Desc: not available
URL: </pipermail/attachments/20160509/d15f5758/attachment.bin>
-------------- next part --------------

-- 
jca | PGP : 0x1524E7EE / 5135 92C1 AD36 5293 2BDF  DDCC 0DFA 74AE 1524 E7EE


More information about the Gnupg-devel mailing list