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 lists.ozlabs.org (lists.ozlabs.org [112.213.38.117]) (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 7E842CA0ED1 for ; Fri, 15 Aug 2025 16:42:13 +0000 (UTC) Received: from boromir.ozlabs.org (localhost [127.0.0.1]) by lists.ozlabs.org (Postfix) with ESMTP id 4c3SZD12Gdz3cj2; Sat, 16 Aug 2025 02:42:12 +1000 (AEST) Authentication-Results: lists.ozlabs.org; arc=none smtp.remote-ip=63.228.1.57 ARC-Seal: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1755276132; cv=none; b=fJI7KhH+ieyiq7LaoEx0PXEjJqaItj5hkYGycySSWkxfymefnCTKfjb6NEIHV33zhzHCfmQM4UExRIavPa7le9i3Nc48YG+m9Bc/IforUBt+iv2zUgHqjljkjHgNZzYrkjzJ43qGGYGErMQb9AN/UXkHiDur7+VOxmNbf6YOE5ZMwenny5oHuQSHx65uDLU4DU3lGBodwZ26qNJ52s+edmZM/E2sPkDbXBdFk4EXEGvdQRYYx7P3PTdjlwgycQnVU88lvF+GCMn3+iscAq6zyux9oYKCP7YK6rN65sOePhfft9ScjJSce37L4wkBLM3UMNILmcH9bQlnnA2acgPtMg== ARC-Message-Signature: i=1; a=rsa-sha256; d=lists.ozlabs.org; s=201707; t=1755276132; c=relaxed/relaxed; bh=BquL/1ipLaX4XWyjT/uo2tA/vPb810ovEmCNimzzD3g=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=KN802R9kRyScYth14oDzUj1W35HXPSUq47DGK0lMgrVhOW0e4VsbwORgqPmtd4sjxmhYQnpOeUSGFkB3zb2yT2dfwmRrvMn8u7JGUUl8YJuG5NV6DQ+G3kQo0k4D09d/EjK8T+mid6eQ5+yij6V5jSpvqT0FfHW42W8Lx6JVVBf/m5MIE9Y7ZA/bBaxcLh47gYuvNm5s1bgKJrePHi6D2mKi+6YuRL7qwjPygcytz+d7IVDgNcsYLGGPOk4eTTlic9vzTUQIzvOoVvPtf6hAviHppa/Y84JbFiKpaJXG4tD9aAHhXMOsBGD0ZukxhYHcs4PUHWEGCNV0KMqJYvZYpw== ARC-Authentication-Results: i=1; lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org; spf=pass (client-ip=63.228.1.57; helo=gate.crashing.org; envelope-from=segher@kernel.crashing.org; receiver=lists.ozlabs.org) smtp.mailfrom=kernel.crashing.org Authentication-Results: lists.ozlabs.org; dmarc=none (p=none dis=none) header.from=kernel.crashing.org Authentication-Results: lists.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=kernel.crashing.org (client-ip=63.228.1.57; helo=gate.crashing.org; envelope-from=segher@kernel.crashing.org; receiver=lists.ozlabs.org) Received: from gate.crashing.org (gate.crashing.org [63.228.1.57]) by lists.ozlabs.org (Postfix) with ESMTP id 4c3SZC2GM1z3chb for ; Sat, 16 Aug 2025 02:42:11 +1000 (AEST) 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 57FGg0P42568454; Fri, 15 Aug 2025 11:42:00 -0500 Received: (from segher@localhost) by gate.crashing.org (8.18.1/8.18.1/Submit) id 57FGfxjE2568453; Fri, 15 Aug 2025 11:41:59 -0500 X-Authentication-Warning: gate.crashing.org: segher set sender to segher@kernel.crashing.org using -f Date: Fri, 15 Aug 2025 11:41:59 -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> X-Mailing-List: linuxppc-dev@lists.ozlabs.org List-Id: List-Help: List-Owner: List-Post: List-Archive: , List-Subscribe: , , List-Unsubscribe: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: On Fri, Aug 15, 2025 at 11:34:56AM -0500, Segher Boessenkool wrote: > 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, Erm, 1992 actually, but stuff has moved around since then :-) > 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