nir/opcodes: Fix constant-folding of ufind_msb
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. Reviewed-by: Bas Nieuwenhuizen <bas@basnieuwenhuizen.nl> Reviewed-by: Connor Abbott <cwabbott0@gmail.com> Cc: mesa-stable@lists.freedesktop.org
This commit is contained in:
parent
ac3b73ac8d
commit
a0947921eb
|
@ -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;
|
||||
|
|
Loading…
Reference in New Issue