From c8bb7afcfb779f6bf582710babb08a07f0418278 Mon Sep 17 00:00:00 2001 From: =?utf8?q?P=C3=A1draig=20Brady?= Date: Wed, 18 Dec 2024 12:39:47 +0000 Subject: [PATCH] cksum: update to pclmul optimized crc32b from gnulib * bootstrap.conf: Depend on crc-x86_64 rather than crc. * gnulib: Update to latest. * src/cksum.c (crc32b_sum_stream): Add --debug info. * NEWS: Mention the performance improvement. --- NEWS | 1 + bootstrap.conf | 2 +- gnulib | 2 +- src/cksum.c | 7 ++++++- 4 files changed, 9 insertions(+), 3 deletions(-) diff --git a/NEWS b/NEWS index ed8754693..332e862d6 100644 --- a/NEWS +++ b/NEWS @@ -54,6 +54,7 @@ GNU coreutils NEWS -*- outline -*- cksum -a now supports the "crc32b" option, which calculates the CRC of the input as defined by ITU V.42, as used by gzip for example. + For performance pclmul instructions are used where supported. ls now supports the --sort=name option, to explicitly select the default operation of sorting by file name. diff --git a/bootstrap.conf b/bootstrap.conf index 480e02931..e10c1ac54 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -64,7 +64,7 @@ gnulib_modules=" config-h configmake copy-file-range - crc + crc-x86_64 crypto/md5 crypto/sha1 crypto/sha256 diff --git a/gnulib b/gnulib index 1f36fee69..da6b90f1f 160000 --- a/gnulib +++ b/gnulib @@ -1 +1 @@ -Subproject commit 1f36fee699926dbd04d4b97ca19fad29a847c3ae +Subproject commit da6b90f1fd041c013b9685ec4256e16d75b83f5d diff --git a/src/cksum.c b/src/cksum.c index 489af7e52..dd6d0aab4 100644 --- a/src/cksum.c +++ b/src/cksum.c @@ -149,7 +149,7 @@ static bool pclmul_supported (void) { bool pclmul_enabled = false; -# if USE_PCLMUL_CRC32 +# if USE_PCLMUL_CRC32 || GL_CRC_X86_64_PCLMUL pclmul_enabled = (0 < __builtin_cpu_supports ("pclmul") && 0 < __builtin_cpu_supports ("avx")); @@ -332,6 +332,11 @@ crc32b_sum_stream (FILE *stream, void *resstream, uintmax_t *reslen) if (!stream || !resstream || !reslen) return -1; +# if GL_CRC_X86_64_PCLMUL + if (cksum_debug) + (void) pclmul_supported (); +# endif + while ((bytes_read = fread (buf, 1, BUFLEN, stream)) > 0) { if (len + bytes_read < len) -- 2.11.4.GIT