summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorMatt Turner <[email protected]>2015-04-24 11:37:30 -0700
committerMatt Turner <[email protected]>2015-04-24 11:39:01 -0700
commitf251ea393bf3d01d242e2eb56cd0f2b0e140f7b2 (patch)
tree686c99823128abce6c03be13ec09f1eeb4248a4e /src
parent9b577d57029bb643f2b48b80648b4f901818e93b (diff)
nir: Transform pow(x, 4) into (x*x)*(x*x).
Diffstat (limited to 'src')
-rw-r--r--src/glsl/nir/nir_opt_algebraic.py1
1 files changed, 1 insertions, 0 deletions
diff --git a/src/glsl/nir/nir_opt_algebraic.py b/src/glsl/nir/nir_opt_algebraic.py
index cdb19241c43..2a2b9561efb 100644
--- a/src/glsl/nir/nir_opt_algebraic.py
+++ b/src/glsl/nir/nir_opt_algebraic.py
@@ -144,6 +144,7 @@ optimizations = [
(('fexp', ('fmul', ('flog', a), b)), ('fpow', a, b), '!options->lower_fpow'), # e^(ln(a)*b) = a^b
(('fpow', a, 1.0), a),
(('fpow', a, 2.0), ('fmul', a, a)),
+ (('fpow', a, 4.0), ('fmul', ('fmul', a, a), ('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))),