Mesa (master): nv50/ir/ra: improve condition for short regs, unify with cond for 16-bit
GitLab Mirror
gitlab-mirror at kemper.freedesktop.org
Sat Nov 17 07:49:52 UTC 2018
Module: Mesa
Branch: master
Commit: 799e021894a0e23e3017bf0cbb8780190f3e5646
URL: http://cgit.freedesktop.org/mesa/mesa/commit/?id=799e021894a0e23e3017bf0cbb8780190f3e5646
Author: Ilia Mirkin <imirkin at alum.mit.edu>
Date: Sun Nov 11 10:55:55 2018 -0500
nv50/ir/ra: improve condition for short regs, unify with cond for 16-bit
Instead of the size restriction existing in two places, and potentially
being applied twice, we move this together. Ops with 16-bit register
addresses can only take a short reg, and ops with immediates can only
take a short reg.
Of course we leave the immediate 0 in place since we know that it will
be replaced by r63/r127 down the line, so don't treat zeroes as an
immediate.
Signed-off-by: Ilia Mirkin <imirkin at alum.mit.edu>
Reviewed-by: Karol Herbst <kherbst at redhat.com>
---
src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp | 14 +++++++-------
1 file changed, 7 insertions(+), 7 deletions(-)
diff --git a/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp b/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
index 87a39de99d..8639c149b5 100644
--- a/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
+++ b/src/gallium/drivers/nouveau/codegen/nv50_ir_ra.cpp
@@ -66,10 +66,8 @@ public:
inline int getMaxAssigned(DataFile f) const { return fill[f]; }
- inline unsigned int getFileSize(DataFile f, uint8_t regSize) const
+ inline unsigned int getFileSize(DataFile f) const
{
- if (restrictedGPR16Range && f == FILE_GPR && regSize == 2)
- return (last[f] + 1) / 2;
return last[f] + 1;
}
@@ -846,9 +844,11 @@ GCRA::printNodeInfo() const
static bool
isShortRegOp(Instruction *insn)
{
- // Immediates are always in src1. Every other situation can be resolved by
+ // Immediates are always in src1 (except zeroes, which end up getting
+ // replaced with a zero reg). Every other situation can be resolved by
// using a long encoding.
- return insn->srcExists(1) && insn->src(1).getFile() == FILE_IMMEDIATE;
+ return insn->srcExists(1) && insn->src(1).getFile() == FILE_IMMEDIATE &&
+ insn->getSrc(1)->reg.data.u64;
}
// Check if this LValue is ever used in an instruction that can't be encoded
@@ -884,10 +884,10 @@ GCRA::RIG_Node::init(const RegisterSet& regs, LValue *lval)
weight = std::numeric_limits<float>::infinity();
degree = 0;
- int size = regs.getFileSize(f, lval->reg.size);
+ int size = regs.getFileSize(f);
// On nv50, we lose a bit of gpr encoding when there's an embedded
// immediate.
- if (regs.restrictedGPR16Range && f == FILE_GPR && isShortRegVal(lval))
+ if (regs.restrictedGPR16Range && f == FILE_GPR && (lval->reg.size == 2 || isShortRegVal(lval)))
size /= 2;
degreeLimit = size;
degreeLimit -= relDegree[1][colors] - 1;
More information about the mesa-commit
mailing list