From cfccd93efc95277a739a202a036cbea36fde85f4 Mon Sep 17 00:00:00 2001 From: Iago Toral Quiroga Date: Wed, 22 Jun 2022 09:43:30 +0200 Subject: [PATCH] broadcom/compiler: don't predicate postponed spills MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit The postponed spill is predicated using the condition from the last write, but this is only correct if the register was only written once in the TMU sequence, or if it is always written with the same predication. While we could try to track whether this is the case or not, it would make the postponed spill path even more complex than it already is, so let's just avoid predicating these. We are already discouraging TMU spilling of registers in the middle of TMU sequences, so this should not be a very common case. Cc: mesa-stable Reviewed-by: Alejandro Piñeiro Part-of: --- src/broadcom/compiler/vir_register_allocate.c | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/src/broadcom/compiler/vir_register_allocate.c b/src/broadcom/compiler/vir_register_allocate.c index 0910752..ca1428b 100644 --- a/src/broadcom/compiler/vir_register_allocate.c +++ b/src/broadcom/compiler/vir_register_allocate.c @@ -499,6 +499,8 @@ v3d_emit_tmu_spill(struct v3d_compile *c, c->cursor = vir_after_inst(position); + enum v3d_qpu_cond cond = vir_get_cond(inst); + /* If inst and position don't match, this is a postponed spill, * in which case we have already allocated the temp for the spill * and we should use that, otherwise create a new temp with the @@ -511,9 +513,15 @@ v3d_emit_tmu_spill(struct v3d_compile *c, add_node(c, inst->dst.index, class_bits); } else { inst->dst = spill_temp; + + /* If this is a postponed spill the register being spilled may + * have been written more than once including conditional + * writes, so ignore predication on the spill instruction and + * always spill the full register. + */ + cond = V3D_QPU_COND_NONE; } - enum v3d_qpu_cond cond = vir_get_cond(inst); struct qinst *tmp = vir_MOV_dest(c, vir_reg(QFILE_MAGIC, V3D_QPU_WADDR_TMUD), inst->dst); -- 2.7.4