nir: remove special fp_math_ctrl rules

All opcodes should now respect the nan/inf/sz preserving flags.

Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig@intel.com>
Reviewed-by: Rhys Perry <pendingchaos02@gmail.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/39641>
This commit is contained in:
Georg Lehmann 2026-01-31 23:26:17 +01:00 committed by Marge Bot
parent e443229644
commit 63d199a01e
2 changed files with 5 additions and 13 deletions

View file

@ -1525,10 +1525,6 @@ typedef enum {
* it must ensure that the resulting value is bit-for-bit identical to the * it must ensure that the resulting value is bit-for-bit identical to the
* original, with the exception of undefindness allowed by other * original, with the exception of undefindness allowed by other
* nir_fp_math_control bits and NaN patterns. * nir_fp_math_control bits and NaN patterns.
*
* TODO This is currently also used to control NaN behavior of
* floating point comparisons and fmin/fmax/fsat.
* This should be changed to only depend on nir_fp_preserve_nan.
*/ */
nir_fp_exact = BITFIELD_BIT(3), nir_fp_exact = BITFIELD_BIT(3),

View file

@ -747,10 +747,8 @@ else if (nir_is_rounding_mode_rtz(execution_mode, 32))
else else
dst = src0 * src1; dst = src0 * src1;
""", description = """ """, description = """
Unlike :nir:alu-op:`fmul`, anything (even infinity or NaN) multiplied by zero is Unlike :nir:alu-op:`fmul`, anything (even infinity or NaN) multiplied by +/-0.0 is
always zero. ``fmulz(0.0, inf)`` and ``fmulz(0.0, nan)`` must be +/-0.0, even always +0.0.
if ``INF_PRESERVE/NAN_PRESERVE`` is not used. If ``SIGNED_ZERO_PRESERVE`` is
used, then the result must be a positive zero if either operand is zero.
""") """)
@ -1115,11 +1113,9 @@ else
""", description = """ """, description = """
Floating-point multiply-add with modified zero handling. Floating-point multiply-add with modified zero handling.
Unlike :nir:alu-op:`ffma`, anything (even infinity or NaN) multiplied by zero is Unlike :nir:alu-op:`ffma`, anything (even infinity or NaN) multiplied by +/-0.0 is
always zero. ``ffmaz(0.0, inf, src2)`` and ``ffmaz(0.0, nan, src2)`` must be +0.0. ``ffmaz(0.0, inf, src2)`` and ``ffmaz(0.0, nan, src2)`` must be
``+/-0.0 + src2``, even if ``INF_PRESERVE/NAN_PRESERVE`` is not used. If ``+0.0 + src2``.
``SIGNED_ZERO_PRESERVE`` is used, then the result must be a positive
zero plus src2 if either src0 or src1 is zero.
""") """)
triop("flrp", tfloat, "", "src0 * (1 - src2) + src1 * src2") triop("flrp", tfloat, "", "src0 * (1 - src2) + src1 * src2")