mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-07 13:38:06 +02:00
nir/uub: guard against division by 0
Fixes:8ee5440073("nir/uub: improve ishl/imul with constant sources") Reviewed-by: Konstantin Seurer <konstantin.seurer@gmail.com> Reviewed-by: Karol Herbst <kherbst@redhat.com> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36805> (cherry picked from commitde3d04dd72)
This commit is contained in:
parent
dbdb297b3d
commit
e016f3ff19
2 changed files with 3 additions and 3 deletions
|
|
@ -1134,7 +1134,7 @@
|
|||
"description": "nir/uub: guard against division by 0",
|
||||
"nominated": true,
|
||||
"nomination_type": 2,
|
||||
"resolution": 0,
|
||||
"resolution": 1,
|
||||
"main_sha": null,
|
||||
"because_sha": "8ee54400733f1f26e175c0065ad69e6a49402969",
|
||||
"notes": null
|
||||
|
|
|
|||
|
|
@ -1895,10 +1895,10 @@ get_alu_uub(struct analysis_state *state, struct uub_query q, uint32_t *result,
|
|||
nir_scalar src1_scalar = nir_scalar_chase_alu_src(q.scalar, 1);
|
||||
if (nir_scalar_is_const(src0_scalar)) {
|
||||
uint32_t const_val = nir_scalar_as_uint(src0_scalar);
|
||||
*result = MIN2(*result, max / const_val * const_val);
|
||||
*result = const_val ? MIN2(*result, max / const_val * const_val) : 0;
|
||||
} else if (nir_scalar_is_const(src1_scalar)) {
|
||||
uint32_t const_val = nir_scalar_as_uint(src1_scalar);
|
||||
*result = MIN2(*result, max / const_val * const_val);
|
||||
*result = const_val ? MIN2(*result, max / const_val * const_val) : 0;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue