[Mesa-dev] [PATCH v2 2/3] nv50/ir: handle logops with NOT in AlgebraicOpt

Ilia Mirkin imirkin at alum.mit.edu
Sun Apr 9 17:36:06 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, 6 insertions(+)
>
> diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
> index bd60a84998..0de84fe9fc 100644
> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
> @@ -1856,6 +1856,12 @@ AlgebraicOpt::handleLOGOP(Instruction *logop)
>
>        set0 = cloneForward(func, set0);
>        set1 = cloneShallow(func, set1);
> +
> +      if (logop->src(0).mod == Modifier(NV50_IR_MOD_NOT))
> +         set0->asCmp()->setCond = inverseCondCode(set0->asCmp()->setCond);
> +      if (logop->src(1).mod == Modifier(NV50_IR_MOD_NOT))
> +         set1->asCmp()->setCond = inverseCondCode(set1->asCmp()->setCond);

set0/set1 may have been swapped further up, so you need to keep track of that.

Also, I don't think this will work if one of the sets is a SET_AND --
the condcode applies to the set bit, not to the AND bit. I think you'd
also have to flip AND <-> OR and flip the neg.

  -ilia


More information about the mesa-dev mailing list