nir/lower_alu: fix lower_fminmax_signed_zero for denorms

When both inputs are denorms, the bcsel picks the integer min/max result,
which does not flush denorms and therefore might return the wrong result.

Fixes OpenCL fmin/fmax on asahi.

Fixes: d238d766c6 ("nir: add lower_fminmax_signed_zero")
This commit is contained in:
Karol Herbst 2026-05-06 08:59:50 +02:00
parent 49c658972f
commit 82a31a7339

View file

@ -213,6 +213,7 @@ lower_alu_instr(nir_builder *b, nir_alu_instr *instr, UNUSED void *cb_data)
/* Fallback on the emulation */
if (!lowered) {
nir_def *iminmax = max ? nir_imax(b, s0, s1) : nir_imin(b, s0, s1);
iminmax = nir_fcanonicalize(b, iminmax);
lowered = nir_bcsel(b, nir_feq(b, s0, s1), iminmax, fminmax);
}