Add experimental XXH3 hash implementation with SIMD acceleration

Memory write speed using the C memset() function:
  memset   57952

Hash used to check the data blocks integrity:
            best murmur3 spooky2 museair    xxh3   xsse2   xavx2
    hash spooky2    6172   17914   32048   14627   23613   44034
This commit is contained in:
Andrea Mazzoleni 2026-09-30 09:13:57 +02:00
parent f0ae584473
commit cea9015933
17 changed files with 5498 additions and 13 deletions

View file

@ -260,6 +260,26 @@ static inline int raid_cpu_has_avx2gfni(void)
return raid_cpu_match_avx(leaf_1_ecx, leaf_7_ebx, leaf_7_ecx, xcr0);
}
static inline int raid_cpu_has_avx512f(void)
{
/*
* Intel Architecture Instruction Set Extensions Programming Reference
* 319433-022 October 2014
*
* 2.2 Detection of 512-bit Instruction Groups of Intel AVX-512 Family
* 1) Detect CPUID.1:ECX.OSXSAVE[bit 27] = 1 (XGETBV enabled for application use)
* 2) Execute XGETBV and verify that XCR0[7:5] = `111b' (OPMASK state, upper 256-bit of
* ZMM0-ZMM15 and ZMM16-ZMM31 state are enabled by OS) and that XCR0[2:1] = `11b'
* (XMM state and YMM state are enabled by OS).
* 3) Verify CPUID.0x7.0:EBX.AVX512F[bit 16] = 1.
*/
uint32_t leaf_1_ecx = 1 << 27; /* XSAVE/XGETBV */
uint32_t leaf_7_ebx = 1 << 16; /* AVX512F */
uint32_t xcr0 = (3 << 1) | (7 << 5); /* OS saves XMM, YMM and ZMM registers */
return raid_cpu_match_avx(leaf_1_ecx, leaf_7_ebx, 0, xcr0);
}
static inline int raid_cpu_has_avx512bw(void)
{
/*