Received: by 2002:a05:6358:1087:b0:cb:c9d3:cd90 with SMTP id j7csp2725739rwi; Fri, 28 Oct 2022 10:24:54 -0700 (PDT) X-Google-Smtp-Source: AMsMyM7nq4cvi3SSxutr29HcnC4lZq34QO0k0YDihvtmcBvcObLu+0ADQNUs/5aiBrkLyYTYmavq X-Received: by 2002:a63:ea04:0:b0:43a:b17f:cd12 with SMTP id c4-20020a63ea04000000b0043ab17fcd12mr490748pgi.109.1666977893992; Fri, 28 Oct 2022 10:24:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1666977893; cv=none; d=google.com; s=arc-20160816; b=UQewv8vBw6/6w1TTcOoXg6e1SSSNByqFyRNQqmISODhutDdCWjmlIDSvGywOWhqjZS 57NeIxvDNyMR02MJbNoW1XLRhKu2CCAk9EL9OGSKGGnVnTMsWHbS/p3jUOZik6IhH2ow uXbAkQ9/5GBDVb07hZ5LmlReRrHEOxwmrX3fVm7eedpQSuO9aCQ24jpG6OHefzuy4sof 8zWkkjv/LNWCaqK8/Yc6t01NHqnZmhveHitsqQcmRDcND2heLhl3w8D8kfqI94lnMEto B8Nis5fdhqu15vlGY3/o9qMFwdXXIPN8B1b9zpb6+Ts08tc6afaHNF7tC6UssJgCqpDR mEGQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:date:sender:message-id:content-transfer-encoding :content-disposition:mime-version:subject:cc:to:from:references :in-reply-to:dkim-signature; bh=noL9/NeDUTGkTM9TkwKb+qB4g92MFSxxMDGz/3I26JY=; b=jSnF+Z4bKIFXNrKCeHk4RqHygUgoi2o4ogNtYEMJX0rEBcEqKD1vea3LqmcvL+dj2Y qxMpsoNMW+8MU2yfiL8QkMKzw5HWjScZZ2E887DNUgelpLMh5be5140u8LDDCaAP2cMG xGb5soYbJTeFS2DzolUKUF1IhiQaAu8fYfc4eqXKSF5bOpOTHC4nJQY2nV9toWa+rDty Ri1LdzqOIh+5gReSxq9abGAQ8Rv4x7i/A3Jm68P1WbYgJcRYd/3ykarzMY99P7C97YLg +7yPhDTJkXHzM7HSV8QPMOsrQiU/OjtbGsbQnJntJrI1uGqd86yxINzDfYTGU9uMAgV3 0XOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=tTloeFQW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id o21-20020a63f155000000b0045f83471400si5366815pgk.328.2022.10.28.10.24.41; Fri, 28 Oct 2022 10:24:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=fail (test mode) header.i=@armlinux.org.uk header.s=pandora-2019 header.b=tTloeFQW; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=armlinux.org.uk Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229970AbiJ1QsE (ORCPT + 99 others); Fri, 28 Oct 2022 12:48:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:39108 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229988AbiJ1QsB (ORCPT ); Fri, 28 Oct 2022 12:48:01 -0400 Received: from pandora.armlinux.org.uk (pandora.armlinux.org.uk [IPv6:2001:4d48:ad52:32c8:5054:ff:fe00:142]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0E141EEF01 for ; Fri, 28 Oct 2022 09:48:00 -0700 (PDT) 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 Content-Transfer-Encoding: 8bit Content-Type: text/plain; charset="utf-8" Message-Id: Sender: Russell King Date: Fri, 28 Oct 2022 17:47:58 +0100 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,SPF_HELO_NONE,SPF_NONE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 -- 2.30.2