Mesa (main): nir: Mark negative re-distribution on fadd as imprecise
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Thu May 12 00:29:05 UTC 2022
Module: Mesa
Branch: main
Commit: df1876f615aee242565e815752bf39ee7fefc0ae
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=df1876f615aee242565e815752bf39ee7fefc0ae
Author: Jason Ekstrand <jason.ekstrand at collabora.com>
Date: Tue Apr 19 11:05:45 2022 -0500
nir: Mark negative re-distribution on fadd as imprecise
Otherwise, it would mutate `fneg(fadd(-0, 0))` into `fadd(0, -0)` which
isn't correct since -0 + (+0) = +0 + (-0) = +0.
This fixes the OpenCL contraction tests on Iris.
Reviewed-by: Alyssa Rosenzweig <alyssa.rosenzweig at collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/16041>
---
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 3c78fc01a48..9f73c336beb 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -2857,7 +2857,7 @@ distribute_src_mods = [
(('fneg', ('ffma(is_used_once)', a, b, c)), ('ffma', ('fneg', a), b, ('fneg', c))),
(('fneg', ('flrp(is_used_once)', a, b, c)), ('flrp', ('fneg', a), ('fneg', b), c)),
- (('fneg', ('fadd(is_used_once)', a, b)), ('fadd', ('fneg', a), ('fneg', b))),
+ (('fneg', ('~fadd(is_used_once)', a, b)), ('fadd', ('fneg', a), ('fneg', b))),
# Note that fmin <-> fmax. I don't think there is a way to distribute
# fabs() into fmin or fmax.
More information about the mesa-commit
mailing list