summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2017-08-28 15:05:11 -0700
committerJason Ekstrand <[email protected]>2017-10-12 22:39:29 -0700
commita0947921eb01f4c037de28b753fc10f86a25fc65 (patch)
tree1e9f105754c5fd9d683393942eda458861cece29 /src/compiler/nir
parentac3b73ac8dcf501ab704b274d67acd065fbd4348 (diff)
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 <[email protected]> Reviewed-by: Connor Abbott <[email protected]> Cc: [email protected]
Diffstat (limited to 'src/compiler/nir')
-rw-r--r--src/compiler/nir/nir_opcodes.py2
1 files changed, 1 insertions, 1 deletions
diff --git a/src/compiler/nir/nir_opcodes.py b/src/compiler/nir/nir_opcodes.py
index 06ae820c3e8..28a04672285 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;