[Mesa-dev] [PATCH 03/11] i965/vec4: Fix handling of multiple register reads and writes in opt_register_coalesce().

Matt Turner mattst88 at gmail.com
Fri Mar 20 10:28:20 PDT 2015


On Fri, Mar 20, 2015 at 7:50 AM, Francisco Jerez <currojerez at riseup.net> wrote:
> ---
>  src/mesa/drivers/dri/i965/brw_vec4.cpp | 24 ++++++++++--------------
>  1 file changed, 10 insertions(+), 14 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_vec4.cpp b/src/mesa/drivers/dri/i965/brw_vec4.cpp
> index 8e4df8c..ed9944d 100644
> --- a/src/mesa/drivers/dri/i965/brw_vec4.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_vec4.cpp
> @@ -1026,9 +1026,7 @@ vec4_visitor::opt_register_coalesce()
>                                                    inst, block) {
>           _scan_inst = scan_inst;
>
> -        if (scan_inst->dst.file == GRF &&
> -            scan_inst->dst.reg == inst->src[0].reg &&
> -            scan_inst->dst.reg_offset == inst->src[0].reg_offset) {
> +        if (inst->src[0].in_range(scan_inst->dst, scan_inst->regs_written)) {

Tab here.

>              /* Found something writing to the reg we want to coalesce away. */
>              if (to_mrf) {
>                 /* SEND instructions can't have MRF as a destination. */
> @@ -1052,6 +1050,10 @@ vec4_visitor::opt_register_coalesce()
>                 break;
>              }
>
> +            /* This doesn't handle coalescing of multiple registers. */
> +            if (scan_inst->regs_written > 1)
> +               break;
> +
>             /* Mark which channels we found unconditional writes for. */
>             if (!scan_inst->predicate)
>                 chans_remaining &= ~scan_inst->dst.writemask;
> @@ -1067,11 +1069,9 @@ vec4_visitor::opt_register_coalesce()
>            */
>          bool interfered = false;
>          for (int i = 0; i < 3; i++) {
> -           if (scan_inst->src[i].file == GRF &&
> -               scan_inst->src[i].reg == inst->src[0].reg &&
> -               scan_inst->src[i].reg_offset == inst->src[0].reg_offset) {
> +           if (inst->src[0].in_range(scan_inst->src[i],

and here.

> +                                      scan_inst->regs_read(i)))
>                interfered = true;
> -           }
>          }
>          if (interfered)
>             break;
> @@ -1079,10 +1079,8 @@ vec4_visitor::opt_register_coalesce()


More information about the mesa-dev mailing list