From f4b858e746d07ca7ab03dbd149e855e4ae7e3898 Mon Sep 17 00:00:00 2001 From: Samuel Pitoiset Date: Tue, 24 Aug 2021 08:04:06 +0200 Subject: [PATCH] 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: --- 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). #