From f251ea393bf3d01d242e2eb56cd0f2b0e140f7b2 Mon Sep 17 00:00:00 2001 From: Matt Turner Date: Fri, 24 Apr 2015 11:37:30 -0700 Subject: [PATCH] nir: Transform pow(x, 4) into (x*x)*(x*x). --- 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 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))), -- 2.30.2