]> git.ipfire.org Git - thirdparty/coreutils.git/commit
wc: add AVX512 function for line counting
authorMathieu Bordere <mathieu@letmetweakit.com>
Wed, 24 Sep 2025 10:41:06 +0000 (12:41 +0200)
committerPádraig Brady <P@draigBrady.com>
Tue, 30 Sep 2025 13:09:37 +0000 (14:09 +0100)
commit67e9068c5f5fdae5666279717a4c19bdfe5c21de
tree3433b931659ca653d12b7d137e9f76cfdb454da2
parentc6afc8fa6715f7dc3ed4a4585ce40f8733b2048b
wc: add AVX512 function for line counting

* configure.ac: Add detection of AVX512 intrinsics for wc.
* src/local.mk: Build AVX512 wc libraries.
* src/wc.c: Add runtime detection of AVX512 intrinsics and call
appropriate function when detected.
* src/wc.h (wc_lines_avx512): Declare function.
* tests/wc/wc-cpu.sh: Add a test that disables AVX512 intrinsics.
* src/wc_avx512.c: New file containing the wc -l implementation using
AVX512. The logic and code is reused from the AVX2 implementation with
slight adaptations. Replaced __builtin_popcount by __builtin_popcountll
and the combination of _mm256_cmpeq_epi8 and _mm256_movemask_epi8 by a
single call to _mm512_cmpeq_epi8_mask.
* NEWS: Mention the improvement.
NEWS
configure.ac
src/local.mk
src/wc.c
src/wc.h
src/wc_avx512.c [new file with mode: 0644]
tests/wc/wc-cpu.sh