From 875ee25e9812a1e813f61033daff5d26c7679167 Mon Sep 17 00:00:00 2001 From: Filip Gawin Date: Mon, 25 Jul 2022 16:18:04 +0200 Subject: [PATCH] r300: don't read from output transform_r300_vertex_SEQ/SNE MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Native rewrite in current form doesn't check type of register and may use output as a temp. Helps with 218 deqp-gles2 tests. Cc: mesa-stable Reviewed-by: Pavel Ondračka Part-of: --- .../r300/compiler/radeon_program_alu.c | 24 +++++++++---------- 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/src/gallium/drivers/r300/compiler/radeon_program_alu.c b/src/gallium/drivers/r300/compiler/radeon_program_alu.c index 7ea348dc5b9..5d76e5b6b97 100644 --- a/src/gallium/drivers/r300/compiler/radeon_program_alu.c +++ b/src/gallium/drivers/r300/compiler/radeon_program_alu.c @@ -699,25 +699,25 @@ static void transform_r300_vertex_SEQ(struct radeon_compiler *c, struct rc_instruction *inst) { /* x = y <==> x >= y && y >= x */ - int tmp = rc_find_free_temporary(c); - /* x <= y */ + struct rc_dst_register dst0 = try_to_reuse_dst(c, inst); emit2(c, inst->Prev, RC_OPCODE_SGE, NULL, - dstregtmpmask(tmp, inst->U.I.DstReg.WriteMask), + dst0, inst->U.I.SrcReg[0], inst->U.I.SrcReg[1]); /* y <= x */ + int tmp = rc_find_free_temporary(c); emit2(c, inst->Prev, RC_OPCODE_SGE, NULL, - inst->U.I.DstReg, + dstregtmpmask(tmp, inst->U.I.DstReg.WriteMask), inst->U.I.SrcReg[1], inst->U.I.SrcReg[0]); /* x && y = x * y */ emit2(c, inst->Prev, RC_OPCODE_MUL, NULL, inst->U.I.DstReg, - srcreg(RC_FILE_TEMPORARY, tmp), - srcreg(inst->U.I.DstReg.File, inst->U.I.DstReg.Index)); + srcreg(dst0.File, dst0.Index), + srcreg(RC_FILE_TEMPORARY, tmp)); rc_remove_instruction(inst); } @@ -726,25 +726,25 @@ static void transform_r300_vertex_SNE(struct radeon_compiler *c, struct rc_instruction *inst) { /* x != y <==> x < y || y < x */ - int tmp = rc_find_free_temporary(c); - /* x < y */ + struct rc_dst_register dst0 = try_to_reuse_dst(c, inst); emit2(c, inst->Prev, RC_OPCODE_SLT, NULL, - dstregtmpmask(tmp, inst->U.I.DstReg.WriteMask), + dst0, inst->U.I.SrcReg[0], inst->U.I.SrcReg[1]); /* y < x */ + int tmp = rc_find_free_temporary(c); emit2(c, inst->Prev, RC_OPCODE_SLT, NULL, - inst->U.I.DstReg, + dstregtmpmask(tmp, inst->U.I.DstReg.WriteMask), inst->U.I.SrcReg[1], inst->U.I.SrcReg[0]); /* x || y = max(x, y) */ emit2(c, inst->Prev, RC_OPCODE_MAX, NULL, inst->U.I.DstReg, - srcreg(RC_FILE_TEMPORARY, tmp), - srcreg(inst->U.I.DstReg.File, inst->U.I.DstReg.Index)); + srcreg(dst0.File, dst0.Index), + srcreg(RC_FILE_TEMPORARY, tmp)); rc_remove_instruction(inst); }