From nobody Sat Aug 9 12:36:03 2025 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 4bzgP02bsgz64C6p; Sat, 09 Aug 2025 12:36:04 +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 "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4bzgNz6bwYz3ly8; Sat, 09 Aug 2025 12:36:03 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754742964; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=l1gsoLOQzfqldCDXIKK1bjbdFs+ewrIRkpMET50KLXw=; b=xo2TMjjBHw+0VMqGpYOO3hUJPCDLaog9+cd00wsJNyYaQ68SOImM/PzIfw8H5rJD2BN4di QI5Ce3xmdINOThFr9Rdv7k9w6Dnm+0Y6Euq8FOpB26HKX92gYpS5yk/6QiYdhfKiOiwnpO brqevQMfYOs8EbwaTmKSsbbz9WmXJPtWs6/xvrt2ezUOV9UDV4r9JLxglCys2GxqjimxzY kkATz4TEgbKjSN3VW9mZohY6kvMYyED6R78jvSjwI+CyS4LWG8E0X0UMyAtJYJiiVA3hTT HCGQcsTXDblgQJBv3+WgjcQvmukgK/LPuzVEcjWFUaXrB32MKTfgvixAEIrjEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1754742963; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=l1gsoLOQzfqldCDXIKK1bjbdFs+ewrIRkpMET50KLXw=; b=Uyg35Cqo+kK86XtFfI5fJvx31k3M6VAKxayFA6A61ZIdjratFhhjByRbCTlaQTYIqStCKy pysVy1Lcvz7RwgR4MJsYB5A94BqvHqsYiaXEXdKIsRbrR3hNglwpGXvTQx58JNykLMnlHI m7WkyDAw3G2KFM6jHzRLfqsBxS+m06kgkwZ8F+xOYQsR4unrSmxCO3owI1SKpD5cJ0jATx bHrFM99mZKx7Cb+smlbUdJ5GDR6Nj030d4tVKKKKN9OsudDirqt2h5bfqYXUtK35eGio5R Mp5tzvGpwGmdKAUHP4rR/ujVgc+HhojypGjYvtwbUV7pAOyfuX7ll1DZ3wTgOQ== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1754742963; a=rsa-sha256; cv=none; b=QnG0DflAMLLCGbceOZC/gGL5CCNBU5fviE2Ckr1efLIjxGoLsLCC3DHaseEk4GB/Fvmz4V y+/tNDcIaHMJ6WVOH6NvGVNE2MqK1Xri3JtzVSEqozNCgz0oAK1q/WW4ydFUUB9Tl5D+z0 RRTeOlHq6ylu8Mhocqt6tYHMVFFxmFNa20r114Sc8m1q785fsS9xPRtcNZ44xNkjoAVkmn t+2KaqnZuL+mpkRriO37Iy/3FUrU2Pb7qk75i9NvnC3ZlwzpEVtHIXjMJrWxV6Kes/hsbF ELn8u7gKcXQSsNtrfFxcJPiLjJTfD6872ajJodROTNPOcwvKzQDzy//DRM2poA== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4bzgNz64hnz681; Sat, 09 Aug 2025 12:36:03 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.18.1/8.18.1) with ESMTP id 579Ca3ra020776; Sat, 9 Aug 2025 12:36:03 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.18.1/8.18.1/Submit) id 579Ca30g020773; Sat, 9 Aug 2025 12:36:03 GMT (envelope-from git) Date: Sat, 9 Aug 2025 12:36:03 GMT Message-Id: <202508091236.579Ca30g020773@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: =?utf-8?Q?Jean-S=C3=A9bastien?= =?utf-8?Q?P=C3=A9dron?= Subject: git: 7cbc4d875971 - main - linuxkpi: Use `__builtin_popcountg()` instead of `bitcount*()` 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: dumbbell X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 7cbc4d875971860d941cc15d7f42e6cfeffbfe66 Auto-Submitted: auto-generated The branch main has been updated by dumbbell: URL: https://cgit.FreeBSD.org/src/commit/?id=7cbc4d875971860d941cc15d7f42e6cfeffbfe66 commit 7cbc4d875971860d941cc15d7f42e6cfeffbfe66 Author: Jean-Sébastien Pédron AuthorDate: 2025-06-22 09:59:01 +0000 Commit: Jean-Sébastien Pédron CommitDate: 2025-08-09 12:26:25 +0000 linuxkpi: Use `__builtin_popcountg()` instead of `bitcount*()` The DRM drivers generic code started to use `HWEIGHT64()` in the definition of an array field in a structure. Therefore, the array size needs to be known at compile time. This was not the case with the `HWEIGHT*()` macros based on `bitcount*()`. The use of `__builtin_popcountg()` solves that problem. Reviewed by: bz Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D50995 --- sys/compat/linuxkpi/common/include/linux/bitops.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/sys/compat/linuxkpi/common/include/linux/bitops.h b/sys/compat/linuxkpi/common/include/linux/bitops.h index bc776a0db9c4..00dd1f9a1ec0 100644 --- a/sys/compat/linuxkpi/common/include/linux/bitops.h +++ b/sys/compat/linuxkpi/common/include/linux/bitops.h @@ -62,10 +62,10 @@ #define hweight64(x) bitcount64(x) #define hweight_long(x) bitcountl(x) -#define HWEIGHT8(x) (bitcount8((uint8_t)(x))) -#define HWEIGHT16(x) (bitcount16(x)) -#define HWEIGHT32(x) (bitcount32(x)) -#define HWEIGHT64(x) (bitcount64(x)) +#define HWEIGHT8(x) (__builtin_popcountg((uint8_t)(x))) +#define HWEIGHT16(x) (__builtin_popcountg((uint16_t)(x))) +#define HWEIGHT32(x) (__builtin_popcountg((uint32_t)(x))) +#define HWEIGHT64(x) (__builtin_popcountg((uint64_t)(x))) static inline int __ffs(int mask)