Tapani Pälli <tapani.pa...@intel.com> writes:

> Commit bb33a31 introduced MAD->MUL optimization which did not
> take account case where one of the remaining sources is immediate
> and did not report progress. Patch changes last one of the sources
> to be immediate and adds progress reporting. If both are, this is
> taken care of by the same opt_algebraic pass on later run.
>
> Signed-off-by: Tapani Pälli <tapani.pa...@intel.com>
> Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=89569
> ---
>  src/mesa/drivers/dri/i965/brw_fs.cpp | 7 +++++++
>  1 file changed, 7 insertions(+)
>
> diff --git a/src/mesa/drivers/dri/i965/brw_fs.cpp 
> b/src/mesa/drivers/dri/i965/brw_fs.cpp
> index 8702ea8..710a7e6 100644
> --- a/src/mesa/drivers/dri/i965/brw_fs.cpp
> +++ b/src/mesa/drivers/dri/i965/brw_fs.cpp
> @@ -2490,7 +2490,14 @@ fs_visitor::opt_algebraic()
>           } else if (inst->src[0].is_zero()) {
>              inst->opcode = BRW_OPCODE_MUL;
>              inst->src[0] = inst->src[2];
> +            /* Last one needs to be immediate. */
> +            if (inst->src[0].file == IMM) {
> +               inst->src[2] = inst->src[1];
> +               inst->src[1] = inst->src[0];
> +               inst->src[0] = inst->src[2];

I wish it weren't a heresy to std::swap(inst->src[0], inst->src[1])
here.  Anyway:

Reviewed-by: Francisco Jerez <curroje...@riseup.net>

> +            }
>              inst->src[2] = reg_undef;
> +            progress = true;
>           } else if (inst->src[1].is_one()) {
>              inst->opcode = BRW_OPCODE_ADD;
>              inst->src[1] = inst->src[2];
> -- 
> 2.1.0
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev@lists.freedesktop.org
> http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Attachment: signature.asc
Description: PGP signature

_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/mesa-dev

Reply via email to