[Mesa-dev] [PATCH] nir/lower_vec_to_movs: Don't coalesce the mmove when src and dest are the same reg

vadym.shovkoplias vadim.shovkoplias at gmail.com
Thu Mar 22 11:30:05 UTC 2018


Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=105440
Fixes: 2458ea95c56 "nir/lower_vec_to_movs: Coalesce movs on-the-fly when possible"
Signed-off-by: Andriy Khulap <andriy.khulap at globallogic.com>
Signed-off-by: Vadym Shovkoplias <vadym.shovkoplias at globallogic.com>
---
 src/compiler/nir/nir_lower_vec_to_movs.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/src/compiler/nir/nir_lower_vec_to_movs.c b/src/compiler/nir/nir_lower_vec_to_movs.c
index 711ddd3..4758f7d 100644
--- a/src/compiler/nir/nir_lower_vec_to_movs.c
+++ b/src/compiler/nir/nir_lower_vec_to_movs.c
@@ -166,9 +166,14 @@ try_coalesce(nir_alu_instr *vec, unsigned start_idx)
       /* If we are going to reswizzle the instruction, we can't have any
        * non-per-component sources either.
        */
-      for (unsigned j = 0; j < nir_op_infos[src_alu->op].num_inputs; j++)
+      for (unsigned j = 0; j < nir_op_infos[src_alu->op].num_inputs; j++) {
          if (nir_op_infos[src_alu->op].input_sizes[j] != 0)
             return 0;
+
+         /* Don't coalesce the mmove when src and dest are the same reg */
+         if (src_matches_dest_reg(&vec->dest.dest, &src_alu->src[j].src))
+            return 0;
+      }
    }
 
    /* Stash off all of the ALU instruction's swizzles. */
-- 
2.7.4



More information about the mesa-dev mailing list