I noticed this pattern in glmark's jellyfish scene.

v2: Add inexact qualifier to avoid changing NaN behaviour

I would appreciate if someone did a shader-db run.

Signed-off-by: Alyssa Rosenzweig <aly...@rosenzweig.io>
Cc: Ilia Mirkin <imir...@alum.mit.edu>
Cc: Ian Romanick <i...@freedesktop.org>
Cc: Elie Tournier <tournier.e...@gmail.com>
---
 src/compiler/nir/nir_opt_algebraic.py | 1 +
 1 file changed, 1 insertion(+)

diff --git a/src/compiler/nir/nir_opt_algebraic.py 
b/src/compiler/nir/nir_opt_algebraic.py
index 89d07aa1261..e607e5b6fe2 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -397,6 +397,7 @@ optimizations = [
    (('imax', a, ('iabs', a)), ('iabs', a)),
    (('fmax', a, ('fneg', a)), ('fabs', a)),
    (('imax', a, ('ineg', a)), ('iabs', a)),
+   (('~fmax', ('fabs', a), 0.0), ('fabs', a)),
    (('~fmin', ('fmax', a, 0.0), 1.0), ('fsat', a), '!options->lower_fsat'),
    (('~fmax', ('fmin', a, 1.0), 0.0), ('fsat', a), '!options->lower_fsat'),
    (('~fmin', ('fmax', a, -1.0),  0.0), ('fneg', ('fsat', ('fneg', a))), 
'!options->lower_negate && !options->lower_fsat'),
-- 
2.20.1

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to