intel/nir: Make ffma peephole optimization preserve fp_fast_math flags

float_controls2 may have marked these as needing to preserve NaN or
other values.  If so, our newly contracted ffma needs to as well.

Fixes dEQP-VK.spirv_assembly.instruction.compute.float_controls2.*.input_args.mat_det_testedWithout_NotNan*
when nir_opt_algebraic is run after this pass.

Cc: mesa-stable
Reviewed-by: Ian Romanick <ian.d.romanick@intel.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/36750>
This commit is contained in:
Kenneth Graunke 2025-09-15 13:49:46 -07:00 committed by Marge Bot
parent 25cb6dfbf7
commit 1b0808adf3

View file

@ -224,6 +224,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_fast_math = mul->fp_fast_math | add->fp_fast_math;
for (unsigned i = 0; i < 2; i++) {
ffma->src[i].src = nir_src_for_ssa(mul_src[i]);