On Tue, Oct 15, 2024 at 10:59 AM Pádraig Brady <p...@draigbrady.com> wrote: > > On 15/10/2024 12:58, Sam Russell wrote: > > I'm happy with the slice-by-8 code I have > > <https://github.com/samrussell/gnulib/blob/slice_by_8/lib/crc.c > > <https://github.com/samrussell/gnulib/blob/slice_by_8/lib/crc.c>> but the > > cksum_pclmul implementation is quite detailed so it would be useful if we > > could relicense that for gnulib. > > Sounds good re slice-by-8. > > Re pclmul in gnulib, I don't want to add stop energy, but it's worth > considering: > In general gnulib focuses on portable routines, so for example leaves > platform specific crypto optimizations to libcrypto, only providing fallback > cross platform implementations where needed. > In coreutils we needed to build the pclmul code as a separate library > so that with autotools it can be portably built with separate -mavx etc. > flags. > There are both build time and runtime guards around the pclmul code.
I believe the correct option is -mpclmul, not -mavx. If the source files are building with -mavx, then it is due to luck. Also see <https://gcc.gnu.org/onlinedocs/gcc/x86-Options.html>. Every now and again, I come across a weird combination of ISAs. I actually encountered a low-end cpu that included SSE4.1+AES, but lacked PCLMUL. It was on a cheap HP machine. I also encountered GCC on MacPorts that could build a source file with AES, but not PCLMUL. > BTW I tested pclmul as about twice as fast as slice-by-8 (on an i3-2310M). Jeff