From 7383f346c9e33a08ed2132f117b3de6b13eac173 Mon Sep 17 00:00:00 2001 From: Abseil Team Date: Thu, 9 Jun 2022 03:12:43 -0700 Subject: Optimize SwissMap iteration by another 5-10% for ARM https://pastebin.com/fDvgWgHe After having a chat with Dougall Johnson (https://twitter.com/dougallj/status/1534213050944802816), we realized that __clzll works with zero arguments per documentation: https://developer.arm.com/documentation/101028/0009/Data-processing-intrinsics ``` Returns the number of leading zero bits in x. When x is zero it returns the argument width, i.e. 32 or 64. ``` Codegen improves https://godbolt.org/z/ebadf717Y Thus we can use a little bit different construction not involving CLS but using more understandable CLZ and removing some operations. PiperOrigin-RevId: 453879080 Change-Id: Ie2d7f834f63364d7bd50dd6a682c107985f21942 --- absl/base/config.h | 15 --------------- 1 file changed, 15 deletions(-) (limited to 'absl/base') diff --git a/absl/base/config.h b/absl/base/config.h index cf940f32..58097b0d 100644 --- a/absl/base/config.h +++ b/absl/base/config.h @@ -860,21 +860,6 @@ static_assert(ABSL_INTERNAL_INLINE_NAMESPACE_STR[0] != 'h' || #define ABSL_INTERNAL_HAVE_SSSE3 1 #endif -// ABSL_INTERNAL_HAVE_ARM_ACLE is used for compile-time detection of ACLE (ARM -// C language extensions). -#ifdef ABSL_INTERNAL_HAVE_ARM_ACLE -#error ABSL_INTERNAL_HAVE_ARM_ACLE cannot be directly set -// __cls, __rbit were added quite late in clang. They are not supported -// by GCC as well. __cls can be replaced with __builtin_clrsb but clang does -// not recognize cls instruction in latest versions. -// TODO(b/233604649): Relax to __builtin_clrsb and __builtin_bitreverse64 (note -// that the latter is not supported by GCC). -#elif defined(__ARM_ACLE) && defined(__clang__) && \ - ABSL_HAVE_BUILTIN(__builtin_arm_cls64) && \ - ABSL_HAVE_BUILTIN(__builtin_arm_rbit64) -#define ABSL_INTERNAL_HAVE_ARM_ACLE 1 -#endif - // ABSL_INTERNAL_HAVE_ARM_NEON is used for compile-time detection of NEON (ARM // SIMD). #ifdef ABSL_INTERNAL_HAVE_ARM_NEON -- cgit v1.2.3