[Nouveau] [PATCH] nv50/ir: Propagate third immediate src when folding OP_MAD
Ilia Mirkin
imirkin at alum.mit.edu
Sun Oct 2 18:03:49 UTC 2016
On Sun, Oct 2, 2016 at 1:58 PM, Tobias Klausmann
<tobias.johannes.klausmann at mni.thm.de> wrote:
> Previously we'd end up with an unnecessary mov for the thirs immediate value.
>
> total instructions in shared programs : 851881 -> 851864 (-0.00%)
> total gprs used in shared programs : 110295 -> 110295 (0.00%)
> total local used in shared programs : 1020 -> 1020 (0.00%)
>
> local gpr inst bytes
> helped 0 0 17 17
> hurt 0 0 0 0
>
> Suggested-by: Karol Herbst <nouveau at karolherbst.de>
> Signed-off-by: Tobias Klausmann <tobias.johannes.klausmann at mni.thm.de>
> ---
> src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 15 ++++++++++++---
> 1 file changed, 12 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 9875738..8bb5cf9 100644
> --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
> +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
> @@ -1008,13 +1008,22 @@ ConstantFolding::opnd(Instruction *i, ImmediateValue &imm0, int s)
> break;
> case OP_MAD:
> if (imm0.isInteger(0)) {
> + ImmediateValue imm1;
> i->setSrc(0, i->getSrc(2));
> i->src(0).mod = i->src(2).mod;
> i->setSrc(1, NULL);
> i->setSrc(2, NULL);
> - i->op = i->src(0).mod.getOp();
> - if (i->op != OP_CVT)
> - i->src(0).mod = 0;
> + if (i->src(0).getImmediate(imm1)) {
> + bld.setPosition(i, false);
> + newi = bld.mkMov(i->getDef(0), bld.mkImm(imm1.reg.data.u64),
> + i->dType);
> + delete_Instruction(prog, i);
What's an example of a situation where this helps? It shouldn't
matter, the mov's should get cleaned up. [Clearly 17 shaders
disagree...] Is this just a side-effect of the fact that we don't run
the opts to a fixed point?
> + }
> + else {
> + i->op = i->src(0).mod.getOp();
> + if (i->op != OP_CVT)
> + i->src(0).mod = 0;
> + }
> } else
> if (i->subOp != NV50_IR_SUBOP_MUL_HIGH &&
> (imm0.isInteger(1) || imm0.isInteger(-1))) {
> --
> 2.10.0
>
> _______________________________________________
> Nouveau mailing list
> Nouveau at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/nouveau
More information about the Nouveau
mailing list