Implement S_ABSDIFF_I32 shader instruction (#902)

This commit is contained in:
Luke Warner 2024-09-13 13:02:17 -04:00 committed by GitHub
parent ab201398b2
commit c181102a02
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 11 additions and 0 deletions

View file

@ -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

View file

@ -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