From: Karol Herbst <g...@karolherbst.de> total instructions in shared programs : 1895008 -> 1894759 (-0.01%) total gprs used in shared programs : 251728 -> 251715 (-0.01%) total local used in shared programs : 5673 -> 5673 (0.00%) total bytes used in shared programs : 17377840 -> 17375696 (-0.01%)
local gpr inst bytes helped 0 23 287 287 hurt 0 5 25 25 Signed-off-by: Karol Herbst <nouv...@karolherbst.de> --- .../drivers/nouveau/codegen/nv50_ir_peephole.cpp | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp index 0c98100..3b4e3fb 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp @@ -339,6 +339,7 @@ private: void expr(Instruction *, ImmediateValue&, ImmediateValue&); void expr(Instruction *, ImmediateValue&, ImmediateValue&, ImmediateValue&); void opnd(Instruction *, ImmediateValue&, int s); + void opnd3(Instruction *, ImmediateValue&); void unary(Instruction *, const ImmediateValue&); @@ -391,6 +392,8 @@ ConstantFolding::visit(BasicBlock *bb) else if (i->srcExists(1) && i->src(1).getImmediate(src1)) opnd(i, src1, 1); + if (i->srcExists(2) && i->src(2).getImmediate(src2)) + opnd3(i, src2); } return true; } @@ -876,6 +879,22 @@ ConstantFolding::tryCollapseChainedMULs(Instruction *mul2, } void +ConstantFolding::opnd3(Instruction *i, ImmediateValue &imm2) +{ + switch (i->op) { + case OP_MAD: + case OP_FMA: + if (imm2.isInteger(0)) { + i->op = OP_MUL; + i->setSrc(2, NULL); + return; + } + default: + return; + } +} + +void ConstantFolding::opnd(Instruction *i, ImmediateValue &imm0, int s) { const int t = !s; -- 2.7.0 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org http://lists.freedesktop.org/mailman/listinfo/mesa-dev