From: Jason Ekstrand Date: Mon, 23 Jul 2018 06:57:07 +0000 (-0700) Subject: nir: Add a couple trivial abs optimizations X-Git-Url: https://git.libre-soc.org/?a=commitdiff_plain;h=e4d346c86db0ae332fcdf55eac0e075cfb99a7eb;p=mesa.git nir: Add a couple trivial abs optimizations Spotted in a shader in Batman: Arkham City. Reviewed-by: Matt Turner Reviewed-by: Ian Romanick --- diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py index f49b43f3213..ba277fdfd0e 100644 --- a/src/compiler/nir/nir_opt_algebraic.py +++ b/src/compiler/nir/nir_opt_algebraic.py @@ -229,6 +229,8 @@ optimizations = [ (('imax', a, a), a), (('umin', a, a), a), (('umax', a, a), a), + (('fmax', a, ('fneg', a)), ('fabs', a)), + (('imax', a, ('ineg', a)), ('iabs', a)), (('fmin', a, ('fneg', a)), ('fneg', ('fabs', a))), (('imin', a, ('ineg', a)), ('ineg', ('iabs', a))), (('fmin', a, ('fneg', ('fabs', a))), ('fneg', ('fabs', a))),