From: Matt Turner Date: Fri, 24 Apr 2015 18:37:30 +0000 (-0700) Subject: nir: Transform pow(x, 4) into (x*x)*(x*x). X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=f251ea393bf3d01d242e2eb56cd0f2b0e140f7b2;p=mesa.git nir: Transform pow(x, 4) into (x*x)*(x*x). --- 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))),