From b6eb1c3234cb5b24918bc69a4086a44d471e9e70 Mon Sep 17 00:00:00 2001 From: unknown Date: Tue, 15 Sep 2015 15:03:05 -0400 Subject: [PATCH] Try to use intrinsics for COP1 single-precision square root? --- .../N64 System/Interpreter/Interpreter Ops.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/Source/Project64/N64 System/Interpreter/Interpreter Ops.cpp b/Source/Project64/N64 System/Interpreter/Interpreter Ops.cpp index 064cc3c4d..f101efabf 100644 --- a/Source/Project64/N64 System/Interpreter/Interpreter Ops.cpp +++ b/Source/Project64/N64 System/Interpreter/Interpreter Ops.cpp @@ -2419,12 +2419,12 @@ void R4300iOp::COP1_S_DIV() void R4300iOp::COP1_S_SQRT() { + float * Dest = (float *)(_FPR_S[m_Opcode.fd]); + float * Source = (float *)(_FPR_S[m_Opcode.fs]); + TEST_COP1_USABLE_EXCEPTION _controlfp(*_RoundingModel,_MCW_RC); - #ifdef _M_IX86 - float * Dest = (float *)_FPR_S[m_Opcode.fd]; - float * Source = (float *)_FPR_S[m_Opcode.fs]; _asm { push esi @@ -2436,7 +2436,11 @@ void R4300iOp::COP1_S_SQRT() pop esi } #else - g_Notify->BreakPoint(__FILEW__,__LINE__); + __m128 xmm; + + xmm = _mm_load_ss(Source); + xmm = _mm_sqrt_ss(xmm); + *(Dest) = _mm_cvtss_f32(xmm); #endif }