ppu: improve fnmsub instruction
This commit is contained in:
@@ -4813,7 +4813,7 @@ bool ppu_interpreter::FMADD(ppu_thread& ppu, ppu_opcode_t op)
|
|||||||
|
|
||||||
bool ppu_interpreter::FNMSUB(ppu_thread& ppu, ppu_opcode_t op)
|
bool ppu_interpreter::FNMSUB(ppu_thread& ppu, ppu_opcode_t op)
|
||||||
{
|
{
|
||||||
ppu.fpr[op.frd] = -(ppu.fpr[op.fra] * ppu.fpr[op.frc]) + ppu.fpr[op.frb];
|
ppu.fpr[op.frd] = -(ppu.fpr[op.fra] * ppu.fpr[op.frc] - ppu.fpr[op.frb]);
|
||||||
if (UNLIKELY(op.rc)) fmt::throw_exception("%s: op.rc", __func__); //ppu_cr_set(ppu, 1, ppu.fpscr.fg, ppu.fpscr.fl, ppu.fpscr.fe, ppu.fpscr.fu);
|
if (UNLIKELY(op.rc)) fmt::throw_exception("%s: op.rc", __func__); //ppu_cr_set(ppu, 1, ppu.fpscr.fg, ppu.fpscr.fl, ppu.fpscr.fe, ppu.fpscr.fu);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4189,7 +4189,7 @@ void PPUTranslator::FNMSUB(ppu_opcode_t op)
|
|||||||
const auto a = GetFpr(op.fra);
|
const auto a = GetFpr(op.fra);
|
||||||
const auto b = GetFpr(op.frb);
|
const auto b = GetFpr(op.frb);
|
||||||
const auto c = GetFpr(op.frc);
|
const auto c = GetFpr(op.frc);
|
||||||
const auto result = m_ir->CreateFSub(b, m_ir->CreateFMul(a, c));
|
const auto result = m_ir->CreateFNeg(m_ir->CreateFSub(m_ir->CreateFMul(a, c), b));
|
||||||
SetFpr(op.frd, result);
|
SetFpr(op.frd, result);
|
||||||
|
|
||||||
//SetFPSCR_FR(Call(GetType<bool>(), m_pure_attr, "__fmadd_get_fr", a, b, c)); // TODO ???
|
//SetFPSCR_FR(Call(GetType<bool>(), m_pure_attr, "__fmadd_get_fr", a, b, c)); // TODO ???
|
||||||
|
|||||||
Reference in New Issue
Block a user