From a26e46980e1b73172b5c37d1499d46ae78d9c4e4 Mon Sep 17 00:00:00 2001 From: Ludvig Lindau Date: Wed, 24 Sep 2025 11:10:29 +0000 Subject: [PATCH] panfrost/panvk: Merge stores in vector spills Make vector spills use a single store of appropriate data size instead of using a store for every vector component. Reviewed-by: Eric R. Smith Part-of: --- src/panfrost/compiler/bi_ra.c | 16 +++++++--------- 1 file changed, 7 insertions(+), 9 deletions(-) diff --git a/src/panfrost/compiler/bi_ra.c b/src/panfrost/compiler/bi_ra.c index 362bee4fdb7..fe7d5feec3a 100644 --- a/src/panfrost/compiler/bi_ra.c +++ b/src/panfrost/compiler/bi_ra.c @@ -760,19 +760,17 @@ bi_spill_register(bi_context *ctx, bi_index index, uint32_t offset) if (!bi_is_equiv(I->dest[d], index)) continue; + unsigned count = bi_count_write_registers(I, d); unsigned extra = I->dest[d].offset; - bi_index tmp = bi_temp(ctx); - I->dest[d] = bi_replace_index(I->dest[d], tmp); + channels = MAX2(channels, extra + count); I->no_spill = true; - unsigned count = bi_count_write_registers(I, d); - unsigned bits = count * 32; - - b.cursor = bi_after_instr(I); - bi_store_tl(&b, bits, tmp, offset + 4 * extra); - ctx->spills++; - channels = MAX2(channels, extra + count); + if (channels == extra + count) { + b.cursor = bi_after_instr(I); + bi_store_tl(&b, channels * 32, index, offset); + ctx->spills++; + } } if (bi_has_arg(I, index)) {