[Mesa-stable] [Mesa-dev] [PATCH] nir/opcodes: Fix constant-folding of ufind_msb
Connor Abbott
cwabbott0 at gmail.com
Tue Aug 29 01:27:28 UTC 2017
Reviewed-by: Connor Abbott <cwabbott0 at gmail.com>
On Aug 28, 2017 11:11 PM, "Jason Ekstrand" <jason at jlekstrand.net> wrote:
> We didn't fold correctly in the case of 0x1 because we never let the
> loop counter hit 0. Switching it to bit >= 0 solves this problem.
>
> Cc: mesa-stable at lists.freedesktop.org
> ---
> src/compiler/nir/nir_opcodes.py | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/src/compiler/nir/nir_opcodes.py b/src/compiler/nir/nir_
> opcodes.py
> index 39c01a7..a64a28e 100644
> --- a/src/compiler/nir/nir_opcodes.py
> +++ b/src/compiler/nir/nir_opcodes.py
> @@ -308,7 +308,7 @@ for (unsigned bit = 0; bit < 32; bit++) {
>
> unop_convert("ufind_msb", tint32, tuint32, """
> dst = -1;
> -for (int bit = 31; bit > 0; bit--) {
> +for (int bit = 31; bit >= 0; bit--) {
> if ((src0 >> bit) & 1) {
> dst = bit;
> break;
> --
> 2.5.0.400.gff86faf
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/mesa-stable/attachments/20170828/540ba42e/attachment-0001.html>
More information about the mesa-stable
mailing list