static bool fmaddGeneric(PPCEmuAssembler& a, Instruction instr) { if (instr.rc) { return jit_fallback(a, instr); } // FPSCR, FPRF supposed to be updated here... auto result = a.allocXmmTmp(); { auto srcC = a.loadRegisterRead(a.fprps[instr.frC]); // Do the rounding first so we don't run out of host registers if (ShouldRound) { auto tmpSrcC = a.allocXmmTmp(srcC); roundTo24BitSd(a, tmpSrcC); srcC = tmpSrcC; } auto srcA = a.loadRegisterRead(a.fprps[instr.frA]); auto srcB = a.loadRegisterRead(a.fprps[instr.frB]); a.movq(result, srcA); if (hostHasFMA3()) { if (ShouldSubtract) { a.vfmsub132sd(result, srcB, srcC); } else { a.vfmadd132sd(result, srcB, srcC); } } else { // no FMA3 a.mulsd(result, srcC); if (ShouldSubtract) { a.subsd(result, srcB); } else { a.addsd(result, srcB); } } } if (ShouldNegate) { negateXmmSd(a, result); } if (ShouldRound) { roundToSingleSd(a, result, result); auto dst = a.loadRegisterWrite(a.fprps[instr.frD]); a.movddup(dst, result); } else { auto dst = a.loadRegisterReadWrite(a.fprps[instr.frD]); a.movsd(dst, result); } return true; }