From patchwork Fri Oct 28 16:47:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Russell King (Oracle)" X-Patchwork-Id: 13024056 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 BF44EECAAA1 for ; Fri, 28 Oct 2022 16:51:15 +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:Date:Message-Id:MIME-Version:Subject:Cc :To:From:References:In-Reply-To:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=aWg3gAigeV4nU5r8n8OSxUVZzSJzLUMS7H1OEXsm/iU=; b=dbmRBpOf8dvmq5 VbyZhD2Xdcw4eyZ7Yz7j9BLbqCVDSFIHjENy5PR3JZQAN4dNtsg53+TaWMnWNzdyU6EuXHMe0k5yz zeviwJf0z9rOdiGy6Je85ZdNAf5KzdZRkip81wNWA64Sn1qjU85eEKLvhr8Hr/U+9HVw0fjwY2r5Q z6IXRwf0GrCEWyZ+nI5qZD4Z/accvuGefDurko+OYp67FvswYjPh+4KSni1PjJglXsy/6gSQR74fu XCz/n64qRYCiFJnyJ0NBjKPDowlcKZQ+HRgBdubSbdPAx2k1iI2lT1eZDfWT8sMaGdje5v9+dt7DP uhpYnW1Dr3rC9yRMDFTA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1ooSYi-0011oO-IZ; Fri, 28 Oct 2022 16:50:16 +0000 Received: from pandora.armlinux.org.uk ([2001:4d48:ad52:32c8:5054:ff:fe00:142]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1ooSYV-0010zS-AN for linux-arm-kernel@lists.infradead.org; Fri, 28 Oct 2022 16:50:04 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=armlinux.org.uk; s=pandora-2019; h=Date:Sender:Message-Id:Content-Type: Content-Transfer-Encoding:MIME-Version:Subject:Cc:To:From:References: In-Reply-To:Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Id:List-Help: List-Unsubscribe:List-Subscribe:List-Post:List-Owner:List-Archive; bh=noL9/NeDUTGkTM9TkwKb+qB4g92MFSxxMDGz/3I26JY=; b=tTloeFQWZ0uoDO5GJamaoriva2 cIFPvVdZJsD4tqdlzlbICcPKZ7oX/ZY+D14hvxMfOE+WoHtE30EY66VVrh/WS/z13sIo3uWCMbyhm QFC5lsr6yq8M4lpXjTYjcE3JU8CqnfGeT5tHIKgpxxDcVg2Ghhh3Tym6zM4wrXQcWLclX501T6R3a mTs50+ZSY4ziba5+FuQlDKf2TEPIf9Ma+dnc18tsVY8VcD2LA+scbJScXjkglrg8bvjKMuh6tkJlc 3+QIcPkgxg85h+O+Pp1gzgO67hoiR1tQ1WjteSZI3bKACJ8dzRr1Q5+RLw2WitLDyWA4d7OGa9Dn7 bHS7g84Q==; Received: from e0022681537dd.dyn.armlinux.org.uk ([fd8f:7570:feb6:1:222:68ff:fe15:37dd]:55696 helo=rmk-PC.armlinux.org.uk) by pandora.armlinux.org.uk with esmtpsa (TLS1.3) tls TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384 (Exim 4.94.2) (envelope-from ) id 1ooSWU-00006h-RW; Fri, 28 Oct 2022 17:47:58 +0100 Received: from rmk by rmk-PC.armlinux.org.uk with local (Exim 4.94.2) (envelope-from ) id 1ooSWU-000FE4-9D; Fri, 28 Oct 2022 17:47:58 +0100 In-Reply-To: References: From: "Russell King (Oracle)" To: Yury Norov Cc: Catalin Marinas , Mark Rutland , Will Deacon , Linux Kernel Mailing List , Linus Torvalds , linux-arm-kernel@lists.infradead.org Subject: [PATCH 2/5] ARM: findbit: provide more efficient ARMv7 implementation MIME-Version: 1.0 Content-Disposition: inline Message-Id: Date: Fri, 28 Oct 2022 17:47:58 +0100 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221028_095003_391050_2E25707D X-CRM114-Status: UNSURE ( 9.86 ) X-CRM114-Notice: Please train this message. X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Provide a more efficient ARMv7 implementation to determine the first set bit in the supplied value. Signed-off-by: Russell King (Oracle) --- arch/arm/lib/findbit.S | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/arch/arm/lib/findbit.S b/arch/arm/lib/findbit.S index 4c584bc4704b..256e095d490b 100644 --- a/arch/arm/lib/findbit.S +++ b/arch/arm/lib/findbit.S @@ -170,7 +170,11 @@ ENDPROC(_find_next_bit_be) * One or more bits in the LSB of r3 are assumed to be set. */ .L_found: -#if __LINUX_ARM_ARCH__ >= 5 +#if __LINUX_ARM_ARCH__ >= 7 + rbit r3, r3 @ reverse bits + clz r3, r3 @ count high zero bits + add r0, r2, r3 @ add offset of first set bit +#elif __LINUX_ARM_ARCH__ >= 5 rsb r0, r3, #0 and r3, r3, r0 @ mask out lowest bit set clz r3, r3 @ count high zero bits