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

This is wrong for negative values.

This reverts commit 07cd30ca29.

Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/12515>
This commit is contained in:
Samuel Pitoiset 2021-08-24 08:04:06 +02:00 committed by Marge Bot
parent a16f3963d3
commit f4b858e746

View file

@ -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).
#