r600/sfn: Add handling of channels for dest-less ALU ops

This will be used to get rid of some dummy register handling.

Signed-off-by: Gert Wollny <gert.wollny@collabora.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/37205>
This commit is contained in:
Gert Wollny 2025-09-03 16:05:35 +02:00 committed by Marge Bot
parent 90b2fbbab4
commit 4f1f5aa02d
2 changed files with 45 additions and 0 deletions

View file

@ -47,6 +47,34 @@ get_dest_mask(EAluOp opcode, int slots, bool is_cayman_trans)
UNREACHABLE("dest_mask_from_opcode_and_slots: Some opscodes not handeld");
}
AluInstr::AluInstr(EAluOp opcode,
int chan,
SrcValues src,
const std::set<AluModifiers>& flags):
m_opcode(opcode),
m_bank_swizzle(alu_vec_unknown),
m_cf_type(cf_alu),
m_alu_slots(1),
m_fallback_chan(chan)
{
m_src.swap(src);
if (m_src.size() == 3)
m_alu_flags.set(alu_op3);
for (auto f : flags)
m_alu_flags.set(f);
ASSERT_OR_THROW(m_src.size() ==
static_cast<size_t>(alu_ops.at(opcode).nsrc * m_alu_slots),
"Unexpected number of source values");
update_uses();
m_allowed_dest_mask = BITSET_BIT(m_fallback_chan);
}
AluInstr::AluInstr(EAluOp opcode,
PRegister dest,
SrcValues src,
@ -1021,6 +1049,18 @@ AluInstr::propagate_death()
return true;
}
void AluInstr::set_allowed_dest_chan_mask(uint8_t mask)
{
assert(!m_dest && "We override the fallback channel only");
m_allowed_dest_mask = mask;
if (!(BITSET_BIT(m_fallback_chan) & m_allowed_dest_mask)) {
unsigned m = mask;
m_fallback_chan = u_bit_scan(&m);
}
}
bool
AluInstr::has_lds_access() const
{

View file

@ -45,6 +45,10 @@ public:
AluInstr(EAluOp opcode);
AluInstr(EAluOp opcode, int chan);
AluInstr(EAluOp opcode,
int chan,
SrcValues src,
const std::set<AluModifiers>& flags);
AluInstr(EAluOp opcode,
PRegister dest,
SrcValues src0,
@ -176,6 +180,7 @@ public:
uint8_t allowed_src_chan_mask() const override;
uint8_t allowed_dest_chan_mask() const {return m_allowed_dest_mask;}
void set_allowed_dest_chan_mask(uint8_t mask);
void inc_ar_uses() { ++m_num_ar_uses;}
auto num_ar_uses() const {return m_num_ar_uses;}