From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 76AEBC61D90 for ; Tue, 21 Nov 2023 14:56:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:Cc :To:From:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References: List-Owner; bh=Qn7SmbcqOE2hJiolCnhcRbSYIPF2eikCJ+o6aR0+qYk=; b=mXbUHlbDKy6x+0 Hg4xztemC6OjM2sVt0sIr2A1gTO2IOfVJHpJxZqRefSoyCIKWLYN6Hi9FuDLGkmZvMixjuuO5JDC2 0wBjuWPs8+ESXu1sqWqnnixS+/ldxep9C2CE0xbUECiTk7p3LP428V99hj+Um5NIPMNCLmQtALiy0 GOo8NbR7vCUMgNulxWB13Bub4dpd62yIRJJ1JwihXqXlFPzmnnWfEQAwm4qdnMz353lvRn+uB4CCs BTxjqciy3rh5Pu0S9wfe21UmN+iH26gheoWwIopU+C7kFNEVm2InuVxsner0XsG1vsaezIQBKuV0I CCSDzChlBMyD6MQ4t9EQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1r5SAl-00H5YW-2U; Tue, 21 Nov 2023 14:56:19 +0000 Received: from sin.source.kernel.org ([145.40.73.55]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1r5SAi-00H5Xr-14 for linux-riscv@lists.infradead.org; Tue, 21 Nov 2023 14:56:17 +0000 Received: from smtp.kernel.org (transwarp.subspace.kernel.org [100.75.92.58]) by sin.source.kernel.org (Postfix) with ESMTP id 61645CE1C46; Tue, 21 Nov 2023 14:56:13 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 598F7C433C8; Tue, 21 Nov 2023 14:56:11 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700578572; bh=goyE925j68b1sxQIGmM2p3n/Pv4DT5HZh2Zf6o8Dplk=; h=From:To:Cc:Subject:Date:From; b=Vb3OCJ/bzT++FdX+q066N3VO4wDu8sqSY6geuAKT9GNoRGC9D1r6P1G1TcZAA/I+f dr0Nv4SXyTP0TEH7MQWZjh3O8c8i3WguLumLdc2fnIHHKub12hMuywxBioal0TdnNg Ws1NOMoabop79fPpC4iO4jbBvpqDqz/n/DcR2366tYfx1M+7MIAJHgHBy9rT9nUJwJ GtUirmde6czIQGiAZ+n8cyktLgVq6A3bdVYp7fqhfjgIz8YMUnsBuDJEFgN9uUksxB BAW94RhNifuLk1BB3/hOw+gCG+0VZdKeWQvT8k712EKVWS/F7dTu8JsYlUppPuj0y1 FUKn9URfOxx/w== From: Jisheng Zhang To: Paul Walmsley , Palmer Dabbelt , Albert Ou Cc: linux-riscv@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH] riscv: select ARCH_HAS_FAST_MULTIPLIER Date: Tue, 21 Nov 2023 22:43:40 +0800 Message-Id: <20231121144340.3492-1-jszhang@kernel.org> X-Mailer: git-send-email 2.40.0 MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20231121_065616_627280_93C48095 X-CRM114-Status: UNSURE ( 8.75 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-riscv@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-riscv" Errors-To: linux-riscv-bounces+linux-riscv=archiver.kernel.org@lists.infradead.org Currently, riscv linux requires at least IMA, so all platforms have a multiplier. And I assume the 'mul' efficiency is comparable or better than a sequence of five or so register-dependent arithmetic instructions. Select ARCH_HAS_FAST_MULTIPLIER to get slightly nicer codegen. Refer to commit f9b4192923fa ("[PATCH] bitops: hweight() speedup") for more details. In a simple benchmark test calling hweight64() in a loop, it got: about 14% preformance improvement on JH7110, tested on Milkv Mars. about 23% performance improvement on TH1520 and SG2042, tested on Sipeed LPI4A and SG2042 platform. a slight performance drop on CV1800B, tested on milkv duo. Among all riscv platforms in my hands, this is the only one which sees a slight performance drop. It means the 'mul' isn't quick enough. However, the situation exists on x86 too, for example, P4 doesn't have fast integer multiplies as said in the above commit, x86 also selects ARCH_HAS_FAST_MULTIPLIER. So let's select ARCH_HAS_FAST_MULTIPLIER which can benefit almost riscv platforms. Signed-off-by: Jisheng Zhang --- arch/riscv/Kconfig | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/riscv/Kconfig b/arch/riscv/Kconfig index 95a2a06acc6a..e4834fa76417 100644 --- a/arch/riscv/Kconfig +++ b/arch/riscv/Kconfig @@ -23,6 +23,7 @@ config RISCV select ARCH_HAS_DEBUG_VIRTUAL if MMU select ARCH_HAS_DEBUG_VM_PGTABLE select ARCH_HAS_DEBUG_WX + select ARCH_HAS_FAST_MULTIPLIER select ARCH_HAS_FORTIFY_SOURCE select ARCH_HAS_GCOV_PROFILE_ALL select ARCH_HAS_GIGANTIC_PAGE -- 2.42.0 _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv