Re: [Mesa-dev] [PATCH v2 1/3] nv50/ir: fix AlgebraicOpt for slcts with mods

2017-04-09 Thread Ilia Mirkin
On Mon, Apr 3, 2017 at 11:58 AM, Karol Herbst  wrote:
> Signed-off-by: Karol Herbst 
> ---
>  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
>
___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev


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

2017-04-03 Thread Karol Herbst
Signed-off-by: Karol Herbst 
---
 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)
   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

___
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev