diff --git a/src/shader_recompiler/frontend/translate/scalar_alu.cpp b/src/shader_recompiler/frontend/translate/scalar_alu.cpp index 5b194db8..4feec2c1 100644 --- a/src/shader_recompiler/frontend/translate/scalar_alu.cpp +++ b/src/shader_recompiler/frontend/translate/scalar_alu.cpp @@ -84,6 +84,8 @@ void Translator::EmitScalarAlu(const GcnInst& inst) { return S_MAX_U32(false, inst); case Opcode::S_MAX_I32: return S_MAX_U32(true, inst); + case Opcode::S_ABSDIFF_I32: + return S_ABSDIFF_I32(inst); case Opcode::S_WQM_B64: break; default: @@ -563,4 +565,12 @@ void Translator::S_MIN_U32(bool is_signed, const GcnInst& inst) { ir.SetScc(ir.IEqual(result, src0)); } +void Translator::S_ABSDIFF_I32(const GcnInst& inst) { + const IR::U32 src0{GetSrc(inst.src[0])}; + const IR::U32 src1{GetSrc(inst.src[1])}; + const IR::U32 result{ir.IAbs(ir.ISub(src0, src1))}; + SetDst(inst.dst[0], result); + ir.SetScc(ir.INotEqual(result, ir.Imm32(0))); +} + } // namespace Shader::Gcn diff --git a/src/shader_recompiler/frontend/translate/translate.h b/src/shader_recompiler/frontend/translate/translate.h index 888d3451..bd197628 100644 --- a/src/shader_recompiler/frontend/translate/translate.h +++ b/src/shader_recompiler/frontend/translate/translate.h @@ -103,6 +103,7 @@ public: void S_ADDK_I32(const GcnInst& inst); void S_MAX_U32(bool is_signed, const GcnInst& inst); void S_MIN_U32(bool is_signed, const GcnInst& inst); + void S_ABSDIFF_I32(const GcnInst& inst); void S_CMPK(ConditionOp cond, bool is_signed, const GcnInst& inst); // Scalar Memory