diff options
| author | Hans Kristian Rosbach <hk-git@circlestorm.org> | 2025-11-11 20:23:24 +0100 |
|---|---|---|
| committer | Hans Kristian Rosbach <hk-github@circlestorm.org> | 2025-11-13 23:17:07 +0100 |
| commit | 8003f57828f7310aaa035519bfa17c93b5621977 (patch) | |
| tree | df66259bbee3156c56cb24559a0e4b997aeda059 /test | |
| parent | 29cf6242ebb56810c3516e3ce5b4ee8f27ad9b07 (diff) | |
| download | Project-Tick-8003f57828f7310aaa035519bfa17c93b5621977.tar.gz Project-Tick-8003f57828f7310aaa035519bfa17c93b5621977.zip | |
Reorganize Chorba activation.
Now WITHOUT_CHORBA will only disable the crc32_chorba C fallback.
SSE2, SSE41 and pclmul variants will still be able to use their Chorba-algorithm based code,
but their fallback to the generic crc32_chorba C code in SSE2 and SSE41 will be disabled,
reducing their performance on really big input buffers (not used during deflate/inflate,
only when calling crc32 directly).
Remove the crc32_c function (and its file crc32_c.c), instead use the normal functable
routing to select between crc32_braid and crc32_chorba.
Disable sse2 and sse4.1 variants of Chorba-crc32 on MSVC older than 2022 due to code
generation bug in 2019 causing segfaults.
Compile either crc32_chorba_small_nondestructive or crc32_chorba_small_nondestructive_32bit,
not both. Don't compile crc32_chorba_32768_nondestructive on 32bit arch.
Diffstat (limited to 'test')
| -rw-r--r-- | test/benchmarks/benchmark_crc32.cc | 18 | ||||
| -rw-r--r-- | test/test_crc32.cc | 21 |
2 files changed, 17 insertions, 22 deletions
diff --git a/test/benchmarks/benchmark_crc32.cc b/test/benchmarks/benchmark_crc32.cc index 1e95b27770..3b00f87d72 100644 --- a/test/benchmarks/benchmark_crc32.cc +++ b/test/benchmarks/benchmark_crc32.cc @@ -56,12 +56,6 @@ public: } \ BENCHMARK_REGISTER_F(crc32, name)->Arg(1)->Arg(8)->Arg(12)->Arg(16)->Arg(32)->Arg(64)->Arg(512)->Arg(4<<10)->Arg(32<<10)->Arg(256<<10)->Arg(4096<<10); -#ifndef WITHOUT_CHORBA -BENCHMARK_CRC32(generic_chorba, crc32_c, 1); -#else -BENCHMARK_CRC32(generic, crc32_c, 1); -#endif - BENCHMARK_CRC32(braid, crc32_braid, 1); #ifdef DISABLE_RUNTIME_CPU_DETECTION @@ -69,14 +63,16 @@ BENCHMARK_CRC32(native, native_crc32, 1); #else #ifndef WITHOUT_CHORBA -# if defined(X86_SSE2) && !defined(NO_CHORBA_SSE) +BENCHMARK_CRC32(chorba_c, crc32_chorba, 1); +#endif +#ifndef WITHOUT_CHORBA_SSE +# ifdef X86_SSE2 BENCHMARK_CRC32(chorba_sse2, crc32_chorba_sse2, test_cpu_features.x86.has_sse2); -# if defined(X86_SSE41) && !defined(NO_CHORBA_SSE) - BENCHMARK_CRC32(chorba_sse41, crc32_chorba_sse41, test_cpu_features.x86.has_sse41); -# endif +# endif +# ifdef X86_SSE41 + BENCHMARK_CRC32(chorba_sse41, crc32_chorba_sse41, test_cpu_features.x86.has_sse41); # endif #endif - #ifdef ARM_CRC32 BENCHMARK_CRC32(armv8, crc32_armv8, test_cpu_features.arm.has_crc32); #endif diff --git a/test/test_crc32.cc b/test/test_crc32.cc index d44d079e97..ca0767d468 100644 --- a/test/test_crc32.cc +++ b/test/test_crc32.cc @@ -269,12 +269,6 @@ INSTANTIATE_TEST_SUITE_P(crc32, crc32_variant, testing::ValuesIn(tests)); hash(func); \ } -#ifndef WITHOUT_CHORBA -TEST_CRC32(generic_chorba, crc32_c, 1) -#else -TEST_CRC32(generic, crc32_c, 1) -#endif - TEST_CRC32(braid, crc32_braid, 1) #ifdef DISABLE_RUNTIME_CPU_DETECTION @@ -297,6 +291,9 @@ static const int align_offsets[] = { } #endif +#ifndef WITHOUT_CHORBA +TEST_CRC32(chorba_c, crc32_chorba, 1) +#endif #ifdef ARM_CRC32 INSTANTIATE_TEST_SUITE_P(crc32_alignment, crc32_align, testing::ValuesIn(align_offsets)); TEST_CRC32(armv8, crc32_armv8, test_cpu_features.arm.has_crc32) @@ -317,11 +314,13 @@ TEST_CRC32(pclmulqdq, crc32_pclmulqdq, test_cpu_features.x86.has_pclmulqdq) #ifdef X86_VPCLMULQDQ_CRC TEST_CRC32(vpclmulqdq, crc32_vpclmulqdq, (test_cpu_features.x86.has_pclmulqdq && test_cpu_features.x86.has_avx512_common && test_cpu_features.x86.has_vpclmulqdq)) #endif -#if !defined(WITHOUT_CHORBA) && defined(X86_SSE2) && !defined(NO_CHORBA_SSE) -TEST_CRC32(chorba_sse2, crc32_chorba_sse2, test_cpu_features.x86.has_sse2) -#endif -#if !defined(WITHOUT_CHORBA) && defined(X86_SSE41) && !defined(NO_CHORBA_SSE) -TEST_CRC32(chorba_sse41, crc32_chorba_sse41, test_cpu_features.x86.has_sse41) +#ifndef WITHOUT_CHORBA_SSE +# ifdef X86_SSE2 + TEST_CRC32(chorba_sse2, crc32_chorba_sse2, test_cpu_features.x86.has_sse2) +# endif +# ifdef X86_SSE41 + TEST_CRC32(chorba_sse41, crc32_chorba_sse41, test_cpu_features.x86.has_sse41) +# endif #endif #if defined(LOONGARCH_CRC) INSTANTIATE_TEST_SUITE_P(crc32_alignment, crc32_align, testing::ValuesIn(align_offsets)); |
