broadcom/compiler: drop multop if we dce umul24

We always emit multop+umul24 to implement integer multiply and
this is the only scenario in which we use multop, so if we decide
to DCE umul24 we should also DCE the previous multop.

Reviewed-by: Alejandro Piñeiro <apinheiro@igalia.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/29909>
This commit is contained in:
Iago Toral Quiroga
2024-06-26 13:45:14 +02:00
committed by Marge Bot
parent 0a7a36372f
commit 4e6b675974
+16
View File
@@ -182,6 +182,7 @@ vir_opt_dead_code(struct v3d_compile *c)
}
}
struct qinst *last_multop = NULL;
vir_for_each_block(block, c) {
struct qinst *last_flags_write = NULL;
c->cur_block = block;
@@ -192,6 +193,11 @@ vir_opt_dead_code(struct v3d_compile *c)
if (v3d_qpu_reads_flags(&inst->qpu))
last_flags_write = NULL;
if (inst->qpu.type == V3D_QPU_INSTR_TYPE_ALU &&
inst->qpu.alu.mul.op == V3D_QPU_M_MULTOP) {
last_multop = inst;
}
if (inst->dst.file != QFILE_NULL &&
!(inst->dst.file == QFILE_TEMP &&
!used[inst->dst.index])) {
@@ -263,6 +269,16 @@ vir_opt_dead_code(struct v3d_compile *c)
continue;
}
/* If we drop umul24 we should also drop the previous
* multop that we emit with it.
*/
if (inst->qpu.type == V3D_QPU_INSTR_TYPE_ALU &&
inst->qpu.alu.mul.op == V3D_QPU_M_UMUL24 &&
last_multop) {
dce(c, last_multop);
last_multop = NULL;
}
assert(inst != last_flags_write);
dce(c, inst);
progress = true;