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
DSP masking and sign extension fixes #10032
Conversation
|
kinda unrelated, but have you seen https://github.com/dolphin-emu/dolphin/blob/master/Source/Core/Core/DSP/Interpreter/DSPIntMultiplier.cpp#L104 / know example that triggers the error the comment is talking about? Wanted to check it out before (but don't have hw to test on... :) ) |
|
I don't, but I'm guessing it's similar to the rounding that happens with e.g. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Echoing what @Tilka said on IRC in that we really should be making the tests for the unit-testing system that runs for every PR instead of for one that needs to manually be run
5af1270
to
e17cda9
Compare
The extension needs to happen in SetLongAcc, not GetLongAcc, as the extension needs to always be reflected in acS.h. There is no functional difference with the write handler for acS.h, but it is more readable than 4 casts in a row.
m_gpr.WriteReg calls PutReg which already handles the sign extension.
e17cda9
to
439bf15
Compare
The
crandprod.hregisters are 8 bits and do not experience sign extension. Also, theSR_100bit always seems to read back as 0, regardless of what's written to itsr. Lastly,ac0.handac1.hdo experience sign extension; this is already implemented, but the implementation worked incorrectly on the interpreter when the wholeacc0oracc1register was updated and thenac0.horac1.hwere read back directly.Results
Apologies for how unreadable this is. Think of it more as a table of thumbnails than something you can directly compare.
For the less test, the JIT behaves the same as it did before and as it does now, as it handled sign extension properly. Its result is not correct for the
srregister, but that's a separate issue (the JIT seems to not update flags for overflow properly) which will be handled later. The interpreter now exactly matches hardware.For the other tests, the old JIT and old interpreter had the same incorrect behavior, and the new JIT and the new interpreter have the same behavior that matches hardware.
I'm not completely confident on the code for the JIT, which I based based on the code for
DSP_REG_ACH0. It seems to work, but the TODO about immediate values is a bit odd.