This lowering is smaller and -INT64_MIN is probably UB (signed overflow).
No fossil-db changes.
Signed-off-by: Rhys Perry <pendingchaos02@gmail.com>
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12039>
static nir_ssa_def *
build_idiv(nir_builder *b, nir_ssa_def *n, int64_t d)
{
+ int64_t int_min = u_intN_min(n->bit_size);
+ if (d == int_min)
+ return nir_b2i(b, nir_ieq_imm(b, n, int_min), n->bit_size);
+
uint64_t abs_d = d < 0 ? -d : d;
if (d == 0) {