diff --git a/src/compiler/nir/nir_opcodes.py b/src/compiler/nir/nir_opcodes.py index a604451d3df..a9fee18c361 100644 --- a/src/compiler/nir/nir_opcodes.py +++ b/src/compiler/nir/nir_opcodes.py @@ -480,12 +480,12 @@ for (bit = bit_size - 1; bit >= 0; bit--) { if ((src0 & (1u << bit)) != 0) break; } -dst = (unsigned)(31 - bit); +dst = (unsigned)(bit_size - bit - 1); """) unop("ifind_msb", tint32, """ dst = -1; -for (int bit = 31; bit >= 0; bit--) { +for (int bit = bit_size - 1; bit >= 0; bit--) { /* If src0 < 0, we're looking for the first 0 bit. * if src0 >= 0, we're looking for the first 1 bit. */