summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorJason Ekstrand <[email protected]>2018-08-15 04:29:42 -0500
committerJason Ekstrand <[email protected]>2018-08-29 14:04:02 -0500
commitd448fa3ae35c3aa4e7bf25f8b1870315573e32fa (patch)
treeafd37266651a8f90857195f2500c0296e6faa413 /src/compiler
parent4dd5263663585b55119e49c8dfade015c86aff1a (diff)
nir/algebraic: Add some max/min optimizations
Found by inspection. This doesn't help much now but we'll see this pattern with images if you load UNORM and then store UNORM. Shader-db results on Kaby Lake: total instructions in shared programs: 15166916 -> 15166910 (<.01%) instructions in affected programs: 761 -> 755 (-0.79%) helped: 6 HURT: 0 Reviewed-by: Bas Nieuwenhuizen <[email protected]> Reviewed-by: Kenneth Graunke <[email protected]>
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/nir/nir_opt_algebraic.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index 8a0ddf1c325..ae1261f8744 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -302,6 +302,12 @@ optimizations = [
(('imax', a, a), a),
(('umin', a, a), a),
(('umax', a, a), a),
+ (('fmax', ('fmax', a, b), b), ('fmax', a, b)),
+ (('umax', ('umax', a, b), b), ('umax', a, b)),
+ (('imax', ('imax', a, b), b), ('imax', a, b)),
+ (('fmin', ('fmin', a, b), b), ('fmin', a, b)),
+ (('umin', ('umin', a, b), b), ('umin', a, b)),
+ (('imin', ('imin', a, b), b), ('imin', a, b)),
(('fmax', a, ('fneg', a)), ('fabs', a)),
(('imax', a, ('ineg', a)), ('iabs', a)),
(('fmin', a, ('fneg', a)), ('fneg', ('fabs', a))),