Mesa (master): nir: Mark the 0.0 < abs(a) transformation as imprecise

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Aug 4 08:12:21 UTC 2018


Module: Mesa
Branch: master
Commit: ea6c276436851d27394abd132b239e1c21f0e923
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=ea6c276436851d27394abd132b239e1c21f0e923

Author: Ian Romanick <ian.d.romanick at intel.com>
Date:   Wed Aug  1 10:13:55 2018 -0700

nir: Mark the 0.0 < abs(a) transformation as imprecise

Unlike the much older -abs(a) >= 0.0 transformation, this is not
precise.  The behavior changes if the source is NaN.

No shader-db changes on any platform.

Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
Reviewed-by: Thomas Helland <thomashelland90 at gmail.com>

---

 src/compiler/nir/nir_opt_algebraic.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index 7fc4ff1d40..c4f46b56d9 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -197,7 +197,7 @@ optimizations = [
    # fabs(a) > 0.0
    # fabs(a) != 0.0 because fabs(a) must be >= 0
    # a != 0.0
-   (('flt', 0.0, ('fabs', a)), ('fne', a, 0.0)),
+   (('~flt', 0.0, ('fabs', a)), ('fne', a, 0.0)),
 
    (('fmax',                        ('b2f(is_used_once)', a),           ('b2f', b)),           ('b2f', ('ior', a, b))),
    (('fmax', ('fneg(is_used_once)', ('b2f(is_used_once)', a)), ('fneg', ('b2f', b))), ('fneg', ('b2f', ('ior', a, b)))),




More information about the mesa-commit mailing list