Mesa (master): nir/opt_vectorize: don't lose exact and no_*_wrap flags

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Sep 11 22:30:38 UTC 2020


Module: Mesa
Branch: master
Commit: 656d8edd9e141091e3f43d6dab587c5da00951d1
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=656d8edd9e141091e3f43d6dab587c5da00951d1

Author: Marek Olšák <marek.olsak at amd.com>
Date:   Fri Sep 11 14:55:28 2020 -0400

nir/opt_vectorize: don't lose exact and no_*_wrap flags

This fixes a bunch of dEQP GLES tests.

Reviewed-by: Eric Anholt <eric at anholt.net>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/6694>

---

 src/compiler/nir/nir_opt_vectorize.c | 11 +++++++++++
 1 file changed, 11 insertions(+)

diff --git a/src/compiler/nir/nir_opt_vectorize.c b/src/compiler/nir/nir_opt_vectorize.c
index 13604b1e232..80115be0ce5 100644
--- a/src/compiler/nir/nir_opt_vectorize.c
+++ b/src/compiler/nir/nir_opt_vectorize.c
@@ -194,6 +194,17 @@ instr_try_combine(struct nir_shader *nir, nir_instr *instr1, nir_instr *instr2,
                      total_components, alu1->dest.dest.ssa.bit_size, NULL);
    new_alu->dest.write_mask = (1 << total_components) - 1;
 
+   /* If either channel is exact, we have to preserve it even if it's
+    * not optimal for other channels.
+    */
+   new_alu->exact = alu1->exact || alu2->exact;
+
+   /* If all channels don't wrap, we can say that the whole vector doesn't
+    * wrap.
+    */
+   new_alu->no_signed_wrap = alu1->no_signed_wrap && alu2->no_signed_wrap;
+   new_alu->no_unsigned_wrap = alu1->no_unsigned_wrap && alu2->no_unsigned_wrap;
+
    for (unsigned i = 0; i < nir_op_infos[alu1->op].num_inputs; i++) {
       /* handle constant merging case */
       if (alu1->src[i].src.ssa != alu2->src[i].src.ssa) {



More information about the mesa-commit mailing list