mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-04-19 19:14:48 +00:00
shader_recompiler: Implement S_SUBB_U32 instruction (#2796)
* add S_SUBB_U32 instruction * add missing case * move case to match enum
This commit is contained in:
parent
ddf3df7f56
commit
aa8dab5371
2 changed files with 14 additions and 0 deletions
|
@ -30,6 +30,8 @@ void Translator::EmitScalarAlu(const GcnInst& inst) {
|
|||
return S_SUB_I32(inst);
|
||||
case Opcode::S_ADDC_U32:
|
||||
return S_ADDC_U32(inst);
|
||||
case Opcode::S_SUBB_U32:
|
||||
return S_SUBB_U32(inst);
|
||||
case Opcode::S_MIN_I32:
|
||||
return S_MIN_U32(true, inst);
|
||||
case Opcode::S_MIN_U32:
|
||||
|
@ -238,6 +240,17 @@ void Translator::S_SUB_U32(const GcnInst& inst) {
|
|||
ir.SetScc(ir.IGreaterThan(src1, src0, false));
|
||||
}
|
||||
|
||||
void Translator::S_SUBB_U32(const GcnInst& inst) {
|
||||
const IR::U32 src0{GetSrc(inst.src[0])};
|
||||
const IR::U32 src1{GetSrc(inst.src[1])};
|
||||
const IR::U32 borrow{ir.Select(ir.GetScc(), ir.Imm32(1U), ir.Imm32(0U))};
|
||||
const IR::U32 result{ir.ISub(ir.ISub(src0, src1), borrow)};
|
||||
SetDst(inst.dst[0], result);
|
||||
|
||||
const IR::U32 sum_with_borrow{ir.IAdd(src1, borrow)};
|
||||
ir.SetScc(ir.ILessThan(src0, sum_with_borrow, false));
|
||||
}
|
||||
|
||||
void Translator::S_ADD_I32(const GcnInst& inst) {
|
||||
const IR::U32 src0{GetSrc(inst.src[0])};
|
||||
const IR::U32 src1{GetSrc(inst.src[1])};
|
||||
|
|
|
@ -80,6 +80,7 @@ public:
|
|||
// SOP2
|
||||
void S_ADD_U32(const GcnInst& inst);
|
||||
void S_SUB_U32(const GcnInst& inst);
|
||||
void S_SUBB_U32(const GcnInst& inst);
|
||||
void S_ADD_I32(const GcnInst& inst);
|
||||
void S_SUB_I32(const GcnInst& inst);
|
||||
void S_ADDC_U32(const GcnInst& inst);
|
||||
|
|
Loading…
Add table
Reference in a new issue