[Mesa-dev] [PATCH 01/22] nir/algebraic: Be more careful converting ushr to extract_u8/16
Jason Ekstrand
jason at jlekstrand.net
Fri Aug 17 22:49:12 UTC 2018
On Fri, Aug 17, 2018 at 5:27 PM Bas Nieuwenhuizen <bas at basnieuwenhuizen.nl>
wrote:
> On Fri, Aug 17, 2018 at 10:06 PM, Jason Ekstrand <jason at jlekstrand.net>
> wrote:
> > If it's not the right bit-size, it may not actually be the correct
> > extraction. For now, we'll only worry about 32-bit versions.
> >
> > Fixes: 905ff8619824 "nir: Recognize open-coded extract_u16"
> > Fixes: 76289fbfa84a "nir: Recognize open-coded extract_u8"
> > ---
> > src/compiler/nir/nir_opt_algebraic.py | 4 ++--
> > 1 file changed, 2 insertions(+), 2 deletions(-)
> >
> > diff --git a/src/compiler/nir/nir_opt_algebraic.py
> b/src/compiler/nir/nir_opt_algebraic.py
> > index e770a61d9ff..28090d069cd 100644
> > --- a/src/compiler/nir/nir_opt_algebraic.py
> > +++ b/src/compiler/nir/nir_opt_algebraic.py
> > @@ -543,13 +543,13 @@ optimizations = [
> > ('unpack_64_2x32_split_y', a)), a),
> >
> > # Byte extraction
> > - (('ushr', a, 24), ('extract_u8', a, 3),
> '!options->lower_extract_byte'),
> > + (('ushr', 'a at 32', 24), ('extract_u8', a, 3),
> '!options->lower_extract_byte'),
> > (('iand', 0xff, ('ushr', a, 16)), ('extract_u8', a, 2),
> '!options->lower_extract_byte'),
> > (('iand', 0xff, ('ushr', a, 8)), ('extract_u8', a, 1),
> '!options->lower_extract_byte'),
> > (('iand', 0xff, a), ('extract_u8', a, 0),
> '!options->lower_extract_byte'),
> >
> > # Word extraction
> > - (('ushr', a, 16), ('extract_u16', a, 1),
> '!options->lower_extract_word'),
> > + (('ushr', 'a at 16', 16), ('extract_u16', a, 1),
> '!options->lower_extract_word'),
>
> This @16 is the argument size here right? a (uint16_t) shifted right b
> 16 is 0, are you sure this does not need to be @32?
>
Right. I'll fix it quick.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-dev/attachments/20180817/94dc95cc/attachment.html>
More information about the mesa-dev
mailing list