From: Nathan Moinvaziri Date: Thu, 7 May 2020 15:13:14 +0000 (-0700) Subject: Removed fallback for __builtin_ctzl since it is no longer used. X-Git-Tag: 1.9.9-b1~301 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cf3f8bd671537820e423e212ebba2fb0a90b16cc;p=thirdparty%2Fzlib-ng.git Removed fallback for __builtin_ctzl since it is no longer used. --- diff --git a/CMakeLists.txt b/CMakeLists.txt index 71374e07f..c3b3edcb0 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -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( diff --git a/configure b/configure index a0c8f60fe..463ae44c1 100755 --- 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) { diff --git a/fallback_builtins.h b/fallback_builtins.h index cd597f622..f85579215 100644 --- a/fallback_builtins.h +++ b/fallback_builtins.h @@ -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 diff --git a/match_p.h b/match_p.h index a3544e9a4..dd13e0087 100644 --- 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))