On 07/01/2016 06:19 AM, Ilia Mirkin wrote:
On Thu, Jun 30, 2016 at 6:54 PM, Samuel Pitoiset
<samuel.pitoi...@gmail.com> wrote:
On 07/01/2016 12:44 AM, Ilia Mirkin wrote:
If moveSources doesn't move modifiers, we have a serious problem.
However it looks like it does:
void
Instruction::setSrc(int s, const ValueRef& ref)
{
setSrc(s, ref.get());
srcs[s].mod = ref.mod;
}
which is what moveSources calls.
I was not sure about moveSources() because we have two variants and the
other one doesn't move the modifiers.
On Thu, Jun 30, 2016 at 6:26 PM, Samuel Pitoiset
<samuel.pitoi...@gmail.com> wrote:
And ADD3(d, a, 0x0, c) to ADD(d, a, c) as well.
Signed-off-by: Samuel Pitoiset <samuel.pitoi...@gmail.com>
---
src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 12
+++++++++++-
1 file changed, 11 insertions(+), 1 deletion(-)
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
index 1cf1fa3..517f779 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
@@ -1032,7 +1032,17 @@ ConstantFolding::opnd(Instruction *i,
ImmediateValue &imm0, int s)
i->src(0).mod = Modifier(0);
}
break;
-
+ case OP_ADD3:
+ if (i->usesFlags())
+ break;
Why? ADD can produce/consume a flag just fine.
Well, this is loosely based on OP_ADD which does exactly the same check.
Right, because you can't get rid of ADD 0, $c. (There is no MOV $c
variant... or we don't support it ... we probably should, I think
that's what CSET/CSETP are.) However you can definitely flip the ADD3
into an ADD2 even if the carry flag is being added in.
Yeah, makes sense.
+ if (imm0.isInteger(0)) {
+ i->op = OP_ADD;
+ for (int k = s; k < 2; k++) {
+ i->setSrc(k, i->getSrc(k + 1));
+ i->src(k).mod = i->src(k + 1).mod;
+ }
aka
i->moveSources(s + 1, -1) ?
Yes.
+ }
+ break;
case OP_DIV:
if (s != 1 || (i->dType != TYPE_S32 && i->dType != TYPE_U32))
break;
--
2.8.3
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev
--
-Samuel
_______________________________________________
mesa-dev mailing list
mesa-dev@lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/mesa-dev