From b48f2d0ebc29783d577cb1647304527b4097911e Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 22 Feb 2024 08:39:55 -0400 Subject: [PATCH] agx: try to coalesce moves No shader-db changes but meh. Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/compiler/agx_register_allocate.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/src/asahi/compiler/agx_register_allocate.c b/src/asahi/compiler/agx_register_allocate.c index f8f93292f98..6b571f46530 100644 --- a/src/asahi/compiler/agx_register_allocate.c +++ b/src/asahi/compiler/agx_register_allocate.c @@ -865,6 +865,16 @@ pick_regs(struct ra_ctx *rctx, agx_instr *I, unsigned d) return reg; } + /* Try to allocate moves compatibly with their sources */ + if (I->op == AGX_OPCODE_MOV && I->src[0].type == AGX_INDEX_NORMAL && + I->src[0].memory == I->dest[0].memory && + I->src[0].size == I->dest[0].size) { + + unsigned out; + if (try_coalesce_with(rctx, I->src[0], count, false, &out)) + return out; + } + /* Try to allocate phis compatibly with their sources */ if (I->op == AGX_OPCODE_PHI) { agx_foreach_ssa_src(I, s) {