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

PPU: Fix VMAXFP, VMINFP NaN handling #8659

Merged
merged 3 commits into from
Aug 3, 2020
Merged

Conversation

elad335
Copy link
Contributor

@elad335 elad335 commented Jul 30, 2020

Using ordered (and even unordered) floating comparison to determine MIN/MAX floating pointing value results in a bug where the VMAXFP/VMINFP instructions on realhw always select NaN operand as the result if either is a NaN (with the ordering of VA then VB) but on master only the "greater/lower" value is selected making NaN not always return as the result when either of the operands is a NaN.
The correct behaviour is the opposite as x86's instructions MAXPS, MINPS (as std::fmax, std::fmin). So use the opposite operand from the result of the opposite instruction.

Misc: Improve cpu_translator::fre() and cpu_translator::frsqe() to accept unevaluated expressions, evaluate them in-place.

@elad335 elad335 force-pushed the fix-min-max-fp branch 4 times, most recently from bb376ec to 4c5ace4 Compare July 30, 2020 16:39
@elad335 elad335 changed the title PPU LLVM: Fix VMAXFP, VMINFP NaN handling PPU: Fix VMAXFP, VMINFP NaN handling Jul 30, 2020
@elad335 elad335 marked this pull request as draft July 30, 2020 16:49
@elad335
Copy link
Contributor Author

elad335 commented Jul 30, 2020

I will add interpreters fix as well.

@elad335 elad335 marked this pull request as ready for review July 30, 2020 17:03
@elad335 elad335 force-pushed the fix-min-max-fp branch 2 times, most recently from b2da0e8 to 130534e Compare July 30, 2020 17:13
@elad335
Copy link
Contributor Author

elad335 commented Jul 30, 2020

Makes the testcase https://github.com/elad335/ps3autotests/blob/master/tests/cpu/ppu_vpu/ppu_vpu.expected match rpcs3 output for these instructions on interpreters.

@AniLeo AniLeo merged commit 70fb571 into RPCS3:master Aug 3, 2020
@elad335 elad335 deleted the fix-min-max-fp branch August 27, 2020 14:34
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.

2 participants