[Mesa-dev] [PATCH 4/5] i965/fs: Extend SEL peephole to handle only matching MOVs.
Paul Berry
stereotype441 at gmail.com
Fri Nov 1 15:03:54 PDT 2013
On 31 October 2013 18:57, Matt Turner <mattst88 at gmail.com> wrote:
> Before this patch, the following code would not be optimized even though
> the first two instructions were common to the then and else blocks:
>
> (+f0) IF
> MOV dst0 ...
> MOV dst1 ...
> MOV dst2 ...
> ELSE
> MOV dst0 ...
> MOV dst1 ...
> MOV dst3 ...
> ENDIF
>
> This commit extends the peephole to handle this case.
>
> No shader-db changes.
> ---
> This patch made a much bigger difference when pulling instructions from the
> ends of the "then" and "else" blocks, because often we were able to compute
> to MRF.
>
This patch is:
Reviewed-by: Paul Berry <stereotype441 at gmail.com>
I'd be just as happy if you wanted to squash patches 3 and 4 together into
a single patch.
>
> src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp | 5 ++---
> 1 file changed, 2 insertions(+), 3 deletions(-)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp
> b/src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp
> index 9626751..c875487 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp
> @@ -142,7 +142,6 @@ fs_visitor::opt_peephole_sel()
>
> fs_inst *else_mov[MAX_MOVS] = { NULL };
> fs_inst *then_mov[MAX_MOVS] = { NULL };
> - bool malformed_mov_found = false;
>
> int movs = count_movs_from_if(then_mov, else_mov, if_inst,
> else_inst);
>
> @@ -161,7 +160,7 @@ fs_visitor::opt_peephole_sel()
> if (!then_mov[i]->dst.equals(else_mov[i]->dst) ||
> then_mov[i]->is_partial_write() ||
> else_mov[i]->is_partial_write()) {
> - malformed_mov_found = true;
> + movs = i;
> break;
> }
>
> @@ -188,7 +187,7 @@ fs_visitor::opt_peephole_sel()
> }
> }
>
> - if (malformed_mov_found)
> + if (movs == 0)
> continue;
>
> /* Emit a CMP if our IF used the embedded comparison */
> --
> 1.8.3.2
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20131101/3c6e7d43/attachment.html>
More information about the mesa-dev
mailing list