[Mesa-dev] [PATCH 11.1/22] nir: Mark bcsel-to-fmin (or fmax) transformations as inexact
Ian Romanick
idr at freedesktop.org
Wed Feb 28 20:18:37 UTC 2018
From: Ian Romanick <ian.d.romanick at intel.com>
These transformations are inexact because section 4.7.1 (Range and
Precision) says:
Operations and built-in functions that operate on a NaN are not
required to return a NaN as the result.
The fmin or fmax might not return NaN in cases where the original
expression would be required to return NaN.
Signed-off-by: Ian Romanick <ian.d.romanick at intel.com>
---
src/compiler/nir/nir_opt_algebraic.py | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index 17f4d9c..b643cda 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -168,8 +168,8 @@ optimizations = [
(('flt(is_not_used_by_conditional)', ('fadd(is_used_once)', a, ('fneg', b)), 0.0), ('flt', a, b)),
(('fge', ('fneg', ('fabs', a)), 0.0), ('feq', a, 0.0)),
- (('bcsel', ('flt', b, a), b, a), ('fmin', a, b)),
- (('bcsel', ('flt', a, b), b, a), ('fmax', a, b)),
+ (('~bcsel', ('flt', b, a), b, a), ('fmin', a, b)),
+ (('~bcsel', ('flt', a, b), b, a), ('fmax', a, b)),
(('~bcsel', ('fge', a, b), b, a), ('fmin', a, b)),
(('~bcsel', ('fge', b, a), b, a), ('fmax', a, b)),
(('bcsel', ('inot', a), b, c), ('bcsel', a, c, b)),
--
2.9.5
More information about the mesa-dev
mailing list