Add static SIMD support to XXH3 in core:hash/xxhash.

This uses compile-time features to decide how large of a SIMD vector to
use. It currently has checks for amd64/i386 to size its vectors for
SSE2/AVX2/AVX512 as necessary.

The generalized SIMD functions could also be useful for multiversioning
of the hash procs, to allow for run-time dispatch based on available CPU
features.
This commit is contained in:
Barinzaya
2025-07-31 13:05:08 -04:00
parent 393e00bec3
commit 9d40f371be
4 changed files with 137 additions and 4 deletions
+8
View File
@@ -0,0 +1,8 @@
#+build !amd64
#+build !i386
package xxhash
import "base:runtime"
XXH_NATIVE_WIDTH :: min(XXH_MAX_WIDTH,
2 when runtime.HAS_HARDWARE_SIMD else 1)