From 084d10a7027ce8330b8c0502178322b0e1850d3f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Timur=20Krist=C3=B3f?= Date: Fri, 3 Feb 2023 00:32:06 +0100 Subject: [PATCH] aco: Remove MTBUF zero operand. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Timur Kristóf Reviewed-by: Rhys Perry Part-of: --- src/amd/compiler/aco_optimizer.cpp | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/src/amd/compiler/aco_optimizer.cpp b/src/amd/compiler/aco_optimizer.cpp index 3e295561d4c..a75ca2a1b4f 100644 --- a/src/amd/compiler/aco_optimizer.cpp +++ b/src/amd/compiler/aco_optimizer.cpp @@ -1512,6 +1512,22 @@ label_instruction(opt_ctx& ctx, aco_ptr& instr) } } + else if (instr->isMTBUF()) { + MTBUF_instruction& mtbuf = instr->mtbuf(); + while (info.is_temp()) + info = ctx.info[info.temp.id()]; + + if (mtbuf.offen && mtbuf.idxen && i == 1 && info.is_vec() && + info.instr->operands.size() == 2 && info.instr->operands[0].isTemp() && + info.instr->operands[0].regClass() == v1 && info.instr->operands[1].isConstant() && + mtbuf.offset + info.instr->operands[1].constantValue() < 4096) { + instr->operands[1] = info.instr->operands[0]; + mtbuf.offset += info.instr->operands[1].constantValue(); + mtbuf.offen = false; + continue; + } + } + /* SCRATCH: propagate constants and combine additions */ else if (instr->isScratch()) { FLAT_instruction& scratch = instr->scratch();