From: Karol Herbst <karolher...@gmail.com> This helps with the PostRALoadPropagation pass moving long immediates into FMA/MAD instructions.
changes in shader-db: total instructions in shared programs : 5894114 -> 5886074 (-0.14%) total gprs used in shared programs : 666558 -> 666563 (0.00%) total shared used in shared programs : 520416 -> 520416 (0.00%) total local used in shared programs : 53524 -> 53524 (0.00%) total bytes used in shared programs : 54006744 -> 53932472 (-0.14%) local shared gpr inst bytes helped 0 0 2 4192 4192 hurt 0 0 7 9 9 Signed-off-by: Karol Herbst <karolher...@gmail.com> --- src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp | 30 ++++++++++++++-------- 1 file changed, 20 insertions(+), 10 deletions(-) diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp index 3a0e56e1385..aeaf1ebe8f0 100644 --- a/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp +++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp @@ -1466,17 +1466,27 @@ GCRA::allocateRegisters(ArrayList& insns) nodes[i].init(regs, lval); RIG.insert(&nodes[i]); - if (lval->inFile(FILE_GPR) && lval->getInsn() != NULL && - prog->getTarget()->getChipset() < 0xc0) { + if (lval->inFile(FILE_GPR) && lval->getInsn() != NULL) { Instruction *insn = lval->getInsn(); - if (insn->op == OP_MAD || insn->op == OP_FMA || insn->op == OP_SAD) - // Short encoding only possible if they're all GPRs, no need to - // affect them otherwise. - if (insn->flagsDef < 0 && - insn->src(0).getFile() == FILE_GPR && - insn->src(1).getFile() == FILE_GPR && - insn->src(2).getFile() == FILE_GPR) - nodes[i].addRegPreference(getNode(insn->getSrc(2)->asLValue())); + if (insn->op != OP_MAD && insn->op != OP_FMA && insn->op != OP_SAD) + continue; + // Short encoding or load propagate immediates only possible if + // they're all GPRs, no need to affect them otherwise. + if (insn->flagsDef >= 0 || + insn->src(0).getFile() != FILE_GPR || + insn->src(1).getFile() != FILE_GPR || + insn->src(2).getFile() != FILE_GPR) + continue; + // for nvc0+ we can loadpropagate limms only if we have + // dest == src2 reg id. Using getImmediate here is fine because + // we only set a reg preference and leave the immediate alone. + ImmediateValue imm; + if (prog->getTarget()->getChipset() >= 0xc0 && + !insn->src(0).getImmediate(imm) && + !insn->src(1).getImmediate(imm)) + continue; + + nodes[i].addRegPreference(getNode(insn->getSrc(2)->asLValue())); } } } -- 2.14.3 _______________________________________________ mesa-dev mailing list mesa-dev@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/mesa-dev