From f8a54c489d305010eb6c622bb4e4acd714ee7532 Mon Sep 17 00:00:00 2001 From: Dave Airlie Date: Wed, 29 Nov 2017 13:13:17 +1000 Subject: [PATCH] r600: lds load cleanups. This is just some cleanups on top of the last patch from my compute branch. Signed-off-by: Dave Airlie --- src/gallium/drivers/r600/r600_shader.c | 14 ++++++++------ 1 file changed, 8 insertions(+), 6 deletions(-) diff --git a/src/gallium/drivers/r600/r600_shader.c b/src/gallium/drivers/r600/r600_shader.c index 2f2e002115a..78f4e33e05b 100644 --- a/src/gallium/drivers/r600/r600_shader.c +++ b/src/gallium/drivers/r600/r600_shader.c @@ -1747,12 +1747,13 @@ static int do_lds_fetch_values(struct r600_shader_ctx *ctx, unsigned temp_reg, unsigned dst_reg, unsigned mask) { struct r600_bytecode_alu alu; - int r, i; + int r, i, lasti; if ((ctx->bc->cf_last->ndw>>1) >= 0x60) ctx->bc->force_add_cf = 1; - for (i = 1; i < 4; i++) { + lasti = tgsi_last_instruction(mask); + for (i = 1; i <= lasti; i++) { if (!(mask & (1 << i))) continue; @@ -1763,8 +1764,8 @@ static int do_lds_fetch_values(struct r600_shader_ctx *ctx, unsigned temp_reg, if (r) return r; } - for (i = 0; i < 4; i++) { - if (! (mask & (1 << i))) + for (i = 0; i <= lasti; i++) { + if (!(mask & (1 << i))) continue; /* emit an LDS_READ_RET */ @@ -1781,9 +1782,10 @@ static int do_lds_fetch_values(struct r600_shader_ctx *ctx, unsigned temp_reg, if (r) return r; } - for (i = 0; i < 4; i++) { - if (! (mask & (1 << i))) + for (i = 0; i <= lasti; i++) { + if (!(mask & (1 << i))) continue; + /* then read from LDS_OQ_A_POP */ memset(&alu, 0, sizeof(alu)); -- 2.30.2