[Mesa-dev] [PATCH v2 2/7] nv50/ir: swap sources in PostRaConstantFolding when src0 is imm helps some shaders in multiple games
Karol Herbst
nouveau at karolherbst.de
Wed Jan 27 09:25:03 PST 2016
total instructions in shared programs : 1922112 -> 1921966 (-0.01%)
total gprs used in shared programs : 251863 -> 251863 (0.00%)
total local used in shared programs : 5673 -> 5673 (0.00%)
total bytes used in shared programs : 17624080 -> 17622728 (-0.01%)
local gpr inst bytes
helped 0 0 62 62
hurt 0 0 0 0
v2: make the diff more clear and use swapSources
Signed-off-by: Karol Herbst <nouveau at karolherbst.de>
---
src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp | 11 +++++++++++
1 file changed, 11 insertions(+)
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
index ced9904..7b51ce0 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
@@ -2881,6 +2881,17 @@ NV50PostRaConstantFolding::visit(BasicBlock *bb)
def = i->getSrc(1)->getInsn();
if (def && def->op == OP_SPLIT && typeSizeof(def->sType) == 4)
def = def->getSrc(0)->getInsn();
+ if (!def || def->op != OP_MOV || def->src(0).getFile() != FILE_IMMEDIATE) {
+ /* maybe we can swap it */
+ def = i->getSrc(0)->getInsn();
+ if (def && def->op == OP_SPLIT && typeSizeof(def->sType) == 4)
+ def = def->getSrc(0)->getInsn();
+ if (!def || def->op != OP_MOV || def->src(0).getFile() != FILE_IMMEDIATE)
+ break;
+
+ i->swapSources(0, 1);
+ }
+
if (def && def->op == OP_MOV && def->src(0).getFile() == FILE_IMMEDIATE) {
vtmp = i->getSrc(1);
if (typeSizeof(i->sType) >= 2) {
--
2.7.0
More information about the mesa-dev
mailing list