From 56e4a4651000c3e43b1850f04d65f845d79ab0f8 Mon Sep 17 00:00:00 2001 From: Gert Wollny Date: Sun, 14 Mar 2021 17:05:24 +0100 Subject: [PATCH] r600/sfn: remove extra parameter from alu assemebly emission Signed-off-by: Gert Wollny Part-of: --- .../drivers/r600/sfn/sfn_instruction_alu.h | 1 - .../drivers/r600/sfn/sfn_instruction_cf.cpp | 1 + .../drivers/r600/sfn/sfn_ir_to_assembly.cpp | 27 +++++++++++-------- 3 files changed, 17 insertions(+), 12 deletions(-) diff --git a/src/gallium/drivers/r600/sfn/sfn_instruction_alu.h b/src/gallium/drivers/r600/sfn/sfn_instruction_alu.h index 383e17672bf..383fa3bafb5 100644 --- a/src/gallium/drivers/r600/sfn/sfn_instruction_alu.h +++ b/src/gallium/drivers/r600/sfn/sfn_instruction_alu.h @@ -100,7 +100,6 @@ public: PValue src2, const std::set& m_flags); - void set_flag(AluModifiers flag); unsigned n_sources() const; diff --git a/src/gallium/drivers/r600/sfn/sfn_instruction_cf.cpp b/src/gallium/drivers/r600/sfn/sfn_instruction_cf.cpp index dc2b37a0df3..455d6d63086 100644 --- a/src/gallium/drivers/r600/sfn/sfn_instruction_cf.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_instruction_cf.cpp @@ -46,6 +46,7 @@ IfInstruction::IfInstruction(AluInstruction *pred): { PValue *v = m_pred->psrc(0); add_remappable_src_value(v); + pred->set_cf_type(cf_alu_push_before); } void IfInstruction::do_evalue_liveness(LiverangeEvaluator& eval) const diff --git a/src/gallium/drivers/r600/sfn/sfn_ir_to_assembly.cpp b/src/gallium/drivers/r600/sfn/sfn_ir_to_assembly.cpp index 635bda8e88c..9f0e9d39753 100644 --- a/src/gallium/drivers/r600/sfn/sfn_ir_to_assembly.cpp +++ b/src/gallium/drivers/r600/sfn/sfn_ir_to_assembly.cpp @@ -39,14 +39,18 @@ namespace r600 { using std::vector; -struct AssemblyFromShaderLegacyImpl { + + +struct AssemblyFromShaderLegacyImpl { AssemblyFromShaderLegacyImpl(r600_shader *sh, r600_shader_key *key); + + bool emit(const Instruction::Pointer i); void reset_addr_register() {m_last_addr.reset();} private: - bool emit_alu(const AluInstruction& ai, ECFAluOpCode cf_op); + bool emit_alu(const AluInstruction& ai); bool emit_export(const ExportInstruction & exi); bool emit_streamout(const StreamOutIntruction& instr); bool emit_memringwrite(const MemRingOutIntruction& instr); @@ -165,7 +169,7 @@ bool AssemblyFromShaderLegacyImpl::emit(const Instruction::Pointer i) sfn_log << SfnLog::assembly << "Emit from '" << *i << "\n"; switch (i->type()) { case Instruction::alu: - return emit_alu(static_cast(*i), cf_alu_undefined); + return emit_alu(static_cast(*i)); case Instruction::exprt: return emit_export(static_cast(*i)); case Instruction::tex: @@ -242,7 +246,7 @@ bool AssemblyFromShaderLegacyImpl::emit_load_addr(PValue addr) return true; } -bool AssemblyFromShaderLegacyImpl::emit_alu(const AluInstruction& ai, ECFAluOpCode cf_op) +bool AssemblyFromShaderLegacyImpl::emit_alu(const AluInstruction& ai) { struct r600_bytecode_alu alu; @@ -353,8 +357,7 @@ bool AssemblyFromShaderLegacyImpl::emit_alu(const AluInstruction& ai, ECFAluOpCo m_last_addr.reset(); } - if (cf_op == cf_alu_undefined) - cf_op = ai.cf_type(); + auto cf_op = ai.cf_type(); unsigned type = 0; switch (cf_op) { @@ -518,11 +521,13 @@ bool AssemblyFromShaderLegacyImpl::emit_if_start(const IfInstruction & if_instr) auto op = cf_alu_push_before; if (needs_workaround) { - r600_bytecode_add_cfinst(m_bc, CF_OP_PUSH); - m_bc->cf_last->cf_addr = m_bc->cf_last->id + 2; - op = cf_alu; - } - emit_alu(pred, op); + r600_bytecode_add_cfinst(m_bc, CF_OP_PUSH); + m_bc->cf_last->cf_addr = m_bc->cf_last->id + 2; + auto new_pred = pred; + new_pred.set_cf_type(cf_alu); + emit_alu(new_pred); + } else + emit_alu(pred); r600_bytecode_add_cfinst(m_bc, CF_OP_JUMP);