From ce1d0ae10842bf33dfaf0a82fd04048d7a95199c Mon Sep 17 00:00:00 2001 From: Mel Henning Date: Tue, 23 Sep 2025 19:23:36 -0400 Subject: [PATCH] nak: Don't copy-prop adds that flush to zero Adding zero has the effect of flushing to zero when ftz is set. This fixes a regression in dEQP-VK.spirv_assembly.instruction.compute.float_controls.fp32.input_args.reflect_denorm_flush_to_zero An add.ftz changes one of its arguments to negative rather than positive zero starting in 8d19ffef0a9 ("nir: Add more matches for `fmulz`") on that test, which was then triggering copy-prop which brought this issue to light. Closes: https://gitlab.freedesktop.org/mesa/mesa/-/issues/13961 Fixes: 29bfdcd7 ("nak: Add an ftz bit to a bunch of float ops") Reviewed-by: Faith Ekstrand Reviewed-by: Mary Guillemard Part-of: --- src/nouveau/compiler/nak/opt_copy_prop.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/nouveau/compiler/nak/opt_copy_prop.rs b/src/nouveau/compiler/nak/opt_copy_prop.rs index c8bc47667f6..826013e1a9d 100644 --- a/src/nouveau/compiler/nak/opt_copy_prop.rs +++ b/src/nouveau/compiler/nak/opt_copy_prop.rs @@ -495,7 +495,7 @@ impl<'a> CopyPropPass<'a> { assert!(dst.comps() == 1); let dst = dst[0]; - if !add.saturate { + if !add.saturate && !add.ftz { if add.srcs[0].is_fneg_zero(SrcType::F16v2) { self.add_copy( bi, @@ -518,7 +518,7 @@ impl<'a> CopyPropPass<'a> { assert!(dst.comps() == 1); let dst = dst[0]; - if !add.saturate { + if !add.saturate && !add.ftz { if add.srcs[0].is_fneg_zero(SrcType::F32) { self.add_copy( bi,