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 8d19ffef0a ("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 <faith.ekstrand@collabora.com>
Reviewed-by: Mary Guillemard <mary@mary.zone>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37537>
This commit is contained in:
Mel Henning
2025-09-23 19:23:36 -04:00
committed by Marge Bot
parent 41a48f4109
commit ce1d0ae108
+2 -2
View File
@@ -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,