From 1f5d54f5a68837685fd8f53b72991ad3afce630c Mon Sep 17 00:00:00 2001 From: Shawn Hoffman Date: Sat, 19 Feb 2011 09:56:54 +0000 Subject: [PATCH] Handle NaN in fselx. Fixes issue 4106. git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@7200 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Src/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp index 6468b875dc..b29b7dad35 100644 --- a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp +++ b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp @@ -242,7 +242,9 @@ void Interpreter::fnegx(UGeckoInstruction _inst) void Interpreter::fselx(UGeckoInstruction _inst) { - rPS0(_inst.FD) = (rPS0(_inst.FA) >= -0.0) ? rPS0(_inst.FC) : rPS0(_inst.FB); + // D = (A >= 0) ? C : B + rPS0(_inst.FD) = (rPS0(_inst.FA) < 0.0 || riPS0(_inst.FA) == PPC_NAN_U64) ? + rPS0(_inst.FB) : rPS0(_inst.FC); // This is a binary instruction. Does not alter FPSCR if (_inst.Rc) Helper_UpdateCR1(rPS0(_inst.FD)); }