From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mailtransmit05.runbox.com (mailtransmit05.runbox.com [185.226.149.38]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 3BA3C224AF2 for ; Thu, 27 Nov 2025 18:52:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=185.226.149.38 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764269549; cv=none; b=bsqXszy9wRhejh0TAlFY54aP5MvWe+D0bDgOyBkYwaWGfN4Ba1nltPs/do7W8QEPjywqE2ssqtqfIEzh93g39CFpRGFOvaHcga5z5VZBXDKKKIo17w89Y002ZZlxgSS1HoiD+Zu9Mw67pfkD1rLDVuL8Zl0QUi+cuP/ruRMd0js= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1764269549; c=relaxed/simple; bh=I8GJB2jRFiaeeNr63sv7vBoIL+wTw92gRnwUCDlrK6k=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=aUioEbMHnv2kGxAR92COdbAOO/OG/SVIiGUfyfUOGIOlYR4SmWnAqZCaGoy49+zl0d2OpJbxDd2nyWJh3BVwReBzWJ4Bu0zVd4tZvpV5DfYGvqltmnB+gRDLEfGYT7cZfDn94QMuorWuVGJurg9PeWU+Kfnaz4PuMUSDmb23E8o= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=runbox.com; spf=pass smtp.mailfrom=runbox.com; dkim=pass (2048-bit key) header.d=runbox.com header.i=@runbox.com header.b=eik7yfGB; arc=none smtp.client-ip=185.226.149.38 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=runbox.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=runbox.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=runbox.com header.i=@runbox.com header.b="eik7yfGB" Received: from mailtransmit03.runbox ([10.9.9.163] helo=aibo.runbox.com) by mailtransmit05.runbox.com with esmtps (TLS1.2) tls TLS_ECDHE_RSA_WITH_AES_128_GCM_SHA256 (Exim 4.93) (envelope-from ) id 1vOh6A-00DPGD-J9; Thu, 27 Nov 2025 19:52:10 +0100 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=runbox.com; s=selector1; h=Content-Transfer-Encoding:Content-Type:MIME-Version: References:In-Reply-To:Message-ID:Subject:Cc:To:From:Date; bh=hcNwx+t1EzV4hDK8vzrQzd7oDIYc5sSWIIWkCxHOGL4=; b=eik7yfGBsAAYuK0QSY3X5hWLLt ksSbRMDIvoqKDli0out4es0tkjLmF0QSnpau3acvvkDT8DlEvZLDn6YWb0DLDZGTklEgMikfFTYZ3 7mDuwFaoO3dOdFRuiFoVyfZAWJmH8kREmdjjAEF2KZlZf+JWraO7zhV7ed9nor/OxcPsj2SWIEUIc lg7C99pKWI0dUq1flxLhfWzJzmL3PG4NkiTpf1CRjpADjtckkNwy/9LJLKn7Xu3wuX8i4O+6TgHxm 1s7cyRc59ICFmOO6Zg3khPXt263+UvSrXraWbfJK30SvMJtqFRNnScB9/3vqHgi0M/hY4Oo51KoYp L/sY2Sig==; Received: from [10.9.9.72] (helo=submission01.runbox) by mailtransmit03.runbox with esmtp (Exim 4.86_2) (envelope-from ) id 1vOh69-0002VS-Vf; Thu, 27 Nov 2025 19:52:10 +0100 Received: by submission01.runbox with esmtpsa [Authenticated ID (1493616)] (TLS1.2:ECDHE_SECP256R1__RSA_SHA256__AES_256_GCM:256) (Exim 4.93) id 1vOh5x-00GZVp-0K; Thu, 27 Nov 2025 19:51:57 +0100 Date: Thu, 27 Nov 2025 18:51:52 +0000 From: david laight To: Linus Torvalds Cc: Rasmus Villemoes , "Yury Norov (NVIDIA)" , Linus Walleij , Nicolas Frattaroli , linux-kernel@vger.kernel.org Subject: Re: [PATCH 00/21] lib: add alternatives for GENMASK() Message-ID: <20251127185152.4f0c5288@pumpkin> In-Reply-To: <20251126221718.6c595c57@pumpkin> References: <20251025164023.308884-1-yury.norov@gmail.com> <87ldjtuppl.fsf@prevas.dk> <20251126221718.6c595c57@pumpkin> X-Mailer: Claws Mail 4.1.1 (GTK 3.24.38; arm-unknown-linux-gnueabihf) Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit On Wed, 26 Nov 2025 22:17:18 +0000 david laight wrote: ... > Both FIELD_PREP/GET(GENMASK(), v) are about 18k plus three copies of v. > FIELD_GET(mask,v) has 18 expansions of 'mask'. All the FIELD_XXX() are already statement expressions. I think that means they should 'just work' if the parameters are copied to locals - annoyingly there are a few bitfields... Even after that a shed-load (or two) of bloat comes from __BF_FIELD_CHECK(). Not helped by expanding pointless checks because the same define is used lots of times. I'm not really sure the expensive test that uses __bf_cast_unsigned() is actually worth doing - unless a trivial equivalent can be found. Actually the 'mask' side can just be 'mask + 0u + 0ul + 0ull' which zero-extends 'mask'; the other just '~0ull >> (64 - sizeof(_reg) * 8)'. I see a patch lurking... David