summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir/nir_opt_algebraic.py
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2018-07-22 23:57:07 -0700
committerJason Ekstrand <[email protected]>2018-07-23 10:48:21 -0700
commite4d346c86db0ae332fcdf55eac0e075cfb99a7eb (patch)
treedaef2e18eb215e48c6398ad6b2176da62d07d2c4 /src/compiler/nir/nir_opt_algebraic.py
parent52d831ff83036773978aabf52dde3bb73bb211c7 (diff)
nir: Add a couple trivial abs optimizations
Spotted in a shader in Batman: Arkham City. Reviewed-by: Matt Turner <[email protected]> Reviewed-by: Ian Romanick <[email protected]>
Diffstat (limited to 'src/compiler/nir/nir_opt_algebraic.py')
-rw-r--r--src/compiler/nir/nir_opt_algebraic.py2
1 files changed, 2 insertions, 0 deletions
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))),