From nobody Fri May 29 23:01:58 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 4gRzPz3bsFz6gF6G for ; Fri, 29 May 2026 23:01:59 +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 4gRzPz0kd2z3CG9 for ; Fri, 29 May 2026 23:01:59 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1780095719; 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=KDJ9T2ufuNmkGaa6aDf+iGALRYcaA/wfYxR612eQrgI=; b=CpJx6m/JLogVoWwMh7Du6LebkHouGYyUXSlLNARpiYiq/mcuwu1m3/0Yq0MBpBcQTIIV3z M26YyHk+/leAG+pBX/a99jHeX+nSfmuLCSMvVwwwAGP94IUHwGred1Uqc6zXKSZ/YFmFrm OV1nWQnzASJHRKWhp3w/roSWhr/c96+6Rxu181OfOpXWkUwGy3X5o7BMPWXR69J66hmTV6 lWH0fuxzINIWQ0UpDUAGc/ZyGCaTxl85YW1qwZ17rlDXo++qZ5gWAOMAgTvLZhQh23V/2o +ptsVp6O9nmpZZXNH0FkgKbUDoaYL/Bm3VVa5lqHzJ9V2Lc1HfdeSlm1SqDS8w== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1780095719; a=rsa-sha256; cv=none; b=bOMdg7JkyVCWxxIdBHbTBKJpJaKgtNpn75nkGyrpSvXGqVOD+/aiHB2YbPS5wMpogX0Rq6 4z0LK+Z4GEK2wTBirMdeDZ9qBmLRaljzSbcBC1Z/hVLtphoocVhGs5AQbt1NMnfqckicez qVm1WYYGJHfze2dadg2PsMbYi1b7ZHlnLMxW0uL5+66Ps3jp5oZAbiAljYfysNwhWF8iUU /J6vVPZIMT4IcJ+rskgrUkJMe1s0/pgbLqGAieRCEiKT8BcEeafyJymsN/+yt/EmURZGVi OM/0V+Vz3ICzWysUkYnuX9VHfP/Gy7odb7klTIbnAsiwF/2motCUDDdqjGm82A== 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=1780095719; 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=KDJ9T2ufuNmkGaa6aDf+iGALRYcaA/wfYxR612eQrgI=; b=b4CLvlwJnLgjGlwoo6KQ+lh6w4HKztHdNXZtZ55pir6yw+SaVzdNBrDhFVYZlsEfcfJOKC uggFnc3R+gFrJvmRNWmdy6hUO8b+Yrk09pG2E2GPwhzElrqOwF41UxqKfSXZaBiRf6WxKo ItOAFoeMAtjSSYv6YoV0UmaElo2p7aeI3kSqrNC23GhDjJXPKXIeXBJnzsrITJja4q9e/+ RVgdPJQPBOSZKeHwseq83FNebgjGd55IsHgAQmvDN/HZIptIo7OkJDBRDFRb/zSzx+I3Z+ lVY9Jh2X/UR5lvrgizl8PmSAL8a4m7rjJVo4mUhfnTn2EZXRegfSrqaG5qzAHg== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) by mxrelay.nyi.freebsd.org (Postfix) with ESMTP id 4gRzPy6hLWztD9 for ; Fri, 29 May 2026 23:01:58 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from git (uid 1279) (envelope-from git@FreeBSD.org) id 41934 by gitrepo.freebsd.org (DragonFly Mail Agent v0.13+ on gitrepo.freebsd.org); Fri, 29 May 2026 23:01:58 +0000 To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-branches@FreeBSD.org Cc: Dimitry Andric From: Dimitry Andric Subject: git: 01a024883898 - stable/15 - 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 List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list 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/stable/15 X-Git-Reftype: branch X-Git-Commit: 01a0248838987ce6a62f4e59d634ed1c61b4ece8 Auto-Submitted: auto-generated Date: Fri, 29 May 2026 23:01:58 +0000 Message-Id: <6a1a1ae6.41934.1bd10ad1@gitrepo.freebsd.org> The branch stable/15 has been updated by dim: URL: https://cgit.FreeBSD.org/src/commit/?id=01a0248838987ce6a62f4e59d634ed1c61b4ece8 commit 01a0248838987ce6a62f4e59d634ed1c61b4ece8 Author: Dimitry Andric AuthorDate: 2026-01-05 20:14:13 +0000 Commit: Dimitry Andric CommitDate: 2026-05-29 22:57:32 +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 (cherry picked from commit 5465db314a03c11b15e00f22be1609027dfc152c) --- .../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