[Nouveau] [PATCH v2 1/3] nv50/ir: fix AlgebraicOpt for slcts with mods

Ilia Mirkin imirkin at alum.mit.edu
Sun Apr 9 17:34:42 UTC 2017


On Mon, Apr 3, 2017 at 11:58 AM, Karol Herbst <karolherbst at gmail.com> wrote:
> Signed-off-by: Karol Herbst <karolherbst at gmail.com>
> ---
>  src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
> index 4c92a1efb5..bd60a84998 100644
> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
> @@ -1797,10 +1797,10 @@ AlgebraicOpt::handleSLCT(Instruction *slct)
>        if (slct->getSrc(2)->asImm()->compare(slct->asCmp()->setCond, 0.0f))
>           slct->setSrc(0, slct->getSrc(1));
>     } else
> -   if (slct->getSrc(0) != slct->getSrc(1)) {
> +   if (slct->getSrc(0) != slct->getSrc(1) || slct->src(0).mod != slct->src(1).mod)

SLCT can't have mods on src0/src1. Only on src2. I'd be just as happy
to assert that they're both == 0 here. You can also add a helper to
ValueRef to see if it's == to another ValueRef, which compares both
the Value ptr as well as any modifiers, indirects, etc. But it again
doesn't ultimately need to be used here.

>        return;
> -   }
> -   slct->op = OP_MOV;
> +   slct->op = slct->src(0).mod.getOp();
> +   slct->src(0).mod = slct->src(0).mod ^ Modifier(slct->op);
>     slct->setSrc(1, NULL);
>     slct->setSrc(2, NULL);
>  }
> --
> 2.12.2
>


More information about the Nouveau mailing list