summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2015-03-26 10:16:24 -0700
committerMatt Turner <[email protected]>2015-04-01 13:43:57 -0700
commit8a6ae384b2ae95f047e9d48a5a4c11002ffdd814 (patch)
tree258202d011e9c1a02f85ca60efa1e3c325deb41d
parente26783d4459583790e50e1f59eb2507f618695c6 (diff)
nir: Add identities for the exponential function.
No changes in shader-db. Reviewed-by: Eric Anholt <[email protected]>
-rw-r--r--src/glsl/nir/nir_opt_algebraic.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/glsl/nir/nir_opt_algebraic.py b/src/glsl/nir/nir_opt_algebraic.py
index 5b84a4e1cd8..db2fe037206 100644
--- a/src/glsl/nir/nir_opt_algebraic.py
+++ b/src/glsl/nir/nir_opt_algebraic.py
@@ -139,6 +139,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),