From ce66c9aead9e26cb29b631e0ab317c7630719a6a Mon Sep 17 00:00:00 2001 From: =?utf8?q?Alejandro=20Pi=C3=B1eiro?= Date: Tue, 19 Oct 2021 23:52:30 +0200 Subject: [PATCH] broadcom/compiler: update payload registers handling when computing live intervals As for v71 the payload registers are not the same. Specifically now rf3 is used as payload register, so this is needed to avoid rf3 being selected as a instruction dst by the register allocator, overwriting the payload value that could be still used. Reviewed-by: Iago Toral Quiroga Part-of: --- src/broadcom/compiler/vir_live_variables.c | 21 +++++++++++++-------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/src/broadcom/compiler/vir_live_variables.c b/src/broadcom/compiler/vir_live_variables.c index 575b048..d1f44aa 100644 --- a/src/broadcom/compiler/vir_live_variables.c +++ b/src/broadcom/compiler/vir_live_variables.c @@ -179,17 +179,22 @@ vir_setup_def_use(struct v3d_compile *c) flags_inst = NULL; } - /* Payload registers: r0/1/2 contain W, centroid W, - * and Z at program start. Register allocation will - * force their nodes to R0/1/2. + /* Payload registers: for fragment shaders, W, + * centroid W, and Z will be initialized in r0/1/2 + * until v42, or r1/r2/r3 since v71. + * + * For compute shaders, payload is in r0/r2 up to v42, + * r2/r3 since v71. + * + * Register allocation will force their nodes to those + * registers. */ if (inst->src[0].file == QFILE_REG) { - switch (inst->src[0].index) { - case 0: - case 1: - case 2: + uint32_t min_payload_r = c->devinfo->ver >= 71 ? 1 : 0; + uint32_t max_payload_r = c->devinfo->ver >= 71 ? 3 : 2; + if (inst->src[0].index >= min_payload_r || + inst->src[0].index <= max_payload_r) { c->temp_start[inst->dst.index] = 0; - break; } } -- 2.7.4