Skip to content
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

R5900: Use unsigned math for add/sub instructions #5252

Merged
merged 2 commits into from
Jan 17, 2022
Merged

R5900: Use unsigned math for add/sub instructions #5252

merged 2 commits into from
Jan 17, 2022

Conversation

stenzek
Copy link
Contributor

@stenzek stenzek commented Jan 2, 2022

Description of Changes

For the interpreter and dynarec constant prop, this was causing different code to be generates at -O0 and -O3 in clang. As best I can tell, it's due to there being a possibility of signed overflow, thus the high bits are irrelevant. Except for us, when we're simulating a CPU.

"Bad" code was only generated in clang, msvc and gcc were fine.

Case which prompted this was Juiced 2, but there may be others.

Rationale behind Changes

Getting rid of undefined behaviour and fixing game crashes, yay.

Suggested Testing Steps

Quick testing in interpreter and dynarec to make sure nothing was relying on this broken behaviour. Preferably with clang.

Copy link
Member

@F0bes F0bes left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ran a few games with this compiled with Clang. No issues noticed.

@lightningterror lightningterror merged commit 7b6a263 into PCSX2:master Jan 17, 2022
@stenzek stenzek deleted the ub-chan-says-hi-again branch June 22, 2022 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants