Mesa (master): nir: Add lowering of POW instructions if the lower flag is set.
Eric Anholt
anholt at kemper.freedesktop.org
Wed Feb 18 22:57:23 UTC 2015
Module: Mesa
Branch: master
Commit: ccf14bca4b892a0dffa1d8c244bfabe384d70f98
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=ccf14bca4b892a0dffa1d8c244bfabe384d70f98
Author: Eric Anholt <eric at anholt.net>
Date: Wed Jan 28 10:32:57 2015 -0800
nir: Add lowering of POW instructions if the lower flag is set.
This could be done in a separate pass like we do in GLSL IR, but it seems
to me like having the definitions of the transformations in the two
directions next to each other makes a lot of sense.
v2: Reorder the comment about the transformation.
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>
---
src/glsl/nir/nir_opt_algebraic.py | 1 +
1 file changed, 1 insertion(+)
diff --git a/src/glsl/nir/nir_opt_algebraic.py b/src/glsl/nir/nir_opt_algebraic.py
index 76917f5..b8b28f1 100644
--- a/src/glsl/nir/nir_opt_algebraic.py
+++ b/src/glsl/nir/nir_opt_algebraic.py
@@ -118,6 +118,7 @@ optimizations = [
(('fexp', ('flog', a)), a), # e^ln(a) = a
(('flog2', ('fexp2', a)), a), # lg2(2^a) = a
(('flog', ('fexp', a)), a), # ln(e^a) = a
+ (('fpow', a, b), ('fexp2', ('fmul', ('flog2', a), b)), 'options->lower_fpow'), # a^b = 2^(lg2(a)*b)
(('fexp2', ('fmul', ('flog2', a), b)), ('fpow', a, b), '!options->lower_fpow'), # 2^(lg2(a)*b) = a^b
(('fexp', ('fmul', ('flog', a), b)), ('fpow', a, b), '!options->lower_fpow'), # e^(ln(a)*b) = a^b
(('fpow', a, 1.0), a),
More information about the mesa-commit
mailing list