From nobody Sat Nov 23 15:05:09 2024 Delivered-To: importer@patchew.org Received-SPF: pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) client-ip=192.237.175.120; envelope-from=xen-devel-bounces@lists.xenproject.org; helo=lists.xenproject.org; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass(p=reject dis=none) header.from=citrix.com ARC-Seal: i=1; a=rsa-sha256; t=1724882673; cv=none; d=zohomail.com; s=zohoarc; b=LF5ead7etdsr8hE+lZffB218BVkr2MBDimYNPMdfamgbodhIoH0pleGPRBKzPduEouAX5yqIJAjQVQKIgWdh0X1T0mImahLD+WK5Bs5f4W56eHPyYGzNfzt2SJu5hNjDcX4GPgyWiuj2YmTe9AjQnDxxHfPZU4HQ+QZN5g43A68= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zohomail.com; s=zohoarc; t=1724882673; h=Content-Type:Content-Transfer-Encoding:Cc:Cc:Date:Date:From:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:Subject:To:To:Message-Id:Reply-To; bh=+a9rZjwjT4T/KMzHim0E6pRI1Xb37U68VQt9wRm391Y=; b=mDsrXhnc0Ai49qZBZE34QJQUAxcsDb0VbZw+/V3+LkTW3hV6QSQ5e8husqWp7BV+sR31HIj6/D/lB5wFWd5xno3SfyFMuS4U2KwKBXBndsyp0DSUpJ221boBZ08bh2PCBwWOhm7Xj+cIftO1lLnwJQGvD877bqgw98DVPVElIBA= ARC-Authentication-Results: i=1; mx.zohomail.com; dkim=pass; spf=pass (zohomail.com: domain of lists.xenproject.org designates 192.237.175.120 as permitted sender) smtp.mailfrom=xen-devel-bounces@lists.xenproject.org; dmarc=pass header.from= (p=reject dis=none) Return-Path: Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) by mx.zohomail.com with SMTPS id 17248826738601003.0756578461607; Wed, 28 Aug 2024 15:04:33 -0700 (PDT) Received: from list by lists.xenproject.org with outflank-mailman.785172.1194656 (Exim 4.92) (envelope-from ) id 1sjQlw-0000DV-Ml; Wed, 28 Aug 2024 22:04:12 +0000 Received: by outflank-mailman (output) from mailman id 785172.1194656; Wed, 28 Aug 2024 22:04:12 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sjQlw-0000DJ-JQ; Wed, 28 Aug 2024 22:04:12 +0000 Received: by outflank-mailman (input) for mailman id 785172; Wed, 28 Aug 2024 22:04:10 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1sjQlu-0006E8-U2 for xen-devel@lists.xenproject.org; Wed, 28 Aug 2024 22:04:10 +0000 Received: from mail-ed1-x52a.google.com (mail-ed1-x52a.google.com [2a00:1450:4864:20::52a]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 735b5ad8-6589-11ef-99a0-01e77a169b0f; Thu, 29 Aug 2024 00:04:09 +0200 (CEST) Received: by mail-ed1-x52a.google.com with SMTP id 4fb4d7f45d1cf-5a108354819so9317577a12.0 for ; Wed, 28 Aug 2024 15:04:09 -0700 (PDT) Received: from andrewcoop.eng.citrite.net ([185.25.67.249]) by smtp.gmail.com with ESMTPSA id 4fb4d7f45d1cf-5c0bb1c2d2esm2695898a12.16.2024.08.28.15.04.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 28 Aug 2024 15:04:05 -0700 (PDT) X-Outflank-Mailman: Message body and most headers restored to incoming version X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 735b5ad8-6589-11ef-99a0-01e77a169b0f DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=citrix.com; s=google; t=1724882648; x=1725487448; darn=lists.xenproject.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=+a9rZjwjT4T/KMzHim0E6pRI1Xb37U68VQt9wRm391Y=; b=b/lenRI932SyEytxCAFEiO/qsUMJQcj46yK/2EQwJV5yqOiR4EfYhmBFIUvNGcNERG uJ1yO725B4mqWpd2WorZFUuLsOjeCfPq0bBp/mPW7olusr7UpKTfgIf9dDVjUByXqDx7 Ba61YuBnA8xLFcCSQT+7LZHwjVPopcpjTBd/8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1724882648; x=1725487448; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+a9rZjwjT4T/KMzHim0E6pRI1Xb37U68VQt9wRm391Y=; b=YKHg9Aain2ThG+UogaAxRg+bjMXfbWFsu2HDKDRvJplSmD7OqR5yfrLS59SeVhnbIc iwu36hPf9h1yifargx9fmWpQpdB3mmOuDnx5MbKcD/XiE1UhC1gCOCIX12d31H97AS/5 JtCeAG+bryp6aTIPqYMIf3EtT6K1GPEO20RPY2cAr2PxlMB5vuF5f+U5jn6j29RYhUnn i3DBJay4rI5/B6Y2B5mJ6AUQsez9y2vvBHJl+9fMwf74CEkzexf1pbGW2Fx+U18ibXJD vEnac9DNCxBY3z4XM8MKXRiu3Gy89JF5oFJV6M8FdE6lBqJVUW29tH4/0zORbiysg2S4 27Pg== X-Gm-Message-State: AOJu0YzXKkhqB9ejgcm1yKZHKeniB9pHZu+VgO/2vpvRJjKC8/xBfotM zOVHzGf1K53hnUYhxOKhPnd3YaRw5u4VZqaSzk6+6yeS09/ygecOCRb2hArcL9QwbI9KH6EB0I/ e X-Google-Smtp-Source: AGHT+IE3qOrSiwEVqCW9Hnp03aRaF70/QvtqPk4oYtkklqTrDEe2lMIHKCK2PJjCz4Asj6oY3RjTrQ== X-Received: by 2002:a05:6402:40c1:b0:5c2:17b7:5a7e with SMTP id 4fb4d7f45d1cf-5c21ed9fcbcmr609830a12.36.1724882647591; Wed, 28 Aug 2024 15:04:07 -0700 (PDT) From: Andrew Cooper To: Xen-devel Cc: Andrew Cooper , Jan Beulich , Jan Beulich , =?UTF-8?q?Roger=20Pau=20Monn=C3=A9?= , Stefano Stabellini , Julien Grall , Volodymyr Babchuk , Bertrand Marquis , Michal Orzel , Oleksii Kurochko , Shawn Anastasio Subject: [PATCH v2 09/11] xen/bitops: Implement hweight32() in terms of hweightl() Date: Wed, 28 Aug 2024 23:03:49 +0100 Message-Id: <20240828220351.2686408-10-andrew.cooper3@citrix.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20240828220351.2686408-1-andrew.cooper3@citrix.com> References: <20240828220351.2686408-1-andrew.cooper3@citrix.com> MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @citrix.com) X-ZM-MESSAGEID: 1724882675472116600 ... and drop generic_hweight32(). As noted previously, the only two users of hweight32() are in __init paths. The int-optimised form of generic_hweight() is only two instructions shorter than the long-optimised form, and even then only on architectures which lack fast multiplication, so there's no point providing an int-optimised form. No functional change. Signed-off-by: Andrew Cooper Acked-by: Jan Beulich --- CC: Jan Beulich CC: Roger Pau Monn=C3=A9 CC: Stefano Stabellini CC: Julien Grall CC: Volodymyr Babchuk CC: Bertrand Marquis CC: Michal Orzel CC: Oleksii Kurochko CC: Shawn Anastasio v2: * Reorder with respect to the hweight64() patch * Rerwrite the commit message * s/__pure/attr_const/ --- xen/arch/arm/include/asm/bitops.h | 1 - xen/arch/ppc/include/asm/bitops.h | 1 - xen/arch/x86/include/asm/bitops.h | 1 - xen/include/xen/bitops.h | 5 +++++ 4 files changed, 5 insertions(+), 3 deletions(-) diff --git a/xen/arch/arm/include/asm/bitops.h b/xen/arch/arm/include/asm/b= itops.h index 91cd167b6bbb..b28c25b3d52d 100644 --- a/xen/arch/arm/include/asm/bitops.h +++ b/xen/arch/arm/include/asm/bitops.h @@ -85,7 +85,6 @@ bool clear_mask16_timeout(uint16_t mask, volatile void *p, * The Hamming Weight of a number is the total number of bits set in it. */ #define hweight64(x) generic_hweight64(x) -#define hweight32(x) generic_hweight32(x) =20 #endif /* _ARM_BITOPS_H */ /* diff --git a/xen/arch/ppc/include/asm/bitops.h b/xen/arch/ppc/include/asm/b= itops.h index 64512e949530..f488a7c03425 100644 --- a/xen/arch/ppc/include/asm/bitops.h +++ b/xen/arch/ppc/include/asm/bitops.h @@ -133,6 +133,5 @@ static inline int test_and_set_bit(unsigned int nr, vol= atile void *addr) * The Hamming Weight of a number is the total number of bits set in it. */ #define hweight64(x) __builtin_popcountll(x) -#define hweight32(x) __builtin_popcount(x) =20 #endif /* _ASM_PPC_BITOPS_H */ diff --git a/xen/arch/x86/include/asm/bitops.h b/xen/arch/x86/include/asm/b= itops.h index 4c5b21907a64..507b043b8a86 100644 --- a/xen/arch/x86/include/asm/bitops.h +++ b/xen/arch/x86/include/asm/bitops.h @@ -482,6 +482,5 @@ static always_inline unsigned int arch_flsl(unsigned lo= ng x) * The Hamming Weight of a number is the total number of bits set in it. */ #define hweight64(x) generic_hweight64(x) -#define hweight32(x) generic_hweight32(x) =20 #endif /* _X86_BITOPS_H */ diff --git a/xen/include/xen/bitops.h b/xen/include/xen/bitops.h index 58c600155f7e..a462c3065158 100644 --- a/xen/include/xen/bitops.h +++ b/xen/include/xen/bitops.h @@ -326,6 +326,11 @@ static always_inline attr_const unsigned int hweightl(= unsigned long x) #endif } =20 +static always_inline attr_const unsigned int hweight32(uint32_t x) +{ + return hweightl(x); +} + /* --------------------- Please tidy below here --------------------- */ =20 #ifndef find_next_bit --=20 2.39.2