Mesa (master): nir: Add addition/multiplication identities of exp/log.
Matt Turner
mattst88 at kemper.freedesktop.org
Wed Apr 1 20:53:47 UTC 2015
Module: Mesa
Branch: master
Commit: a2b6e908cfa1b85bc3eed9d31869ec3768b3daa2
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=a2b6e908cfa1b85bc3eed9d31869ec3768b3daa2
Author: Matt Turner <mattst88 at gmail.com>
Date: Thu Mar 26 11:08:01 2015 -0700
nir: Add addition/multiplication identities of exp/log.
instructions in affected programs: 2858 -> 2808 (-1.75%)
helped: 12
Reviewed-by: Eric Anholt <eric at anholt.net>
---
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 185c291..3a3e6bf 100644
--- a/src/glsl/nir/nir_opt_algebraic.py
+++ b/src/glsl/nir/nir_opt_algebraic.py
@@ -153,6 +153,12 @@ optimizations = [
(('flog', ('frsq', a)), ('fmul', -0.5, ('flog', a))),
(('flog2', ('fpow', a, b)), ('fmul', b, ('flog2', a))),
(('flog', ('fpow', a, b)), ('fmul', b, ('flog', a))),
+ (('fadd', ('flog2', a), ('flog2', b)), ('flog2', ('fmul', a, b))),
+ (('fadd', ('flog', a), ('flog', b)), ('flog', ('fmul', a, b))),
+ (('fadd', ('flog2', a), ('fneg', ('flog2', b))), ('flog2', ('fdiv', a, b))),
+ (('fadd', ('flog', a), ('fneg', ('flog', b))), ('flog', ('fdiv', a, b))),
+ (('fmul', ('fexp2', a), ('fexp2', b)), ('fexp2', ('fadd', a, b))),
+ (('fmul', ('fexp', a), ('fexp', b)), ('fexp', ('fadd', a, b))),
# Division and reciprocal
(('fdiv', 1.0, a), ('frcp', a)),
(('frcp', ('frcp', a)), a),
More information about the mesa-commit
mailing list