]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Combine some of the checks that were not identical.
authorHans Kristian Rosbach <hk-git@circlestorm.org>
Mon, 6 Feb 2023 11:40:13 +0000 (12:40 +0100)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Sun, 12 Feb 2023 23:25:57 +0000 (00:25 +0100)
Made longest_match and compare256 use the X86_NOCHECK_SSE2 override,
thus now those are also automatically enabled on x86_64.

functable.c

index 6d30585d6553a58c7f4eed4fcdfda82e03257a3f..3eef010b86ebd60164f77d3b56fe80df8cbd679f 100644 (file)
@@ -56,27 +56,24 @@ static void init_functable(void) {
     // Select arch-optimized functions
 
     // X86 - SSE2
-#ifdef X86_SSE2
+#if defined(X86_SSE2) || defined(X86_SSE2_CHUNKSET)
 #  if !defined(__x86_64__) && !defined(_M_X64) && !defined(X86_NOCHECK_SSE2)
     if (x86_cpu_has_sse2)
 #  endif
+    {
+#  ifdef X86_SSE2
         ft.slide_hash = &slide_hash_sse2;
-#endif
-#if defined(X86_SSE2) && defined(HAVE_BUILTIN_CTZ)
-    if (x86_cpu_has_sse2) {
+#    ifdef HAVE_BUILTIN_CTZ
         ft.longest_match = &longest_match_sse2;
         ft.longest_match_slow = &longest_match_slow_sse2;
         ft.compare256 = &compare256_sse2;
-    }
-#endif
-#ifdef X86_SSE2_CHUNKSET
-# if !defined(__x86_64__) && !defined(_M_X64) && !defined(X86_NOCHECK_SSE2)
-    if (x86_cpu_has_sse2)
-# endif
-    {
+#    endif
+#  endif
+#  ifdef X86_SSE2_CHUNKSET
         ft.chunksize = &chunksize_sse2;
         ft.chunkmemset_safe = &chunkmemset_safe_sse2;
         ft.inflate_fast = &inflate_fast_sse2;
+#  endif
     }
 #endif
     // X86 - SSSE3
@@ -121,14 +118,13 @@ static void init_functable(void) {
     }
 #endif
 #ifdef X86_AVX2
-    if (x86_cpu_has_avx2)
-        ft.slide_hash = &slide_hash_avx2;
-#endif
-#if defined(X86_AVX2) && defined(HAVE_BUILTIN_CTZ)
     if (x86_cpu_has_avx2) {
+        ft.slide_hash = &slide_hash_avx2;
+#  ifdef HAVE_BUILTIN_CTZ
         ft.longest_match = &longest_match_avx2;
         ft.longest_match_slow = &longest_match_slow_avx2;
         ft.compare256 = &compare256_avx2;
+#  endif
     }
 #endif
 #ifdef X86_AVX2_ADLER32