Mesa (master): nv50/ir: allow to swap sources for OP_SUB
Samuel Pitoiset
hakzsam at kemper.freedesktop.org
Fri Jul 22 20:52:14 UTC 2016
Module: Mesa
Branch: master
Commit: 3f5cf8c488bfc401d1d5503c1ec61874d7c1477d
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=3f5cf8c488bfc401d1d5503c1ec61874d7c1477d
Author: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Date: Wed Jul 20 20:07:35 2016 +0200
nv50/ir: allow to swap sources for OP_SUB
This allows the load-propagation pass to swap the sources in presence
of immediate values.
Maxwell (GM107):
total instructions in shared programs :1928187 -> 1927634 (-0.03%)
total gprs used in shared programs :330741 -> 330154 (-0.18%)
total local used in shared programs :28032 -> 28032 (0.00%)
local gpr inst bytes
helped 0 271 425 425
hurt 0 0 194 194
Fermi (GF114):
total instructions in shared programs :2334474 -> 2333829 (-0.03%)
total gprs used in shared programs :380934 -> 380215 (-0.19%)
total local used in shared programs :33304 -> 33264 (-0.12%)
local gpr inst bytes
helped 5 314 521 521
hurt 0 4 195 195
No regressions on GM107 and GF114 with full piglit.
Signed-off-by: Samuel Pitoiset <samuel.pitoiset at gmail.com>
Reviewed-by: Ilia Mirkin <imirkin at alum.mit.edu>
---
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 3fc1abf..a9172f8 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_peephole.cpp
@@ -192,7 +192,7 @@ LoadPropagation::checkSwapSrc01(Instruction *insn)
{
const Target *targ = prog->getTarget();
if (!targ->getOpInfo(insn).commutative)
- if (insn->op != OP_SET && insn->op != OP_SLCT)
+ if (insn->op != OP_SET && insn->op != OP_SLCT && insn->op != OP_SUB)
return;
if (insn->src(1).getFile() != FILE_GPR)
return;
@@ -232,6 +232,11 @@ LoadPropagation::checkSwapSrc01(Instruction *insn)
else
if (insn->op == OP_SLCT)
insn->asCmp()->setCond = inverseCondCode(insn->asCmp()->setCond);
+ else
+ if (insn->op == OP_SUB) {
+ insn->src(0).mod = insn->src(0).mod ^ Modifier(NV50_IR_MOD_NEG);
+ insn->src(1).mod = insn->src(1).mod ^ Modifier(NV50_IR_MOD_NEG);
+ }
}
bool
More information about the mesa-commit
mailing list