mirror of
https://gitlab.freedesktop.org/mesa/mesa.git
synced 2026-05-08 06:58:05 +02:00
nv50/ir: check if the target supports the new offset before inlining
Fixes: abd326e81b (nv50/ir: propagate indirect loads into instructions)
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=93300
Signed-off-by: Ilia Mirkin <imirkin@alum.mit.edu>
This commit is contained in:
parent
a13b14930d
commit
0f647bd65b
4 changed files with 25 additions and 3 deletions
|
|
@ -290,20 +290,23 @@ IndirectPropagation::visit(BasicBlock *bb)
|
|||
continue;
|
||||
if (insn->op == OP_ADD && !isFloatType(insn->dType)) {
|
||||
if (insn->src(0).getFile() != targ->nativeFile(FILE_ADDRESS) ||
|
||||
!insn->src(1).getImmediate(imm))
|
||||
!insn->src(1).getImmediate(imm) ||
|
||||
!targ->insnCanLoadOffset(i, s, imm.reg.data.s32))
|
||||
continue;
|
||||
i->setIndirect(s, 0, insn->getSrc(0));
|
||||
i->setSrc(s, cloneShallow(func, i->getSrc(s)));
|
||||
i->src(s).get()->reg.data.offset += imm.reg.data.u32;
|
||||
} else if (insn->op == OP_SUB && !isFloatType(insn->dType)) {
|
||||
if (insn->src(0).getFile() != targ->nativeFile(FILE_ADDRESS) ||
|
||||
!insn->src(1).getImmediate(imm))
|
||||
!insn->src(1).getImmediate(imm) ||
|
||||
!targ->insnCanLoadOffset(i, s, -imm.reg.data.s32))
|
||||
continue;
|
||||
i->setIndirect(s, 0, insn->getSrc(0));
|
||||
i->setSrc(s, cloneShallow(func, i->getSrc(s)));
|
||||
i->src(s).get()->reg.data.offset -= imm.reg.data.u32;
|
||||
} else if (insn->op == OP_MOV) {
|
||||
if (!insn->src(0).getImmediate(imm))
|
||||
if (!insn->src(0).getImmediate(imm) ||
|
||||
!targ->insnCanLoadOffset(i, s, imm.reg.data.s32))
|
||||
continue;
|
||||
i->setIndirect(s, 0, NULL);
|
||||
i->setSrc(s, cloneShallow(func, i->getSrc(s)));
|
||||
|
|
|
|||
|
|
@ -191,6 +191,8 @@ public:
|
|||
|
||||
virtual bool insnCanLoad(const Instruction *insn, int s,
|
||||
const Instruction *ld) const = 0;
|
||||
virtual bool insnCanLoadOffset(const Instruction *insn, int s,
|
||||
int offset) const { return true; }
|
||||
virtual bool isOpSupported(operation, DataType) const = 0;
|
||||
virtual bool isAccessSupported(DataFile, DataType) const = 0;
|
||||
virtual bool isModSupported(const Instruction *,
|
||||
|
|
|
|||
|
|
@ -384,6 +384,21 @@ TargetNV50::insnCanLoad(const Instruction *i, int s,
|
|||
return true;
|
||||
}
|
||||
|
||||
bool
|
||||
TargetNV50::insnCanLoadOffset(const Instruction *i, int s, int offset) const
|
||||
{
|
||||
if (!i->src(s).isIndirect(0))
|
||||
return true;
|
||||
offset += i->src(s).get()->reg.data.offset;
|
||||
if (i->op == OP_LOAD || i->op == OP_STORE) {
|
||||
// There are some restrictions in theory, but in practice they're never
|
||||
// going to be hit. When we enable shared/global memory, this will
|
||||
// become more important.
|
||||
return true;
|
||||
}
|
||||
return offset >= 0 && offset <= (int32_t)(127 * i->src(s).get()->reg.size);
|
||||
}
|
||||
|
||||
bool
|
||||
TargetNV50::isAccessSupported(DataFile file, DataType ty) const
|
||||
{
|
||||
|
|
|
|||
|
|
@ -46,6 +46,8 @@ public:
|
|||
|
||||
virtual bool insnCanLoad(const Instruction *insn, int s,
|
||||
const Instruction *ld) const;
|
||||
virtual bool insnCanLoadOffset(const Instruction *insn, int s,
|
||||
int offset) const;
|
||||
virtual bool isOpSupported(operation, DataType) const;
|
||||
virtual bool isAccessSupported(DataFile, DataType) const;
|
||||
virtual bool isModSupported(const Instruction *, int s, Modifier) const;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue