Mesa (main): Revert "nir/opt_algebraic: optimize fmax(-fmin(b, a), b) -> fmax(b, -a)"

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Tue Aug 24 09:21:23 UTC 2021


Module: Mesa
Branch: main
Commit: f4b858e746d07ca7ab03dbd149e855e4ae7e3898
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=f4b858e746d07ca7ab03dbd149e855e4ae7e3898

Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date:   Tue Aug 24 08:04:06 2021 +0200

Revert "nir/opt_algebraic: optimize fmax(-fmin(b, a), b) -> fmax(b, -a)"

This is wrong for negative values.

This reverts commit 07cd30ca293d1eb6980f69f330f9d182652cf902.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12515>

---

 src/compiler/nir/nir_opt_algebraic.py | 5 -----
 1 file changed, 5 deletions(-)

diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index 48129c9ce45..449f114da6b 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -652,11 +652,6 @@ optimizations.extend([
    # fmin(0.0, b)) while the right one is "b", so this optimization is inexact.
    (('~fmin', ('fsat', a), '#b(is_zero_to_one)'), ('fsat', ('fmin', a, b))),
 
-   # max(-min(b, a), b) -> max(b, -a)
-   # min(-max(b, a), b) -> min(-b, -a)
-   (('fmax', ('fneg', ('fmin', b, a)), b), ('fmax', b, ('fneg', a))),
-   (('fmin', ('fneg', ('fmax', b, a)), b), ('fmin', ('fneg', b), ('fneg', a))),
-
    # If a in [0,b] then b-a is also in [0,b].  Since b in [0,1], max(b-a, 0) =
    # fsat(b-a).
    #



More information about the mesa-commit mailing list