-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
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
SPU Precise interpreter: More efficient float exceptions detection #4155
Conversation
GCC is clearly optimizing setting the floating point rounding mode as soon as you actually tun on compiler optimization. https://godbolt.org/g/j1f1GH |
Just a reminder that our appimages are built with Clang 5.0 |
rpcs3/Emu/Cell/SPUInterpreter.cpp
Outdated
@@ -1899,18 +1899,19 @@ static void DFASM(SPUThread& spu, spu_opcode_t op, DoubleOp operation) | |||
case DFASM_S: result = a - b; break; | |||
case DFASM_M: result = a * b; break; | |||
} | |||
if (fetestexcept(FE_INVALID)) | |||
const u32 e = fetestexcept(FE_ALL_EXCEPT); |
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.
e?
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.
a shortcut for exceptions
rpcs3/Emu/Cell/SPUThread.cpp
Outdated
@@ -1262,34 +1262,32 @@ bool SPUThread::set_ch_value(u32 ch, u32 value) | |||
if (code < 64) | |||
{ | |||
/* ===== sys_spu_thread_send_event (used by spu_printf) ===== */ | |||
|
|||
u32 spup = code & 63; |
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.
No useless changes, please.
@elad335 I don't see where your problem is. The call to fesetround is clearly inlined. The copy of set_rounding is created because that function might be exported. It won't happen if you declare it static which is the case in SPUInterpreter. See https://godbolt.org/g/kyFsfP |
rpcs3/Emu/Cell/SPUInterpreter.cpp
Outdated
{ | ||
spu.fpscr.setDoublePrecisionExceptionFlags(i, FPSCR_DINV); | ||
result = DOUBLE_NAN; | ||
} | ||
else | ||
{ | ||
if (fetestexcept(FE_OVERFLOW)) | ||
if (e & FE_OVERFLOW) |
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.
_mm_getcsr is not compatible with these constants.
There are _MM_MASK_OVERFLOW and similar ones.
read once the MXCSR register and use his value to check for all exceptions
Optimize floating point exception checking :
read once the MXCSR register and use his value to check for all exceptions.
Optimize setting the floating point's rounding mode with constant values ( also the first commit ) ,cause the compiler won't do it on his own ,as tested in godbolt .