From 054c1b32eb4bbde226de6fd70c70c25bd0cf5535 Mon Sep 17 00:00:00 2001 From: Lioncash Date: Sat, 26 May 2018 16:05:30 -0400 Subject: [PATCH] Interpreter_FPUtils: Set FPSCR.VXSNAN if either operand to NI_add() is a signaling NaN This corrects VXSNAN flag setting for fadd, fadds, ps_add, ps_sum0, and ps_sum1 --- .../Core/Core/PowerPC/Interpreter/Interpreter_FPUtils.h | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_FPUtils.h b/Source/Core/Core/PowerPC/Interpreter/Interpreter_FPUtils.h index 01847fbddc..2d16cbea84 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_FPUtils.h +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_FPUtils.h @@ -137,16 +137,22 @@ inline double NI_div(double a, double b) inline double NI_add(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); + SetFPException(FPSCR_VXISI); return PPC_NAN; } + return t; }