Module: Mesa Branch: master Commit: 86fb53b1be1fea5ccea34d5bfca9d9aea64f3af2 URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=86fb53b1be1fea5ccea34d5bfca9d9aea64f3af2
Author: Ian Romanick <[email protected]> Date: Mon Mar 8 14:30:00 2021 -0800 nir/range_analysis: Refactor fsat handling This will greatly simplify a later commit. The assert(r.is_integral) in the eq_zero case is dropped because I don't think it's useful anymore. Reviewed-by: Rhys Perry <[email protected]> Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/9108> --- src/compiler/nir/nir_range_analysis.c | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/src/compiler/nir/nir_range_analysis.c b/src/compiler/nir/nir_range_analysis.c index b6d2c8767b2..f02819e0a9b 100644 --- a/src/compiler/nir/nir_range_analysis.c +++ b/src/compiler/nir/nir_range_analysis.c @@ -852,31 +852,34 @@ analyze_expression(const nir_alu_instr *instr, unsigned src, r.range = fneg_table[r.range]; break; - case nir_op_fsat: - r = analyze_expression(alu, 0, ht, nir_alu_src_type(alu, 0)); + case nir_op_fsat: { + const struct ssa_result_range left = + analyze_expression(alu, 0, ht, nir_alu_src_type(alu, 0)); - switch (r.range) { + switch (left.range) { case le_zero: case lt_zero: + case eq_zero: r.range = eq_zero; r.is_integral = true; break; - case eq_zero: - assert(r.is_integral); - FALLTHROUGH; case gt_zero: - case ge_zero: - /* The fsat doesn't add any information in these cases. */ + /* The fsat doesn't add any information in this case. */ + r.range = left.range; + r.is_integral = left.is_integral; break; + case ge_zero: case ne_zero: case unknown: /* Since the result must be in [0, 1], the value must be >= 0. */ r.range = ge_zero; + r.is_integral = left.is_integral; break; } break; + } case nir_op_fsign: r = (struct ssa_result_range){ _______________________________________________ mesa-commit mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/mesa-commit
