PPU Precise: Fix FMADDS, FMSUBS, FNMSUBS, FNMADDS

This commit is contained in:
Eladash 2020-03-21 12:44:20 +02:00 committed by Ivan
parent 3a36b713ce
commit e1cb827488
1 changed files with 4 additions and 4 deletions

View File

@ -4708,7 +4708,7 @@ bool ppu_interpreter_fast::FMADDS(ppu_thread& ppu, ppu_opcode_t op)
bool ppu_interpreter_precise::FMADDS(ppu_thread& ppu, ppu_opcode_t op) bool ppu_interpreter_precise::FMADDS(ppu_thread& ppu, ppu_opcode_t op)
{ {
const f64 res = ppu.fpr[op.frd] = f32(ppu.fpr[op.fra] * ppu.fpr[op.frc] + ppu.fpr[op.frb]); const f64 res = ppu.fpr[op.frd] = f32(std::fma(ppu.fpr[op.fra], ppu.fpr[op.frc], ppu.fpr[op.frb]));
ppu_fpcc_set(ppu, res, 0., op.rc); ppu_fpcc_set(ppu, res, 0., op.rc);
return true; return true;
} }
@ -4721,7 +4721,7 @@ bool ppu_interpreter_fast::FMSUBS(ppu_thread& ppu, ppu_opcode_t op)
bool ppu_interpreter_precise::FMSUBS(ppu_thread& ppu, ppu_opcode_t op) bool ppu_interpreter_precise::FMSUBS(ppu_thread& ppu, ppu_opcode_t op)
{ {
const f64 res = ppu.fpr[op.frd] = f32(ppu.fpr[op.fra] * ppu.fpr[op.frc] - ppu.fpr[op.frb]); const f64 res = ppu.fpr[op.frd] = f32(std::fma(ppu.fpr[op.fra], ppu.fpr[op.frc], -ppu.fpr[op.frb]));
ppu_fpcc_set(ppu, res, 0., op.rc); ppu_fpcc_set(ppu, res, 0., op.rc);
return true; return true;
} }
@ -4734,7 +4734,7 @@ bool ppu_interpreter_fast::FNMSUBS(ppu_thread& ppu, ppu_opcode_t op)
bool ppu_interpreter_precise::FNMSUBS(ppu_thread& ppu, ppu_opcode_t op) bool ppu_interpreter_precise::FNMSUBS(ppu_thread& ppu, ppu_opcode_t op)
{ {
const f64 res = ppu.fpr[op.frd] = f32(-(ppu.fpr[op.fra] * ppu.fpr[op.frc] - ppu.fpr[op.frb])); const f64 res = ppu.fpr[op.frd] = f32(-std::fma(ppu.fpr[op.fra], ppu.fpr[op.frc], -ppu.fpr[op.frb]));
ppu_fpcc_set(ppu, res, 0., op.rc); ppu_fpcc_set(ppu, res, 0., op.rc);
return true; return true;
} }
@ -4747,7 +4747,7 @@ bool ppu_interpreter_fast::FNMADDS(ppu_thread& ppu, ppu_opcode_t op)
bool ppu_interpreter_precise::FNMADDS(ppu_thread& ppu, ppu_opcode_t op) bool ppu_interpreter_precise::FNMADDS(ppu_thread& ppu, ppu_opcode_t op)
{ {
const f64 res = ppu.fpr[op.frd] = f32(-(ppu.fpr[op.fra] * ppu.fpr[op.frc] + ppu.fpr[op.frb])); const f64 res = ppu.fpr[op.frd] = f32(-std::fma(ppu.fpr[op.fra], ppu.fpr[op.frc], ppu.fpr[op.frb]));
ppu_fpcc_set(ppu, res, 0., op.rc); ppu_fpcc_set(ppu, res, 0., op.rc);
return true; return true;
} }