[Mesa-dev] [PATCH 3/8] nir: Add identities for the exponential function.

Matt Turner mattst88 at gmail.com
Thu Mar 26 12:27:03 PDT 2015


No changes in shader-db.
---
 src/glsl/nir/nir_opt_algebraic.py | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/src/glsl/nir/nir_opt_algebraic.py b/src/glsl/nir/nir_opt_algebraic.py
index 350a482..4fe4cc0 100644
--- a/src/glsl/nir/nir_opt_algebraic.py
+++ b/src/glsl/nir/nir_opt_algebraic.py
@@ -135,6 +135,12 @@ optimizations = [
    (('fpow', a, 1.0), a),
    (('fpow', a, 2.0), ('fmul', a, a)),
    (('fpow', 2.0, a), ('fexp2', a)),
+   (('fsqrt', ('fexp2', a)), ('fexp2', ('fmul', 0.5, a))),
+   (('fsqrt', ('fexp', a)), ('fexp', ('fmul', 0.5, a))),
+   (('frcp', ('fexp2', a)), ('fexp2', ('fneg', a))),
+   (('frcp', ('fexp', a)), ('fexp', ('fneg', a))),
+   (('frsq', ('fexp2', a)), ('fexp2', ('fmul', -0.5, a))),
+   (('frsq', ('fexp', a)), ('fexp', ('fmul', -0.5, a))),
    # Division and reciprocal
    (('fdiv', 1.0, a), ('frcp', a)),
    (('frcp', ('frcp', a)), a),
-- 
2.0.5



More information about the mesa-dev mailing list