Closed Pokechu22 closed 2 years ago
Indeed, according to the PEM, bit 12 shall be set to 1 if the input is an SNaN (i.e. SNaN gets converted into QNan).
Not sure why Dolphin is failing on the smallest single normal, though.
Turns out this was fixed in a still open PR from 2014... PR #23
As for the case where Dolphin is wrong, this should be filed on the Dolphin issue tracker. Presumably the hardware is flushing subnormals to zero before rounding instead of after. This would require a small performance hit to be accurately emulated in Dolphin.
Console failure fixed in https://github.com/dolphin-emu/hwtests/pull/23, Dolphin failure fixed for interpreter in https://github.com/dolphin-emu/dolphin/pull/10959.
On my Wii, running the frsp test results in this output:
On Dolphin (with both the x64 JIT and the cached interpreter), I get this output:
My conclusion is that the test incorrectly handles SNaN:
https://github.com/dolphin-emu/hwtests/blob/328faf95cefe9f1d2e8cb0800f4d92c2e21a2a66/cputest/frsp.cpp#L22
though Dolphin is incorrectly handling the other case (I previously linked the wrong line (the one for smallest positive single normal); this is the correct one):
https://github.com/dolphin-emu/hwtests/blob/328faf95cefe9f1d2e8cb0800f4d92c2e21a2a66/cputest/frsp.cpp#L18