summaryrefslogtreecommitdiffstats
path: root/src/compiler
diff options
context:
space:
mode:
authorIan Romanick <[email protected]>2019-08-12 12:08:40 -0700
committerDylan Baker <[email protected]>2019-09-04 11:56:54 -0700
commit6aa7a103709542f36e1e3678abf047001b4f1d5f (patch)
tree48a1225d0a6dd771733501bdb62deed202142f13 /src/compiler
parent97e44d68176b0d721a0dd93ab3a11c3bdb8bc6a5 (diff)
nir/range-analysis: Fix incorrect fadd range result for (ne_zero, ne_zero)
Found by inspection. I tried really, really hard to make a test case that would trigger this problem, but I was unsuccesful. It's very hard to get an instruction to produce a ne_zero result without ne_zero sources. The most plausible way is using bcsel. That proves problematic because bcsel interprets its sources as integers, so it cannot currently be used to "clean" values for floating point instructions. No shader-db changes on any Intel platform. Reviewed-by: Caio Marcelo de Oliveira Filho <[email protected]> Fixes: 405de7ccb6c ("nir/range-analysis: Rudimentary value range analysis pass") (cherry picked from commit 0b4782fccd22b0a01ded1e4cbfe06821bdf19d05)
Diffstat (limited to 'src/compiler')
-rw-r--r--src/compiler/nir/nir_range_analysis.c11
1 files changed, 8 insertions, 3 deletions
diff --git a/src/compiler/nir/nir_range_analysis.c b/src/compiler/nir/nir_range_analysis.c
index 5b0c39e4922..b7a2f20d473 100644
--- a/src/compiler/nir/nir_range_analysis.c
+++ b/src/compiler/nir/nir_range_analysis.c
@@ -247,9 +247,15 @@ analyze_expression(const nir_alu_instr *instr, unsigned src,
* | lt_zero + lt_zero
* ;
*
+ * ne_zero: eq_zero + ne_zero
+ * | ne_zero + eq_zero # Addition is commutative
+ * ;
+ *
* eq_zero: eq_zero + eq_zero
+ * ;
*
- * All other cases are 'unknown'.
+ * All other cases are 'unknown'. The seeming odd entry is (ne_zero,
+ * ne_zero), but that could be (-5, +5) which is not ne_zero.
*/
static const enum ssa_ranges fadd_table[last_range + 1][last_range + 1] = {
/* left\right unknown lt_zero le_zero gt_zero ge_zero ne_zero eq_zero */
@@ -258,12 +264,11 @@ analyze_expression(const nir_alu_instr *instr, unsigned src,
/* le_zero */ { _______, lt_zero, le_zero, _______, _______, _______, le_zero },
/* gt_zero */ { _______, _______, _______, gt_zero, gt_zero, _______, gt_zero },
/* ge_zero */ { _______, _______, _______, gt_zero, ge_zero, _______, ge_zero },
- /* ne_zero */ { _______, _______, _______, _______, _______, ne_zero, ne_zero },
+ /* ne_zero */ { _______, _______, _______, _______, _______, _______, ne_zero },
/* eq_zero */ { _______, lt_zero, le_zero, gt_zero, ge_zero, ne_zero, eq_zero },
};
ASSERT_TABLE_IS_COMMUTATIVE(fadd_table);
- ASSERT_TABLE_IS_DIAGONAL(fadd_table);
/* Due to flush-to-zero semanatics of floating-point numbers with very
* small mangnitudes, we can never really be sure a result will be