shader_recompiler: added SOPK MOVK (45)

This commit is contained in:
psucien 2024-06-16 20:26:24 +02:00
parent 52f3b74fdd
commit 1fc86a6c9d
3 changed files with 13 additions and 0 deletions

View File

@ -5,6 +5,15 @@
namespace Shader::Gcn { namespace Shader::Gcn {
void Translator::S_MOVK(const GcnInst& inst) {
const auto simm16 = inst.control.sopk.simm.Value();
if (simm16 & (1 << 15)) {
// TODO: need to verify the case of imm sign extension
UNREACHABLE();
}
SetDst(inst.dst[0], ir.Imm32(simm16));
}
void Translator::S_MOV(const GcnInst& inst) { void Translator::S_MOV(const GcnInst& inst) {
SetDst(inst.dst[0], GetSrc(inst.src[0])); SetDst(inst.dst[0], GetSrc(inst.src[0]));
} }

View File

@ -210,6 +210,9 @@ void Translate(IR::Block* block, std::span<const GcnInst> inst_list, Info& info)
Translator translator{block, info}; Translator translator{block, info};
for (const auto& inst : inst_list) { for (const auto& inst : inst_list) {
switch (inst.opcode) { switch (inst.opcode) {
case Opcode::S_MOVK_I32:
translator.S_MOVK(inst);
break;
case Opcode::S_MOV_B32: case Opcode::S_MOV_B32:
translator.S_MOV(inst); translator.S_MOV(inst);
break; break;

View File

@ -34,6 +34,7 @@ public:
void EmitFetch(const GcnInst& inst); void EmitFetch(const GcnInst& inst);
// Scalar ALU // Scalar ALU
void S_MOVK(const GcnInst& inst);
void S_MOV(const GcnInst& inst); void S_MOV(const GcnInst& inst);
void S_MUL_I32(const GcnInst& inst); void S_MUL_I32(const GcnInst& inst);
void S_CMP(ConditionOp cond, bool is_signed, const GcnInst& inst); void S_CMP(ConditionOp cond, bool is_signed, const GcnInst& inst);