Mesa (master): nir/algebraic: Simplify max(abs(a), 0.0) -> abs(a)
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Tue Jun 4 20:08:10 UTC 2019
Module: Mesa
Branch: master
Commit: d2d3cc66cf3dfc181780154f69e47c81a08325a1
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=d2d3cc66cf3dfc181780154f69e47c81a08325a1
Author: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Date: Tue Jun 4 19:54:12 2019 +0000
nir/algebraic: Simplify max(abs(a), 0.0) -> abs(a)
This pattern was noticed in glmark's jellyfish scene.
v2: Add inexact qualifier due to NaN behaviour.
Minimal shader-db changes (slightly helped).
Signed-off-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Reviewed-by: Elie Tournier <tournier.elie at gmail.com>
---
src/compiler/nir/nir_opt_algebraic.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index 594f521a66b..d36131ae1ac 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -399,6 +399,7 @@ optimizations = [
(('imax', a, ('iabs', a)), ('iabs', a)),
(('fmax', a, ('fneg', a)), ('fabs', a)),
(('imax', a, ('ineg', a)), ('iabs', a)),
+ (('~fmax', ('fabs', a), 0.0), ('fabs', a)),
(('~fmin', ('fmax', a, 0.0), 1.0), ('fsat', a), '!options->lower_fsat'),
(('~fmax', ('fmin', a, 1.0), 0.0), ('fsat', a), '!options->lower_fsat'),
(('~fmin', ('fmax', a, -1.0), 0.0), ('fneg', ('fsat', ('fneg', a))), '!options->lower_negate && !options->lower_fsat'),
More information about the mesa-commit
mailing list