From: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
To: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>
Cc: Lucas De Marchi <lucas.demarchi@intel.com>,
Yury Norov <yury.norov@gmail.com>,
linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org,
Jani Nikula <jani.nikula@linux.intel.com>,
intel-xe@lists.freedesktop.org, intel-gfx@lists.freedesktop.org,
Jani Nikula <jani.nikula@intel.com>
Subject: Re: [PATCH v3 1/3] bits: introduce fixed-type genmasks
Date: Wed, 21 Feb 2024 23:04:22 +0200 [thread overview]
Message-ID: <ZdZlVn9BI-0q1Xdn@smile.fi.intel.com> (raw)
In-Reply-To: <CAA8EJpprfrtOjNzT6TFhV1n6MXzLdTahanfxcRW4uVjeHaBduA@mail.gmail.com>
On Wed, Feb 21, 2024 at 10:30:02PM +0200, Dmitry Baryshkov wrote:
> On Thu, 8 Feb 2024 at 09:45, Lucas De Marchi <lucas.demarchi@intel.com> wrote:
...
> > +#define BITS_PER_TYPE(type) (sizeof(type) * BITS_PER_BYTE)
Can sizeof() be used in assembly?
...
> > -#define __GENMASK(h, l) \
> > - (((~UL(0)) - (UL(1) << (l)) + 1) & \
> > - (~UL(0) >> (BITS_PER_LONG - 1 - (h))))
> > -#define GENMASK(h, l) \
> > - (GENMASK_INPUT_CHECK(h, l) + __GENMASK(h, l))
> > +#define __GENMASK(t, h, l) \
> > + (GENMASK_INPUT_CHECK(h, l) + \
> > + (((t)~0ULL - ((t)(1) << (l)) + 1) & \
> > + ((t)~0ULL >> (BITS_PER_TYPE(t) - 1 - (h)))))
Nevertheless, the use ~0ULL is not proper assembly, this broke initial
implementation using UL() / ULL().
> > -#define __GENMASK_ULL(h, l) \
> > - (((~ULL(0)) - (ULL(1) << (l)) + 1) & \
> > - (~ULL(0) >> (BITS_PER_LONG_LONG - 1 - (h))))
> > -#define GENMASK_ULL(h, l) \
> > - (GENMASK_INPUT_CHECK(h, l) + __GENMASK_ULL(h, l))
Ditto.
> > +#define GENMASK(h, l) __GENMASK(unsigned long, h, l)
> > +#define GENMASK_ULL(h, l) __GENMASK(unsigned long long, h, l)
> > +#define GENMASK_U8(h, l) __GENMASK(u8, h, l)
> > +#define GENMASK_U16(h, l) __GENMASK(u16, h, l)
> > +#define GENMASK_U32(h, l) __GENMASK(u32, h, l)
> > +#define GENMASK_U64(h, l) __GENMASK(u64, h, l)
>
> This breaks drm-tip on arm64 architecture:
>
> arch/arm64/kernel/entry-fpsimd.S: Assembler messages:
> 465arch/arm64/kernel/entry-fpsimd.S:271: Error: found 'l', expected: ')'
> 466arch/arm64/kernel/entry-fpsimd.S:66: Info: macro invoked from here
> 467arch/arm64/kernel/entry-fpsimd.S:271: Error: found 'l', expected: ')'
> 468arch/arm64/kernel/entry-fpsimd.S:66: Info: macro invoked from here
> 469arch/arm64/kernel/entry-fpsimd.S:271: Error: found 'l', expected: ')'
> 470arch/arm64/kernel/entry-fpsimd.S:66: Info: macro invoked from here
> 471arch/arm64/kernel/entry-fpsimd.S:271: Error: found 'l', expected: ')'
> 472arch/arm64/kernel/entry-fpsimd.S:66: Info: macro invoked from here
> 473arch/arm64/kernel/entry-fpsimd.S:271: Error: unexpected characters
> following instruction at operand 3 -- `bic x2,x1,(0+(((unsigned
> long)~0ULL-((unsigned long)(1)<<(0))+1)&((unsigned
> long)~0ULL>>((sizeof(unsigned long)*8)-1-(3)))))'
> 474arch/arm64/kernel/entry-fpsimd.S:66: Info: macro invoked from here
> 475arch/arm64/kernel/entry-fpsimd.S:282: Error: found 'l', expected: ')'
> 476arch/arm64/kernel/entry-fpsimd.S:98: Info: macro invoked from here
> 477arch/arm64/kernel/entry-fpsimd.S:282: Error: found 'l', expected: ')'
> 478arch/arm64/kernel/entry-fpsimd.S:98: Info: macro invoked from here
> 479arch/arm64/kernel/entry-fpsimd.S:282: Error: found 'l', expected: ')'
> 480arch/arm64/kernel/entry-fpsimd.S:98: Info: macro invoked from here
> 481arch/arm64/kernel/entry-fpsimd.S:282: Error: found 'l', expected: ')'
> 482arch/arm64/kernel/entry-fpsimd.S:98: Info: macro invoked from here
> 483arch/arm64/kernel/entry-fpsimd.S:282: Error: unexpected characters
> following instruction at operand 3 -- `bic x2,x1,(0+(((unsigned
> long)~0ULL-((unsigned long)(1)<<(0))+1)&((unsigned
> long)~0ULL>>((sizeof(unsigned long)*8)-1-(3)))))'
> 484arch/arm64/kernel/entry-fpsimd.S:98: Info: macro invoked from here
--
With Best Regards,
Andy Shevchenko
next prev parent reply other threads:[~2024-02-21 21:04 UTC|newest]
Thread overview: 34+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-08 7:45 [PATCH v3 0/3] Fixed-type GENMASK/BIT Lucas De Marchi
2024-02-08 7:45 ` [PATCH v3 1/3] bits: introduce fixed-type genmasks Lucas De Marchi
2024-02-08 19:48 ` Andi Shyti
2024-02-09 14:04 ` Andy Shevchenko
2024-02-21 20:30 ` Dmitry Baryshkov
2024-02-21 20:37 ` Dmitry Baryshkov
2024-02-21 21:06 ` Andy Shevchenko
2024-02-21 21:07 ` Andy Shevchenko
2024-02-21 21:04 ` Andy Shevchenko [this message]
2024-02-21 21:59 ` Lucas De Marchi
2024-02-22 14:49 ` Yury Norov
2024-02-22 15:04 ` Andy Shevchenko
2024-02-22 21:31 ` Yury Norov
2024-02-28 23:39 ` Lucas De Marchi
2024-02-29 10:49 ` Andy Shevchenko
2024-02-29 18:21 ` Lucas De Marchi
2024-02-29 18:27 ` Andy Shevchenko
2024-03-01 4:06 ` Lucas De Marchi
2024-03-07 21:45 ` Lucas De Marchi
2024-02-08 7:45 ` [PATCH v3 2/3] bits: Introduce fixed-type BIT Lucas De Marchi
2024-02-08 20:04 ` Andi Shyti
2024-02-08 21:17 ` Lucas De Marchi
2024-02-09 8:01 ` Jani Nikula
2024-02-10 14:22 ` David Laight
2024-02-09 16:53 ` Yury Norov
2024-02-20 5:13 ` Lucas De Marchi
2024-02-22 14:51 ` Yury Norov
2024-02-22 16:35 ` Lucas De Marchi
2024-02-08 7:45 ` [PATCH v3 3/3] drm/i915: Convert REG_GENMASK* to fixed-width GENMASK_* Lucas De Marchi
2024-02-08 8:49 ` Jani Nikula
2024-02-08 20:07 ` Andi Shyti
2024-02-08 21:21 ` Lucas De Marchi
2025-02-02 10:40 ` [PATCH v3 0/3] Fixed-type GENMASK/BIT Vincent Mailhol
2025-02-03 14:29 ` Lucas De Marchi
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=ZdZlVn9BI-0q1Xdn@smile.fi.intel.com \
--to=andriy.shevchenko@linux.intel.com \
--cc=dmitry.baryshkov@linaro.org \
--cc=dri-devel@lists.freedesktop.org \
--cc=intel-gfx@lists.freedesktop.org \
--cc=intel-xe@lists.freedesktop.org \
--cc=jani.nikula@intel.com \
--cc=jani.nikula@linux.intel.com \
--cc=linux-kernel@vger.kernel.org \
--cc=lucas.demarchi@intel.com \
--cc=yury.norov@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox