Skip to content

Commit

Permalink
shader_recompiler: Implement S_ABS_I32 (shadps4-emu#1713)
Browse files Browse the repository at this point in the history
  • Loading branch information
squidbus authored and rainmakerv3 committed Dec 10, 2024
1 parent 660d395 commit 13ca780
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/shader_recompiler/frontend/translate/scalar_alu.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,8 @@ void Translator::EmitScalarAlu(const GcnInst& inst) {
return S_SAVEEXEC_B64(NegateMode::None, false, inst);
case Opcode::S_ORN2_SAVEEXEC_B64:
return S_SAVEEXEC_B64(NegateMode::Src1, true, inst);
case Opcode::S_ABS_I32:
return S_ABS_I32(inst);
default:
LogMissingOpcode(inst);
}
Expand Down Expand Up @@ -624,6 +626,12 @@ void Translator::S_SAVEEXEC_B64(NegateMode negate, bool is_or, const GcnInst& in
ir.SetScc(result);
}

void Translator::S_ABS_I32(const GcnInst& inst) {
const auto result = ir.IAbs(GetSrc(inst.src[0]));
SetDst(inst.dst[0], result);
ir.SetScc(ir.INotEqual(result, ir.Imm32(0)));
}

// SOPC

void Translator::S_CMP(ConditionOp cond, bool is_signed, const GcnInst& inst) {
Expand Down
1 change: 1 addition & 0 deletions src/shader_recompiler/frontend/translate/translate.h
Original file line number Diff line number Diff line change
Expand Up @@ -114,6 +114,7 @@ class Translator {
void S_FF1_I32_B32(const GcnInst& inst);
void S_GETPC_B64(u32 pc, const GcnInst& inst);
void S_SAVEEXEC_B64(NegateMode negate, bool is_or, const GcnInst& inst);
void S_ABS_I32(const GcnInst& inst);

// SOPC
void S_CMP(ConditionOp cond, bool is_signed, const GcnInst& inst);
Expand Down

0 comments on commit 13ca780

Please sign in to comment.