x87: Fix FPREM/FPREM1 semantics in dynarec and interpreter#3505
x87: Fix FPREM/FPREM1 semantics in dynarec and interpreter#3505ptitSeb merged 1 commit intoptitSeb:mainfrom
Conversation
Signed-off-by: Zewei Yang <yangzewei@loongson.cn>
|
Can you check your changes with games llike Flatout / Flatout 2 ? |
I discovered this while running NumPy's official test cases |
However, it is certain that this problem can be reproduced. |
|
Ok, I'll check later, and roll back the change if I notice regressions (this opcode is sensitive) |
No problem, thank you! |
FPREM is now calculated using fmod, and the lower-order quotient is calculated using trunc(x/y) to write back the condition code bits (C0/C1/C2/C3).
FPREM1 is now calculated using remquo, ensuring that the remainder matches the lower 3 condition code bits of the quotient.
Special inputs such as NaN/Inf/division by zero are handled separately, and abnormal behavior is aligned with the x87 expected flag.