From nobody Sat Apr 25 14:20:12 2026 X-Original-To: dev-commits-src-all@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4g2sRd1JMnz6bZNB for ; Sat, 25 Apr 2026 14:20:13 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R13" (not verified)) by mx1.freebsd.org (Postfix) with ESMTPS id 4g2sRc57f5z3J8Y for ; Sat, 25 Apr 2026 14:20:12 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1777126812; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=N1toviqzB2PCwGauNeVAwi4l8x5nV+G9p8UxYrDAAF0=; b=cIVt/ZCuHYid/DIdAo4gXq6jeyd4JoU90YBY51/uOf9DJ1/eW5WgDzZ/F1N4TKyIK4XCIk 7oyH5ZzFNoLF/XlHcc4QzadbXOUafOPqtI3gsavyfcgUgtGmL8HzzeOtbD2UhirufzilV+ prQLjdlIVkb/XGGwDO1f6vN7OmYzttqH6WYMfibjCMfPJQcsnOO22FE/70rr3kFhxmGJY0 45d772ShxLD0vTKJGwpunopYfv7bGVwx9ewyVhU3LLWjCQS/eJtNeE4yRURvvFw9F0Uc/p Ktb7jWUTa9VFzF9SeIiYZkICkrdanVCe8meMjhIXbTmjElot5q4Rc4bjCD8dmA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1777126812; a=rsa-sha256; cv=none; b=OvvlEK5N6GJPFOjJc/rWBE+3VnIwNQDy43GnXMg6eiFi8OdeUO2iqLW1hdPNDXGvgYYjy9 re0mtl3cLG3J4jThvfW9eSr5Q7Wu5ta/Jo4iLl0SMpEg4BCB4x6SgScQqokFrrCzH1ETYJ /ufUXomA2UCLyLL3eoIbofDjNApoARg0kJjTuiuwhvEBOJSxBVozON5NeXlaN+l+QaSVE7 9eS6FUJgyN9eGwFnx4264QXXfCQ7fJLjMYk7rh2DIUnlVW6zzEh3X6GWBZRWvgtVGgmQWx xx6woOuFZMaCWXMqRn2ZLY20y1GUyvfZazbFNO69LZrO+ledd6KyQRrf9kay8g== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1777126812; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=N1toviqzB2PCwGauNeVAwi4l8x5nV+G9p8UxYrDAAF0=; b=v0KsXWj7fbbkU2wEk9mAJut89RUdmZn3HzA6HUpuLPHICeZHvgoCK9eTMoACOsaH+UVM9H 5Ns630gFPL3k1/MzPBBWuBtp+HCNPBFwyIr21BIFffSJ5WEOvOhWrYnahGPdS/BTDDdNYh +Fa/ww0EnlsOWspg9nCj3Obl03Re5pEh8JqfyW/aBuF57lsV0mdIskXimdXqk1g0Ura8u+ cvPl9TPqpiJEDzhUH9i/75OZS5jwzeaig4tn4Jrwy5q4hmdXFjd+cqGK7KiO1YQoBTM8YF HXCUQF/0QOD3ggaH3mOFguX7KDJ14iHuPfaHW2Mxsb1oYxXq3EX6TDOkUese4w== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4g2sRc4QVyzdQq for ; Sat, 25 Apr 2026 14:20:12 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 36aea by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Sat, 25 Apr 2026 14:20:12 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org Cc: Dimitry Andric From: Dimitry Andric Subject: git: 5465db314a03 - main - libcxx-compat: revert llvmorg-21-init-8400-g703cfe745b96: List-Id: Commit messages for all branches of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-all List-Help: List-Post: List-Subscribe: List-Unsubscribe: X-BeenThere: dev-commits-src-all@freebsd.org Sender: owner-dev-commits-src-all@FreeBSD.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: dim X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 5465db314a03c11b15e00f22be1609027dfc152c Auto-Submitted: auto-generated Date: Sat, 25 Apr 2026 14:20:12 +0000 Message-Id: <69eccd9c.36aea.69dd3443@gitrepo.freebsd.org> The branch main has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=5465db314a03c11b15e00f22be1609027dfc152c commit 5465db314a03c11b15e00f22be1609027dfc152c Author: Dimitry Andric AuthorDate: 2026-01-05 20:14:13 +0000 Commit: Dimitry Andric CommitDate: 2026-04-25 14:14:20 +0000 libcxx-compat: revert llvmorg-21-init-8400-g703cfe745b96: [libc++] Replace __libcpp_popcount by __builtin_popcountg (#133937) `__libcpp_popcount` was previously used as a fallback for `__builtin_popcountg` to ensure compatibility with older compilers (Clang 18 and earlier), as `__builtin_popcountg` became available in Clang 19. Now that support for Clang 18 has been officially dropped in #130142, we can now safely replace all instances of `__libcpp_popcount` with `__builtin_popcountg` and eliminate the fallback logic. This is part of making libc++ 21 build with clang 18. PR: 292067 MFC after: 1 month --- .../llvm-project/libcxx/include/__bit/popcount.h | 29 ++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/contrib/llvm-project/libcxx/include/__bit/popcount.h b/contrib/llvm-project/libcxx/include/__bit/popcount.h index 8d9ba0993848..451b85182e9b 100644 --- a/contrib/llvm-project/libcxx/include/__bit/popcount.h +++ b/contrib/llvm-project/libcxx/include/__bit/popcount.h @@ -11,6 +11,7 @@ #include <__config> #include <__type_traits/integer_traits.h> +#include #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) # pragma GCC system_header @@ -21,10 +22,38 @@ _LIBCPP_PUSH_MACROS _LIBCPP_BEGIN_NAMESPACE_STD +template +[[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __popcount_impl(_Tp __t) _NOEXCEPT { + if _LIBCPP_CONSTEXPR (sizeof(_Tp) <= sizeof(unsigned int)) { + return __builtin_popcount(static_cast(__t)); + } else if _LIBCPP_CONSTEXPR (sizeof(_Tp) <= sizeof(unsigned long)) { + return __builtin_popcountl(static_cast(__t)); + } else if _LIBCPP_CONSTEXPR (sizeof(_Tp) <= sizeof(unsigned long long)) { + return __builtin_popcountll(static_cast(__t)); + } else { +#if _LIBCPP_STD_VER == 11 + return __t != 0 ? __builtin_popcountll(static_cast(__t)) + + std::__popcount_impl<_Tp>(__t >> numeric_limits::digits) + : 0; +#else + int __ret = 0; + while (__t != 0) { + __ret += __builtin_popcountll(static_cast(__t)); + __t >>= std::numeric_limits::digits; + } + return __ret; +#endif + } +} + template [[__nodiscard__]] _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR int __popcount(_Tp __t) _NOEXCEPT { static_assert(__is_unsigned_integer_v<_Tp>, "__popcount only works with unsigned types"); +#if __has_builtin(__builtin_popcountg) // TODO (LLVM 21): This can be dropped once we only support Clang >= 19. return __builtin_popcountg(__t); +#else + return std::__popcount_impl(__t); +#endif } #if _LIBCPP_STD_VER >= 20