mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-09-01 02:05:21 +02:00
Every JIT backend puts the host FPU into the mode fcr31 asks for (bits 0-1 and 24) before running emulated code, and takes it back out before calling any host code. The plain interpreter did none of that, so all its float math rounded to nearest with denormals intact no matter what the game had set - cpu/fpu/fpu fails under -i and passes under the JIT on exactly this. Move the helpers the IR interpreter already had for this out of IRInterpreter and into MIPS.cpp as ApplyHostRoundingMode/RestoreHostRoundingMode, and use them around the interpreter's run loop and single step, restoring around syscalls and replacement functions, which are host code. ctc1 re-applies immediately, since the interpreter has no block boundary to defer it to. round.w.s changes with it: it was floorf(x + 0.5f), which is half-away-from-zero rather than the half-to-even every JIT produces, and the add would now pick up the guest's rounding mode on top of that. round_ieee_754 is both correct and mode-independent, and is what cvt.w.s already used for the same rounding. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01SfY7iFJEjmRXf1XGrTs4MF