From 2df023a1f1990aad6c20eca85af19c7d21a43203 Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Thu, 22 Dec 2022 13:21:03 +0100 Subject: [PATCH] r600/sfn: pre-evaluate allowed dest mask in Alu instructions Signed-off-by: Gert Wollny Part-of: --- .../drivers/r600/sfn/sfn_instr_alu.cpp | 25 ++++++++----------- src/gallium/drivers/r600/sfn/sfn_instr_alu.h | 3 ++- 2 files changed, 13 insertions(+), 15 deletions(-) diff --git a/src/gallium/drivers/r600/sfn/sfn_instr_alu.cpp b/src/gallium/drivers/r600/sfn/sfn_instr_alu.cpp index d5e5001925a..9e6197da863 100644 --- a/src/gallium/drivers/r600/sfn/sfn_instr_alu.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_instr_alu.cpp @@ -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) { diff --git a/src/gallium/drivers/r600/sfn/sfn_instr_alu.h b/src/gallium/drivers/r600/sfn/sfn_instr_alu.h index dc6a2236429..8f9f8bfa9e1 100644 --- a/src/gallium/drivers/r600/sfn/sfn_instr_alu.h +++ b/src/gallium/drivers/r600/sfn/sfn_instr_alu.h @@ -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, Allocator> m_extra_dependencies; AluGroup *m_parent_group{nullptr}; + unsigned m_allowed_desk_mask{0xf}; }; class AluInstrVisitor : public InstrVisitor {