From 82a31a73395be97899a44e1eade710e544e40e27 Mon Sep 17 00:00:00 2001 From: Karol Herbst Date: Wed, 6 May 2026 08:59:50 +0200 Subject: [PATCH] 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: d238d766c64 ("nir: add lower_fminmax_signed_zero") --- src/compiler/nir/nir_lower_alu.c | 1 + 1 file changed, 1 insertion(+) diff --git a/src/compiler/nir/nir_lower_alu.c b/src/compiler/nir/nir_lower_alu.c index f22b789e7d5..7cad1e7f1a2 100644 --- a/src/compiler/nir/nir_lower_alu.c +++ b/src/compiler/nir/nir_lower_alu.c @@ -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); }