-
Notifications
You must be signed in to change notification settings - Fork 43
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
FPU Rounding Control #25
Comments
Some more info: According to mips documentation bits [0:1] of CP1.FCSR register ($31) set the rounding mode (modes in order being nearest, zero, +inf, -inf).
Though a quick test on cen64 yielded no difference in the results, as far as I can tell only the forced rounding modes are implemented there (ceil/floor) and it always uses nearest mode otherwise. |
I thought the explicit rounding opcodes weren't affected by the rounding bit. The last time I looked at the FPU pipeline, rounding is applied before writeback so I think that stage is affected by the rounding control bit (except for those rounding instructions). This make senses in general when an application requires control over the rounding mode for all FPU operations globally so it doesn't have to do it explicitly. For PJ64, it updates the x87 FPU rounding mode according to the register bit, so that means its applying the rounding mode to all operations done in the native FPU pipeline. |
Yes, thats what I meant with those being implemented on cen64 (its programmed to switch to the according rounding mode for those opcodes).
A quick test with a modified CP1DIV test rom on PJ64 using the two instructions above reveals at least different results, which indicates that the rounding control bits make a difference there (haven't checked if the results are correct). The same modified test rom makes no difference on cen64, mupen64plus wouldn't boot it (maybe I'll look into that at some point). |
Small update: I got the test rom to boot on mupen64plus as well (mupen64plus/mupen64plus-core#692), actually it just didn't display anything, With the modified rom it produces the same results as PJ64. |
Thanks for all the info & testing Zapeth & bryanperris, |
The current set of CP1 test roms all test against the FPU while using the default rounding mode: nearest. Having tests using the other 3 modes would be helpful: toward zero, toward positive infinity, toward negative infinity.
http://www.cplusplus.com/reference/cfenv/fesetround/
The text was updated successfully, but these errors were encountered: