From ab5f0affc835bd155df42c11ae9218864c5eebd5 Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Wed, 17 May 2023 08:08:22 +0200 Subject: [PATCH] r600/sfn: move kill instruction test to alu instruction Signed-off-by: Gert Wollny Part-of: --- .../drivers/r600/sfn/sfn_instr_alu.cpp | 22 +++++++++++++++ src/gallium/drivers/r600/sfn/sfn_instr_alu.h | 1 + .../drivers/r600/sfn/sfn_instr_alugroup.cpp | 27 +++---------------- src/gallium/drivers/r600/sfn/sfn_shader.cpp | 1 + 4 files changed, 28 insertions(+), 23 deletions(-) diff --git a/src/gallium/drivers/r600/sfn/sfn_instr_alu.cpp b/src/gallium/drivers/r600/sfn/sfn_instr_alu.cpp index 75d48a7e642..cad91d5c5eb 100644 --- a/src/gallium/drivers/r600/sfn/sfn_instr_alu.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_instr_alu.cpp @@ -1281,6 +1281,28 @@ AluInstrVisitor::visit(IfInstr *instr) instr->predicate()->accept(*this); } +bool AluInstr::is_kill() const +{ + if (has_alu_flag(alu_is_lds)) + return false; + + switch (m_opcode) { + case op2_kille: + case op2_kille_int: + case op2_killne: + case op2_killne_int: + case op2_killge: + case op2_killge_int: + case op2_killge_uint: + case op2_killgt: + case op2_killgt_int: + case op2_killgt_uint: + return true; + default: + return false; + } +} + static bool emit_alu_b2x(const nir_alu_instr& alu, AluInlineConstants mask, Shader& shader); diff --git a/src/gallium/drivers/r600/sfn/sfn_instr_alu.h b/src/gallium/drivers/r600/sfn/sfn_instr_alu.h index 3a5271edba6..107a8cc782e 100644 --- a/src/gallium/drivers/r600/sfn/sfn_instr_alu.h +++ b/src/gallium/drivers/r600/sfn/sfn_instr_alu.h @@ -150,6 +150,7 @@ public: bool has_lds_access() const; bool has_lds_queue_read() const; + bool is_kill() const; static const std::map cf_map; static const std::map bank_swizzle_map; diff --git a/src/gallium/drivers/r600/sfn/sfn_instr_alugroup.cpp b/src/gallium/drivers/r600/sfn/sfn_instr_alugroup.cpp index 24d3baaedd6..533f714359b 100644 --- a/src/gallium/drivers/r600/sfn/sfn_instr_alugroup.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_instr_alugroup.cpp @@ -37,26 +37,6 @@ namespace r600 { AluGroup::AluGroup() { std::fill(m_slots.begin(), m_slots.end(), nullptr); } -static bool -is_kill(EAluOp op) -{ - switch (op) { - case op2_kille: - case op2_kille_int: - case op2_killne: - case op2_killne_int: - case op2_killge: - case op2_killge_int: - case op2_killge_uint: - case op2_killgt: - case op2_killgt_int: - case op2_killgt_uint: - return true; - default: - return false; - } -} - bool AluGroup::add_instruction(AluInstr *instr) { @@ -69,7 +49,7 @@ AluGroup::add_instruction(AluInstr *instr) ASSERTED auto opinfo = alu_ops.find(instr->opcode()); assert(opinfo->second.can_channel(AluOp::t, s_chip_class)); if (add_trans_instructions(instr)) { - if (is_kill(instr->opcode())) + if (instr->is_kill()) m_has_kill_op = true; return true; } @@ -77,7 +57,7 @@ AluGroup::add_instruction(AluInstr *instr) if (add_vec_instructions(instr) && !instr->has_alu_flag(alu_is_trans)) { instr->set_parent_group(this); - if (!instr->has_alu_flag(alu_is_lds) && is_kill(instr->opcode())) + if (instr->is_kill()) m_has_kill_op = true; return true; } @@ -88,7 +68,7 @@ AluGroup::add_instruction(AluInstr *instr) if (s_max_slots > 4 && opinfo->second.can_channel(AluOp::t, s_chip_class) && add_trans_instructions(instr)) { instr->set_parent_group(this); - if (is_kill(instr->opcode())) + if (instr->is_kill()) m_has_kill_op = true; return true; } @@ -237,6 +217,7 @@ AluGroup::add_vec_instructions(AluInstr *instr) sfn_log << SfnLog::schedule << "V: Try force channel " << free_chan << "\n"; dest->set_chan(free_chan); if (instr->bank_swizzle() != alu_vec_unknown) { + if (try_readport(instr, instr->bank_swizzle())) return true; } else { diff --git a/src/gallium/drivers/r600/sfn/sfn_shader.cpp b/src/gallium/drivers/r600/sfn/sfn_shader.cpp index a8a8a63a3d7..73fe34e14d9 100644 --- a/src/gallium/drivers/r600/sfn/sfn_shader.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_shader.cpp @@ -32,6 +32,7 @@ #include "nir_intrinsics_indices.h" #include "sfn_debug.h" #include "sfn_instr.h" +#include "sfn_instr_alu.h" #include "sfn_instr_alugroup.h" #include "sfn_instr_controlflow.h" #include "sfn_instr_export.h"