]> git.ipfire.org Git - thirdparty/zlib-ng.git/commitdiff
Removed fallback for __builtin_ctzl since it is no longer used.
authorNathan Moinvaziri <nathan@nathanm.com>
Thu, 7 May 2020 15:13:14 +0000 (08:13 -0700)
committerHans Kristian Rosbach <hk-github@circlestorm.org>
Sun, 24 May 2020 11:53:25 +0000 (13:53 +0200)
CMakeLists.txt
configure
fallback_builtins.h
match_p.h

index 71374e07ff16f0a8aeb897c2ff2724dd02a52f1f..c3b3edcb0f7907ca592514aeb0bd8816daa526ab 100644 (file)
@@ -435,22 +435,6 @@ if(HAVE_BUILTIN_CTZ)
     add_definitions(-DHAVE_BUILTIN_CTZ)
 endif()
 #
-# check for __builtin_ctzl() support in the compiler
-#
-check_c_source_compiles(
-    "int main(void)
-    {
-        unsigned int zero = 0;
-        long test = __builtin_ctzl(zero);
-        (void)test;
-        return 0;
-    }"
-    HAVE_BUILTIN_CTZL
-)
-if(HAVE_BUILTIN_CTZL)
-    add_definitions(-DHAVE_BUILTIN_CTZL)
-endif()
-#
 # check for __builtin_ctzll() support in the compiler
 #
 check_c_source_compiles(
index a0c8f60fe491e6590391069386b1fb9374552e74..463ae44c14e339d1189c2d030777ca52db059ca6 100755 (executable)
--- a/configure
+++ b/configure
@@ -869,23 +869,6 @@ else
     echo "Checking for __builtin_ctz ... No." | tee -a configure.log
 fi
 
-# Check for __builtin_ctzl() support in compiler
-cat > $test.c << EOF
-int main(void) {
-    unsigned int zero = 0;
-    long test = __builtin_ctzl(zero);
-    (void)test;
-    return 0;
-}
-EOF
-if try ${CC} ${CFLAGS} $test.c $LDSHAREDLIBC; then
-    echo "Checking for __builtin_ctzl ... Yes." | tee -a configure.log
-    CFLAGS="$CFLAGS -DHAVE_BUILTIN_CTZL"
-    SFLAGS="$SFLAGS -DHAVE_BUILTIN_CTZL"
-else
-    echo "Checking for __builtin_ctzl ... No." | tee -a configure.log
-fi
-
 # Check for __builtin_ctzll() support in compiler
 cat > $test.c << EOF
 int main(void) {
index cd597f622a0c98deee6774591b875acd673179ed..f85579215491b1f13a3b5abdf46e021a19972a78 100644 (file)
@@ -23,20 +23,6 @@ static __forceinline unsigned long __builtin_ctz(uint32_t value) {
 }
 #define HAVE_BUILTIN_CTZ
 
-/* This is not a general purpose replacement for __builtin_ctzl. The function expects that value is != 0
- * Because of that assumption trailing_zero is not initialized and the return value of _BitScanForward is not checked
- */
-static __forceinline unsigned long __builtin_ctzl(unsigned long value) {
-#ifdef X86_CPUID
-    x86_check_features();
-    if (x86_cpu_has_tzcnt)
-        return _tzcnt_u32(value);
-#endif
-    unsigned long trailing_zero;
-    _BitScanForward(&trailing_zero, value);
-    return trailing_zero;
-}
-
 #ifdef _M_AMD64
 /* This is not a general purpose replacement for __builtin_ctzll. The function expects that value is != 0
  * Because of that assumption trailing_zero is not initialized and the return value of _BitScanForward64 is not checked
index a3544e9a4670eac3416b90ae7958bbb670a79281..dd13e00870af7edcf1f5fe05953e52c07c08f7df 100644 (file)
--- a/match_p.h
+++ b/match_p.h
@@ -18,7 +18,7 @@
 #    define std2_longest_match
    /* Only use std3_longest_match for little_endian systems, also avoid using it with
       non-gcc compilers since the __builtin_ctzl() function might not be optimized. */
-#  elif(defined(__GNUC__) && defined(HAVE_BUILTIN_CTZL) && ((__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) \
+#  elif(defined(__GNUC__) && (defined(HAVE_BUILTIN_CTZ) || defined(HAVE_BUILTIN_CTZLL)) && ((__BYTE_ORDER__ == __ORDER_LITTLE_ENDIAN__) \
         || defined(__LITTLE_ENDIAN__)))
 #    define std3_longest_match
 #  elif(defined(_MSC_VER) && defined(_WIN32))