[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250306192331.2701a029@pumpkin>
Date: Thu, 6 Mar 2025 19:23:31 +0000
From: David Laight <david.laight.linux@...il.com>
To: Vincent Mailhol via B4 Relay
<devnull+mailhol.vincent.wanadoo.fr@...nel.org>
Cc: mailhol.vincent@...adoo.fr, Yury Norov <yury.norov@...il.com>, Lucas De
Marchi <lucas.demarchi@...el.com>, Rasmus Villemoes
<linux@...musvillemoes.dk>, Jani Nikula <jani.nikula@...ux.intel.com>,
Joonas Lahtinen <joonas.lahtinen@...ux.intel.com>, Rodrigo Vivi
<rodrigo.vivi@...el.com>, Tvrtko Ursulin <tursulin@...ulin.net>, David
Airlie <airlied@...il.com>, Simona Vetter <simona@...ll.ch>, Andrew Morton
<akpm@...ux-foundation.org>, linux-kernel@...r.kernel.org,
intel-gfx@...ts.freedesktop.org, dri-devel@...ts.freedesktop.org, Andi
Shyti <andi.shyti@...ux.intel.com>, David Laight <David.Laight@...LAB.COM>,
Dmitry Baryshkov <dmitry.baryshkov@...aro.org>, Andy Shevchenko
<andriy.shevchenko@...ux.intel.com>
Subject: Re: [PATCH v5 1/7] bits: split the definition of the asm and
non-asm GENMASK()
On Thu, 06 Mar 2025 20:29:52 +0900
Vincent Mailhol via B4 Relay <devnull+mailhol.vincent.wanadoo.fr@...nel.org> wrote:
> From: Vincent Mailhol <mailhol.vincent@...adoo.fr>
>
> In an upcoming change, GENMASK() and its friends will indirectly
> depend on sizeof() which is not available in asm.
>
> Instead of adding further complexity to __GENMASK() to make it work
> for both asm and non asm, just split the definition of the two
> variants.
...
> +#else /* defined(__ASSEMBLY__) */
> +
> +#define GENMASK(h, l) __GENMASK(h, l)
> +#define GENMASK_ULL(h, l) __GENMASK_ULL(h, l)
What do those actually expand to now?
As I've said a few times both UL(0) and ULL(0) are just (0) for __ASSEMBLY__
so the expansions of __GENMASK() and __GENMASK_ULL() contained the
same numeric constants.
This means they should be generating the same values.
I don't know the correct 'sizeof (int_type)' for the shift right of ~0.
My suspicion is that a 32bit assembler used 32bit signed integers and a
64bit one 64bit signed integers (but a 32bit asm on a 64bit host might
be 64bit).
So the asm versions need to avoid the right shift and only do left shifts.
Which probably means they need to be enirely separate from the C versions.
And then the C ones can have all the ULL() removed.
David
> +
> +#endif /* !defined(__ASSEMBLY__) */
>
> #endif /* __LINUX_BITS_H */
>
Powered by blists - more mailing lists