summaryrefslogtreecommitdiffstats
path: root/src/compiler/nir
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2019-08-07 08:54:04 -0700
committerDylan Baker <[email protected]>2019-09-04 11:56:34 -0700
commit2971f079e1c775d395d92eaa1453ae2f366a0231 (patch)
tree65b0abecb7deb089b62ea13412282afc31ea60ee /src/compiler/nir
parentda03ddf677a201b1296d3b3f8e110acbe406d8c3 (diff)
nir/algebraic: Mark some value range analysis-based optimizations imprecise
This didn't fix bug #111308, but it was found will trying to find the actual cause of that bug. Fixes piglit tests (new in piglit!110): - fs-fract-of-NaN.shader_test - fs-lt-nan-tautology.shader_test - fs-ge-nan-tautology.shader_test No shader-db changes on any Intel platform. Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=111308 Fixes: b77070e293c ("nir/algebraic: Use value range analysis to eliminate tautological compares") Reviewed-by: Alyssa Rosenzweig <[email protected]> Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]> (cherry picked from commit ccb236d1bc6375bdf9bc47550bdfa348ea7369b9)
Diffstat (limited to 'src/compiler/nir')
-rw-r--r--src/compiler/nir/nir_opt_algebraic.py22
1 files changed, 13 insertions, 9 deletions
diff --git a/src/compiler/nir/nir_opt_algebraic.py b/src/compiler/nir/nir_opt_algebraic.py
index 35255204133..cf7f48b0c5c 100644
--- a/src/compiler/nir/nir_opt_algebraic.py
+++ b/src/compiler/nir/nir_opt_algebraic.py
@@ -806,7 +806,8 @@ optimizations.extend([
(('ffloor', 'a(is_integral)'), a),
(('fceil', 'a(is_integral)'), a),
(('ftrunc', 'a(is_integral)'), a),
- (('ffract', 'a(is_integral)'), 0.0),
+ # fract(x) = x - floor(x), so fract(NaN) = NaN
+ (('~ffract', 'a(is_integral)'), 0.0),
(('fabs', 'a(is_not_negative)'), a),
(('iabs', 'a(is_not_negative)'), a),
(('fsat', 'a(is_not_positive)'), 0.0),
@@ -836,15 +837,18 @@ optimizations.extend([
(('fne', 'a(is_not_zero)', 0.0), True),
(('feq', 'a(is_not_zero)', 0.0), False),
- (('fge', 'a(is_not_negative)', 'b(is_not_positive)'), True),
- (('fge', 'b(is_not_positive)', 'a(is_gt_zero)'), False),
- (('fge', 'a(is_lt_zero)', 'b(is_not_negative)'), False),
- (('fge', 'b(is_not_negative)', 'a(is_not_positive)'), True),
+ # The results expecting true, must be marked imprecise. The results
+ # expecting false are fine because NaN compared >= or < anything is false.
- (('flt', 'a(is_not_negative)', 'b(is_not_positive)'), False),
- (('flt', 'b(is_not_positive)', 'a(is_gt_zero)'), True),
- (('flt', 'a(is_lt_zero)', 'b(is_not_negative)'), True),
- (('flt', 'b(is_not_negative)', 'a(is_not_positive)'), False),
+ (('~fge', 'a(is_not_negative)', 'b(is_not_positive)'), True),
+ (('fge', 'b(is_not_positive)', 'a(is_gt_zero)'), False),
+ (('fge', 'a(is_lt_zero)', 'b(is_not_negative)'), False),
+ (('~fge', 'b(is_not_negative)', 'a(is_not_positive)'), True),
+
+ (('flt', 'a(is_not_negative)', 'b(is_not_positive)'), False),
+ (('~flt', 'b(is_not_positive)', 'a(is_gt_zero)'), True),
+ (('~flt', 'a(is_lt_zero)', 'b(is_not_negative)'), True),
+ (('flt', 'b(is_not_negative)', 'a(is_not_positive)'), False),
(('ine', 'a(is_not_zero)', 0), True),
(('ieq', 'a(is_not_zero)', 0), False),