[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20251127185152.4f0c5288@pumpkin>
Date: Thu, 27 Nov 2025 18:51:52 +0000
From: david laight <david.laight@...box.com>
To: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Rasmus Villemoes <ravi@...vas.dk>, "Yury Norov (NVIDIA)"
<yury.norov@...il.com>, Linus Walleij <linus.walleij@...aro.org>, Nicolas
Frattaroli <nicolas.frattaroli@...labora.com>, linux-kernel@...r.kernel.org
Subject: Re: [PATCH 00/21] lib: add alternatives for GENMASK()
On Wed, 26 Nov 2025 22:17:18 +0000
david laight <david.laight@...box.com> 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
Powered by blists - more mailing lists