And ADD3(d, a, 0x0, c) to ADD(d, a, c) as well.
v2: - use moveSources()
- allow ADD3 -> ADD when srcFlags is set
Signed-off-by: Samuel Pitoiset <[email protected]>
---
src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 7 ++++++-
1 file changed, 6 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 246cdff..284f187 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
@@ -1070,7 +1070,12 @@ ConstantFolding::opnd(Instruction *i, ImmediateValue
&imm0, int s)
i->src(0).mod = Modifier(0);
}
break;
-
+ case OP_ADD3:
+ if (imm0.isInteger(0)) {
+ i->op = OP_ADD;
+ i->moveSources(s + 1, -1);
+ }
+ break;
case OP_DIV:
if (s != 1 || (i->dType != TYPE_S32 && i->dType != TYPE_U32))
break;
--
2.9.3
_______________________________________________
mesa-dev mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/mesa-dev