diff options
| author | Lioncash <mathew1800@gmail.com> | 2018-05-27 15:56:25 -0400 |
|---|---|---|
| committer | Lioncash <mathew1800@gmail.com> | 2018-05-27 16:29:42 -0400 |
| commit | f4c5ceba1cf9622f421338a1a00a6565753ff54e (patch) | |
| tree | d9f2a94c195a68f9b5e499a72baac5e0e04e5a6b /Source/Core | |
| parent | e9ce75ccc41938f81b7e4e36a7b4ab72f9007c3d (diff) | |
Interpreter_FPUtils: Set FPSCR.VXSNAN if either operand to NI_div is a signaling NaN
If either operand is a signaling NaN, we need to signify that by setting
the VXSNAN bit.
This fixes NaN flag setting for fdiv, fdivs and ps_div instructions.
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/Core/PowerPC/Interpreter/Interpreter_FPUtils.h | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_FPUtils.h b/Source/Core/Core/PowerPC/Interpreter/Interpreter_FPUtils.h index 2d16cbea84..5a583b7892 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_FPUtils.h +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_FPUtils.h @@ -113,13 +113,18 @@ inline double NI_mul(double a, double b) inline double NI_div(double a, double b) { - double t = a / b; + const double t = a / b; + if (std::isnan(t)) { + if (Common::IsSNAN(a) || Common::IsSNAN(b)) + SetFPException(FPSCR_VXSNAN); + if (std::isnan(a)) return MakeQuiet(a); if (std::isnan(b)) return MakeQuiet(b); + if (b == 0.0) { SetFPException(FPSCR_ZX); @@ -130,8 +135,10 @@ inline double NI_div(double a, double b) { SetFPException(FPSCR_VXIDI); } + return PPC_NAN; } + return t; } |
