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); }