From 55d7267d6c6726875a3d705c0da675044784067f Mon Sep 17 00:00:00 2001 From: Alyssa Rosenzweig Date: Thu, 29 Feb 2024 14:13:24 -0400 Subject: [PATCH] agx: implement get_sr remat wanderer/386.shader_test - MESA_SHADER_FRAGMENT shader: 16268 inst, 110728 bytes, 255 halfregs, 384 threads, 5 loops, 436:720 spills:fills wanderer/386.shader_test - MESA_SHADER_FRAGMENT shader: 16255 inst, 110670 bytes, 255 halfregs, 384 threads, 5 loops, 435:719 spills:fills Signed-off-by: Alyssa Rosenzweig Part-of: --- src/asahi/compiler/agx_spill.c | 23 +++++++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/src/asahi/compiler/agx_spill.c b/src/asahi/compiler/agx_spill.c index bdce5458bd0..b1385630eff 100644 --- a/src/asahi/compiler/agx_spill.c +++ b/src/asahi/compiler/agx_spill.c @@ -275,14 +275,29 @@ reconstruct_index(struct spill_ctx *ctx, unsigned node) static bool can_remat(agx_instr *I) { - return I->op == AGX_OPCODE_MOV_IMM; + switch (I->op) { + case AGX_OPCODE_MOV_IMM: + case AGX_OPCODE_GET_SR: + return true; + default: + return false; + } } -static void +static agx_instr * remat_to(agx_builder *b, agx_index dst, struct spill_ctx *ctx, unsigned node) { - assert(can_remat(ctx->remat[node])); - agx_mov_imm_to(b, dst, ctx->remat[node]->imm); + agx_instr *I = ctx->remat[node]; + assert(can_remat(I)); + + switch (I->op) { + case AGX_OPCODE_MOV_IMM: + return agx_mov_imm_to(b, dst, I->imm); + case AGX_OPCODE_GET_SR: + return agx_get_sr_to(b, dst, I->sr); + default: + unreachable("invalid remat"); + } } static void