mirror of
https://github.com/ARMSX2/ARMSX2.git
synced 2026-08-24 16:50:16 -07:00
The non-full (eeClampMode 0/1/2) FPU arithmetic reproduced the INTERPRETER (pcsx2/FPU.cpp): fpuDouble denormal-flush on inputs, checkOverflow+checkUnderflow with FCR31 O/U flags on outputs, applied unconditionally. The x86 recompiler -- the port's ground truth -- does none of that: it clamps operands only at eeClampMode>=2 (sign-preserving inf/NaN -> +/-fmax, no denormal flush), clamps the result only at eeClampMode>=1 (NaN->+fmax, +/-Inf->+/-fmax), does no underflow, and does not maintain the O/U flags for arithmetic. Games with an eeClampMode gamefix (True Crime: New York City = 2) therefore rendered wrong on this rec. Port iFPU.cpp faithfully for ADD/SUB/MUL(+A), DIV, SQRT, RSQRT, MADD/MSUB(+A), MAX/MIN, C.EQ/LT/LE, ABS/NEG: new emitClampOperandBits/emitClampResultBits/ emitLoadOperandX86/emitStoreResultX86 helpers gated on fpuOverflow/fpuExtraOverflow; MADD/MSUB use x86's uniform mul->clamp->guard-bit add->clamp (no interp fd/ACC asymmetry, no ACCflag). Full mode (eeClampMode 3, iFPUd) and the DIV/SQRT/RSQRT I/D flag logic are unchanged. Removed the now-dead interpreter-matching helpers. Fixes True Crime: New York City.