mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2025-12-25 02:10:11 +01:00
nir/lower_int64: fix find_lsb(0)
If the high 32 bits were zero, this would be umin(find_lsb(lo), 31). This
evaluates to 31 if lo is also zero, instead of -1.
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Fixes: 9293d8e64b ("nir: Add find_lsb lowering to nir_lower_int64.")
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/25409>
This commit is contained in:
parent
e90f9d8e21
commit
bcdac65ca3
1 changed files with 4 additions and 1 deletions
|
|
@ -713,8 +713,11 @@ lower_find_lsb64(nir_builder *b, nir_def *x)
|
|||
|
||||
/* Use umin so that -1 (no bits found) becomes larger (0xFFFFFFFF)
|
||||
* than any actual bit position, so we return a found bit instead.
|
||||
* This is similar to the ufind_msb lowering. If you need this lowering
|
||||
* without uadd_sat, add code like in lower_ufind_msb64.
|
||||
*/
|
||||
return nir_umin(b, lo_lsb, nir_iadd_imm(b, hi_lsb, 32));
|
||||
assert(!b->shader->options->lower_uadd_sat);
|
||||
return nir_umin(b, lo_lsb, nir_uadd_sat(b, hi_lsb, nir_imm_int(b, 32)));
|
||||
}
|
||||
|
||||
static nir_def *
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue