[Mesa-stable] [Mesa-dev] [PATCH] nv50/ir: skip optimizing ADD+SHL to SHLADD when src(1) is 0

Ilia Mirkin imirkin at alum.mit.edu
Mon May 1 15:59:50 UTC 2017


I think this is off. It shouldn't matter what the code sequence is,
it's all representable. You need to teach replaceZero to not mess
things up for SHLADD's src(1).

On Sat, Apr 29, 2017 at 12:01 PM, Samuel Pitoiset
<samuel.pitoiset at gmail.com> wrote:
> Doing '(a << b) + c' when b is 0 is dumb, ADD should be used
> instead.
>
> This fixes a compilation error with Alien Isolation because
> src(1) is expected to be an immediate value, and the
> replaceZero logic will transform 0 to $r63 (or $r255).
>
> Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
> Cc: "13.0 17.0 17.1" <mesa-stable at lists.freedesktop.org>
> ---
>  src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 3 +++
>  1 file changed, 3 insertions(+)
>
> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
> index 4c92a1efb5..015def0391 100644
> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
> @@ -2224,6 +2224,9 @@ LateAlgebraicOpt::tryADDToSHLADD(Instruction *add)
>     if (!shl->src(1).getImmediate(imm))
>        return false;
>
> +   if (imm.isInteger(0))
> +      return false;
> +
>     add->op = OP_SHLADD;
>     add->setSrc(2, add->src(!s));
>     // SHL can't have any modifiers, but the ADD source may have had
> --
> 2.12.2
>
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-stable mailing list