[Mesa-dev] [PATCH 11/15] i965/fs: If emit a MOV instead of a SEL if the sources are the same.
Paul Berry
stereotype441 at gmail.com
Wed Oct 30 18:14:05 CET 2013
On 28 October 2013 11:31, Matt Turner <mattst88 at gmail.com> wrote:
> total instructions in shared programs: 1287488 -> 1287457 (-0.00%)
> instructions in affected programs: 1745 -> 1714 (-1.78%)
> ---
> src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp | 38
> +++++++++++++----------
> 1 file changed, 21 insertions(+), 17 deletions(-)
>
Patch subject should be "i965/fs: Emit a MOV instead of a SEL if the
sources are the same." (you had an extraneous "if").
With that change, patch is:
Reviewed-by: Paul Berry <stereotype441 at gmail.com>
>
> 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 8638f43..4c0eba9 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs_sel_peephole.cpp
> @@ -224,26 +224,30 @@ fs_visitor::opt_peephole_sel()
> break;
> }
>
> - /* Only the last source register can be a constant, so if the
> MOV in
> - * the "then" clause uses a constant, we need to put it in a
> - * temporary.
> - */
> - fs_reg src0(then_mov[i]->src[0]);
> - if (src0.file == IMM) {
> - src0 = fs_reg(this, glsl_type::float_type);
> - src0.type = then_mov[i]->src[0].type;
> - mov_imm_inst[i] = MOV(src0, then_mov[i]->src[0]);
> - }
> + if (!then_mov[i]->src[0].equals(else_mov[i]->src[0])) {
> + /* Only the last source register can be a constant, so if the
> MOV
> + * in the "then" clause uses a constant, we need to put it in
> a
> + * temporary.
> + */
> + fs_reg src0(then_mov[i]->src[0]);
> + if (src0.file == IMM) {
> + src0 = fs_reg(this, glsl_type::float_type);
> + src0.type = then_mov[i]->src[0].type;
> + mov_imm_inst[i] = MOV(src0, then_mov[i]->src[0]);
> + }
>
> - sel_inst[i] = SEL(then_mov[i]->dst, src0, else_mov[i]->src[0]);
> + sel_inst[i] = SEL(then_mov[i]->dst, src0,
> else_mov[i]->src[0]);
>
> - if (brw->gen == 6 && if_inst->conditional_mod) {
> - /* For Sandybridge with IF with embedded comparison */
> - sel_inst[i]->predicate = BRW_PREDICATE_NORMAL;
> + if (brw->gen == 6 && if_inst->conditional_mod) {
> + /* For Sandybridge with IF with embedded comparison */
> + sel_inst[i]->predicate = BRW_PREDICATE_NORMAL;
> + } else {
> + /* Separate CMP and IF instructions */
> + sel_inst[i]->predicate = if_inst->predicate;
> + sel_inst[i]->predicate_inverse =
> if_inst->predicate_inverse;
> + }
> } else {
> - /* Separate CMP and IF instructions */
> - sel_inst[i]->predicate = if_inst->predicate;
> - sel_inst[i]->predicate_inverse = if_inst->predicate_inverse;
> + sel_inst[i] = MOV(then_mov[i]->dst, then_mov[i]->src[0]);
> }
>
> bb_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/20131030/77e34118/attachment.html>
More information about the mesa-dev
mailing list