From 396812bab607478c1a41828cf7746d776cde412a Mon Sep 17 00:00:00 2001 From: psucien Date: Sun, 16 Jun 2024 23:39:45 +0200 Subject: [PATCH] shader_recompiler: added V_TRUNC VOP1/3 (496) --- src/shader_recompiler/frontend/translate/translate.cpp | 3 +++ src/shader_recompiler/frontend/translate/translate.h | 1 + src/shader_recompiler/frontend/translate/vector_alu.cpp | 5 +++++ 3 files changed, 9 insertions(+) diff --git a/src/shader_recompiler/frontend/translate/translate.cpp b/src/shader_recompiler/frontend/translate/translate.cpp index dafd451c..82d5dc8d 100644 --- a/src/shader_recompiler/frontend/translate/translate.cpp +++ b/src/shader_recompiler/frontend/translate/translate.cpp @@ -657,6 +657,9 @@ void Translate(IR::Block* block, std::span inst_list, Info& info) case Opcode::S_BFM_B32: translator.S_BFM_B32(inst); break; + case Opcode::V_TRUNC_F32: + translator.V_TRUNC_F32(inst); + break; case Opcode::S_NOP: case Opcode::S_CBRANCH_EXECZ: case Opcode::S_CBRANCH_SCC0: diff --git a/src/shader_recompiler/frontend/translate/translate.h b/src/shader_recompiler/frontend/translate/translate.h index 49678ca0..10a4580f 100644 --- a/src/shader_recompiler/frontend/translate/translate.h +++ b/src/shader_recompiler/frontend/translate/translate.h @@ -114,6 +114,7 @@ public: void V_CVT_I32_F32(const GcnInst& inst); void V_MIN_I32(const GcnInst& inst); void V_MUL_LO_U32(const GcnInst& inst); + void V_TRUNC_F32(const GcnInst& inst); // Vector Memory void BUFFER_LOAD_FORMAT(u32 num_dwords, bool is_typed, const GcnInst& inst); diff --git a/src/shader_recompiler/frontend/translate/vector_alu.cpp b/src/shader_recompiler/frontend/translate/vector_alu.cpp index 8a4a54da..7bad5799 100644 --- a/src/shader_recompiler/frontend/translate/vector_alu.cpp +++ b/src/shader_recompiler/frontend/translate/vector_alu.cpp @@ -425,4 +425,9 @@ void Translator::V_MUL_LO_U32(const GcnInst& inst) { SetDst(inst.dst[0], ir.IMul(src0, src1)); } +void Translator::V_TRUNC_F32(const GcnInst& inst) { + const IR::F32 src0{GetSrc(inst.src[0], true)}; + SetDst(inst.dst[0], ir.FPTrunc(src0)); +} + } // namespace Shader::Gcn