intel/nir_opt_peephole_ffma: fix fp_math_ctlr for modifiers

If abs/neg don't preserve nan/inf/sz, the whole expressions won't.

Fixes: 1b0808adf3 ("intel/nir: Make ffma peephole optimization preserve fp_fast_math flags")
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/41101>
This commit is contained in:
Georg Lehmann 2026-04-22 15:04:31 +02:00 committed by Marge Bot
parent bdaf8b6b39
commit 26ec32dada

View file

@ -191,6 +191,7 @@ intel_nir_opt_peephole_ffma_instr(nir_builder *b,
}
b->cursor = nir_before_instr(&add->instr);
b->fp_math_ctrl = mul->fp_math_ctrl | add->fp_math_ctrl;
if (abs) {
for (unsigned i = 0; i < 2; i++)
@ -201,7 +202,7 @@ intel_nir_opt_peephole_ffma_instr(nir_builder *b,
mul_src[0] = nir_fneg(b, mul_src[0]);
nir_alu_instr *ffma = nir_alu_instr_create(b->shader, nir_op_ffma);
ffma->fp_math_ctrl = mul->fp_math_ctrl | add->fp_math_ctrl;
ffma->fp_math_ctrl = b->fp_math_ctrl;
for (unsigned i = 0; i < 2; i++) {
ffma->src[i].src = nir_src_for_ssa(mul_src[i]);