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 52CD7CA0EE4 for ; Fri, 15 Aug 2025 18:12:45 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=GgqgPoadIoA1knj54jXlXZoqPHafTm6cU4C371MX59c=; b=SrYafXBKipwyBI kXcmXEvWSq2q1vqisjxiTiAtVtWKfUTZBMmBpiT+p1Hf2PBz64XWGP6J/ip59E5itYQUXPOTlHluu kTHXhlb7HEwJgTUg+Q/o20VNyMnXdtP43bYADvulewcNEqBKqnEAKfe2KY+dfDBXD9EjSB08V3P2S rGv+O3m8A67Vv9BAgXlZkN5r+qya4YZK1G0sKQxylaikjM4i53FJkt8FDGclBfcgr2pCGWh4c0w2C WxKiq64ChbMxHh0xbsKZdmKX3d7TRyYhBqt5xTzEY83aAUYZIUVGfSmokVHSK2N2+G/0XkjzWQZd0 woahSS706V4UWakPb7AA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1umyup-00000003DYq-33ry; Fri, 15 Aug 2025 18:12:35 +0000 Received: from gate.crashing.org ([63.228.1.57]) by bombadil.infradead.org with esmtp (Exim 4.98.2 #2 (Red Hat Linux)) id 1umxOY-00000002z4c-2ijq for linux-riscv@lists.infradead.org; Fri, 15 Aug 2025 16:35:11 +0000 Received: from gate.crashing.org (localhost [127.0.0.1]) by gate.crashing.org (8.18.1/8.18.1/Debian-2) with ESMTP id 57FGYuWM2568188; Fri, 15 Aug 2025 11:34:56 -0500 Received: (from segher@localhost) by gate.crashing.org (8.18.1/8.18.1/Submit) id 57FGYuon2568187; Fri, 15 Aug 2025 11:34:56 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Fri, 15 Aug 2025 11:34:56 -0500 From: Segher Boessenkool To: Madhavan Srinivasan Cc: Kees Cook , linux-arch@vger.kernel.org, linux-kernel@vger.kernel.org, x86@kernel.org, linux-alpha@vger.kernel.org, linux-csky@vger.kernel.org, linux-hexagon@vger.kernel.org, linux-m68k@vger.kernel.org, linux-mips@vger.kernel.org, linux-openrisc@vger.kernel.org, linux-parisc@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, llvm@lists.linux.dev, linux-hardening@vger.kernel.org Subject: Re: [PATCH 05/17] powerpc: Add __attribute_const__ to ffs()-family implementations Message-ID: References: <20250804163910.work.929-kees@kernel.org> <20250804164417.1612371-5-kees@kernel.org> <7f4f4d07-38f7-444c-adff-ec2a2387e86b@linux.ibm.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <7f4f4d07-38f7-444c-adff-ec2a2387e86b@linux.ibm.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20250815_093510_811378_EFCF0BF5 X-CRM114-Status: UNSURE ( 5.38 ) 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 Hi! On Thu, Aug 07, 2025 at 03:16:35PM +0530, Madhavan Srinivasan wrote: > making them eligible for compiler optimization. You can instead use GCC for this. __builtin_ffs () exists since 2003, and has this attribute built-in, as well as tens of other optimisations that the kernel thing misses. Of course using existing stuff instead of cobbling together something half working prevents you from having a lot of fun ;-) Segher _______________________________________________ linux-riscv mailing list linux-riscv@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-riscv