[libcxx-commits] [libcxx] [libcxx] Use generic builtins for popcount, clz and ctz (PR #86563)
Mark de Wever via libcxx-commits
libcxx-commits at lists.llvm.org
Tue Mar 26 11:29:37 PDT 2024
================
@@ -47,11 +59,28 @@ inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __libcpp_clz(__uint128_t __x)
// - Any bits set:
// - The number of leading zeros of the input is the number of leading
// zeros in the high 64-bits.
+# if __has_builtin(__builtin_clzg)
+ return __builtin_clzg(__x);
+# else
----------------
mordante wrote:
I feel this is a win.
Please move this code above the comment. The comment is clearly intended for the `#else` branch.
https://github.com/llvm/llvm-project/pull/86563
More information about the libcxx-commits
mailing list