[Mesa-dev] [PATCH 9/9] nir: Recognize and reduce duplicated fsats.

Eric Anholt eric at anholt.net
Sun Feb 1 13:17:28 PST 2015


No effect on vc4 shader-db.
---
 src/glsl/nir/nir_opt_algebraic.py | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/glsl/nir/nir_opt_algebraic.py b/src/glsl/nir/nir_opt_algebraic.py
index 9542ef3..fc7e47c 100644
--- a/src/glsl/nir/nir_opt_algebraic.py
+++ b/src/glsl/nir/nir_opt_algebraic.py
@@ -83,8 +83,10 @@ optimizations = [
    (('feq', ('fadd', a, b), 0.0), ('feq', a, ('fneg', b))),
    (('fne', ('fadd', a, b), 0.0), ('fne', a, ('fneg', b))),
    (('fge', ('fneg', ('fabs', a)), 0.0), ('feq', a, 0.0)),
+   (('fsat', ('fsat', a)), ('fsat', a)),
    (('fmin', ('fmax', a, 0.0), 1.0), ('fsat', a), '!options->lower_fsat'),
    (('fsat', a), ('fmin', ('fmax', a, 0.0), 1.0), 'options->lower_fsat'),
+   (('fmin', ('fmax', ('fmin', ('fmax', a, 0.0), 1.0), 0.0), 1.0), ('fmin', ('fmax', a, 0.0), 1.0)),
    # Logical and bit operations
    (('fand', a, 0.0), 0.0),
    (('iand', a, a), a),
-- 
2.1.4



More information about the mesa-dev mailing list