<div dir="ltr"><div class="gmail_quote"><div dir="ltr">On Fri, Aug 17, 2018 at 5:27 PM Bas Nieuwenhuizen <<a href="mailto:bas@basnieuwenhuizen.nl">bas@basnieuwenhuizen.nl</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">On Fri, Aug 17, 2018 at 10:06 PM, Jason Ekstrand <<a href="mailto:jason@jlekstrand.net" target="_blank">jason@jlekstrand.net</a>> wrote:<br>
> If it's not the right bit-size, it may not actually be the correct<br>
> extraction.  For now, we'll only worry about 32-bit versions.<br>
><br>
> Fixes: 905ff8619824 "nir: Recognize open-coded extract_u16"<br>
> Fixes: 76289fbfa84a "nir: Recognize open-coded extract_u8"<br>
> ---<br>
>  src/compiler/nir/nir_opt_algebraic.py | 4 ++--<br>
>  1 file changed, 2 insertions(+), 2 deletions(-)<br>
><br>
> diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py<br>
> index e770a61d9ff..28090d069cd 100644<br>
> --- a/src/compiler/nir/nir_opt_algebraic.py<br>
> +++ b/src/compiler/nir/nir_opt_algebraic.py<br>
> @@ -543,13 +543,13 @@ optimizations = [<br>
>                             ('unpack_64_2x32_split_y', a)), a),<br>
><br>
>     # Byte extraction<br>
> -   (('ushr', a, 24), ('extract_u8', a, 3), '!options->lower_extract_byte'),<br>
> +   (('ushr', 'a@32', 24), ('extract_u8', a, 3), '!options->lower_extract_byte'),<br>
>     (('iand', 0xff, ('ushr', a, 16)), ('extract_u8', a, 2), '!options->lower_extract_byte'),<br>
>     (('iand', 0xff, ('ushr', a,  8)), ('extract_u8', a, 1), '!options->lower_extract_byte'),<br>
>     (('iand', 0xff, a), ('extract_u8', a, 0), '!options->lower_extract_byte'),<br>
><br>
>      # Word extraction<br>
> -   (('ushr', a, 16), ('extract_u16', a, 1), '!options->lower_extract_word'),<br>
> +   (('ushr', 'a@16', 16), ('extract_u16', a, 1), '!options->lower_extract_word'),<br>
<br>
This @16 is the argument size here right? a (uint16_t) shifted right b<br>
16 is 0, are you sure this does not need to be @32?<br></blockquote><div><br></div><div>Right.  I'll fix it quick. <br></div></div></div>