r600/sfn: pre-evaluate allowed dest mask in Alu instructions

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/20451>
This commit is contained in:
Gert Wollny 2022-12-22 13:21:03 +01:00 committed by Marge Bot
parent e2eb7cd3d8
commit 2df023a1f1
2 changed files with 13 additions and 15 deletions

View file

@ -68,6 +68,17 @@ AluInstr::AluInstr(EAluOp opcode,
ASSERT_OR_THROW(dest, "Write flag is set, but no destination register is given");
update_uses();
if (dest && slots > 1) {
switch (m_opcode) {
case op2_dot: m_allowed_desk_mask = (1 << (4 - slots)) - 1; break;
default:
if (has_alu_flag(alu_is_cayman_trans)) {
m_allowed_desk_mask = (1 << slots) - 1;
}
}
}
assert(!dest || (m_allowed_desk_mask & (1 << dest->chan())));
}
AluInstr::AluInstr(EAluOp opcode):
@ -493,20 +504,6 @@ uint8_t AluInstr::allowed_src_chan_mask() const
return mask;
}
uint8_t
AluInstr::allowed_dest_chan_mask() const
{
if (alu_slots() != 1) {
if (has_alu_flag(alu_is_cayman_trans))
return (1 << alu_slots()) - 1;
if (m_opcode == op2_dot_ieee) {
return (1 << (4 - alu_slots())) - 1;
}
}
return 0xf;
}
bool
AluInstr::replace_dest(PRegister new_dest, AluInstr *move_instr)
{

View file

@ -180,7 +180,7 @@ public:
AluInstr *as_alu() override { return this; }
uint8_t allowed_src_chan_mask() const override;
uint8_t allowed_dest_chan_mask() const;
uint8_t allowed_dest_chan_mask() const {return m_allowed_desk_mask;}
private:
friend class AluGroup;
@ -216,6 +216,7 @@ private:
int m_priority{0};
std::set<PRegister, std::less<PRegister>, Allocator<PRegister>> m_extra_dependencies;
AluGroup *m_parent_group{nullptr};
unsigned m_allowed_desk_mask{0xf};
};
class AluInstrVisitor : public InstrVisitor {