nir: Fix constant folding for non-32-bit ifind_msb and clz
Signed-off-by: Karol Herbst <kherbst@redhat.com> Reviewed-by: Alyssa Rosenzweig <alyssa@collabora.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16348>
This commit is contained in:

committed by
Marge Bot

parent
d98b82a103
commit
4b67d70d22
@@ -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.
|
||||
*/
|
||||
|
Reference in New Issue
Block a user