From: Matt Turner Date: Thu, 26 Mar 2015 17:16:24 +0000 (-0700) Subject: nir: Add identities for the exponential function. X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=8a6ae384b2ae95f047e9d48a5a4c11002ffdd814;p=mesa.git nir: Add identities for the exponential function. No changes in shader-db. Reviewed-by: Eric Anholt --- diff --git a/src/glsl/nir/nir_opt_algebraic.py b/src/glsl/nir/nir_opt_algebraic.py index 5b84a4e1cd8..db2fe037206 100644 --- a/src/glsl/nir/nir_opt_algebraic.py +++ b/src/glsl/nir/nir_opt_algebraic.py @@ -139,6 +139,12 @@ optimizations = [ (('fpow', a, 1.0), a), (('fpow', a, 2.0), ('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))), + (('frcp', ('fexp2', a)), ('fexp2', ('fneg', a))), + (('frcp', ('fexp', a)), ('fexp', ('fneg', a))), + (('frsq', ('fexp2', a)), ('fexp2', ('fmul', -0.5, a))), + (('frsq', ('fexp', a)), ('fexp', ('fmul', -0.5, a))), # Division and reciprocal (('fdiv', 1.0, a), ('frcp', a)), (('frcp', ('frcp', a)), a),