[Mesa-dev] [PATCH 19/19] i965/fs: Optimize SEL with the same sources into a MOV.

Kenneth Graunke kenneth at whitecape.org
Sat May 31 18:07:20 PDT 2014


On Tuesday, May 27, 2014 06:47:50 PM Matt Turner wrote:
> instructions in affected programs:     474 -> 462 (-2.53%)
> ---
>  src/mesa/drivers/dri/i965/brw_fs.cpp | 7 ++++++-
>  1 file changed, 6 insertions(+), 1 deletion(-)
> 
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
b/src/mesa/drivers/dri/i965/brw_fs.cpp
> index c0af6d0..453683c 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
> @@ -2021,7 +2021,12 @@ fs_visitor::opt_algebraic()
>           }
>           break;
>        case BRW_OPCODE_SEL:
> -         if (inst->saturate && inst->src[1].file == IMM) {
> +         if (inst->src[0].equals(inst->src[1])) {
> +            inst->opcode = BRW_OPCODE_MOV;
> +            inst->src[1] = reg_undef;
> +            inst->predicate = BRW_PREDICATE_NONE;

I'd probably add

         inst->predicate_inverse = false;

just in case.  Otherwise, this patch is:
Reviewed-by: Kenneth Graunke <kenneth at whitecape.org>

> +            progress = true;
> +         } else if (inst->saturate && inst->src[1].file == IMM) {
>              switch (inst->conditional_mod) {
>              case BRW_CONDITIONAL_LE:
>              case BRW_CONDITIONAL_L:
> 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 836 bytes
Desc: This is a digitally signed message part.
URL: <http://lists.freedesktop.org/archives/mesa-dev/attachments/20140531/68d47956/attachment.sig>


More information about the mesa-dev mailing list