[Mesa-dev] [PATCH 06/10] i965: Don't dead-code eliminate instructions that write to the accumulator.
Paul Berry
stereotype441 at gmail.com
Fri Oct 4 13:47:15 PDT 2013
On 27 September 2013 18:17, Matt Turner <mattst88 at gmail.com> wrote:
> v2: Set destination register using brw_null_reg().
>
Reviewed-by: Paul Berry <stereotype441 at gmail.com>
> ---
> src/mesa/drivers/dri/i965/brw_fs.cpp | 15 ++++++++++++++-
> src/mesa/drivers/dri/i965/brw_vec4.cpp | 15 ++++++++++++++-
> 2 files changed, 28 insertions(+), 2 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp
> b/src/mesa/drivers/dri/i965/brw_fs.cpp
> index c1ab561..6c8294c 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
> @@ -1845,7 +1845,20 @@ fs_visitor::dead_code_eliminate()
> if (inst->dst.file == GRF) {
> assert(this->virtual_grf_end[inst->dst.reg] >= pc);
> if (this->virtual_grf_end[inst->dst.reg] == pc) {
> - inst->remove();
> + /* Don't dead code eliminate instructions that write to the
> + * accumulator as a side-effect. Instead just set the
> destination
> + * to the null register to free it.
> + */
> + switch (inst->opcode) {
> + case BRW_OPCODE_ADDC:
> + case BRW_OPCODE_SUBB:
> + case BRW_OPCODE_MACH:
> + inst->dst = fs_reg(retype(brw_null_reg(), inst->dst.type));
> + break;
> + default:
> + inst->remove();
> + break;
> + }
> progress = true;
> }
> }
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp
> b/src/mesa/drivers/dri/i965/brw_vec4.cpp
> index 2c1f541..812a005 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
> @@ -313,7 +313,20 @@ vec4_visitor::dead_code_eliminate()
> if (inst->dst.file == GRF) {
> assert(this->virtual_grf_end[inst->dst.reg] >= pc);
> if (this->virtual_grf_end[inst->dst.reg] == pc) {
> - inst->remove();
> + /* Don't dead code eliminate instructions that write to the
> + * accumulator as a side-effect. Instead just set the
> destination
> + * to the null register to free it.
> + */
> + switch (inst->opcode) {
> + case BRW_OPCODE_ADDC:
> + case BRW_OPCODE_SUBB:
> + case BRW_OPCODE_MACH:
> + inst->dst = dst_reg(retype(brw_null_reg(),
> inst->dst.type));
> + break;
> + default:
> + inst->remove();
> + break;
> + }
> progress = true;
> }
> }
> --
> 1.8.3.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20131004/abab9d2a/attachment-0001.html>
More information about the mesa-dev
mailing list