From de0017174792c44e7783faea955df1ce9b534306 Mon Sep 17 00:00:00 2001 From: LegendOfDragoon Date: Sun, 22 May 2016 23:28:07 -0700 Subject: [PATCH] Implement COP1_S_ROUND_L in cpu recompiler --- .../N64System/Recompiler/CodeSection.cpp | 1 + .../N64System/Recompiler/RecompilerOps.cpp | 12 ++++++++++++ .../N64System/Recompiler/RecompilerOps.h | 1 + 3 files changed, 14 insertions(+) diff --git a/Source/Project64-core/N64System/Recompiler/CodeSection.cpp b/Source/Project64-core/N64System/Recompiler/CodeSection.cpp index 9cfc153db..ea9fb0888 100644 --- a/Source/Project64-core/N64System/Recompiler/CodeSection.cpp +++ b/Source/Project64-core/N64System/Recompiler/CodeSection.cpp @@ -1292,6 +1292,7 @@ bool CCodeSection::GenerateX86Code(uint32_t Test) case R4300i_COP1_FUNCT_NEG: COP1_S_NEG(); break; case R4300i_COP1_FUNCT_SQRT: COP1_S_SQRT(); break; case R4300i_COP1_FUNCT_MOV: COP1_S_MOV(); break; + case R4300i_COP1_FUNCT_ROUND_L: COP1_S_ROUND_L(); break; case R4300i_COP1_FUNCT_TRUNC_L: COP1_S_TRUNC_L(); break; case R4300i_COP1_FUNCT_CEIL_L: COP1_S_CEIL_L(); break; //added by Witten case R4300i_COP1_FUNCT_FLOOR_L: COP1_S_FLOOR_L(); break; //added by Witten diff --git a/Source/Project64-core/N64System/Recompiler/RecompilerOps.cpp b/Source/Project64-core/N64System/Recompiler/RecompilerOps.cpp index c7dd1f425..0fe25f0bd 100644 --- a/Source/Project64-core/N64System/Recompiler/RecompilerOps.cpp +++ b/Source/Project64-core/N64System/Recompiler/RecompilerOps.cpp @@ -5946,6 +5946,18 @@ void CRecompilerOps::COP1_S_MOV() Load_FPR_ToTop(m_Opcode.fd, m_Opcode.fs, CRegInfo::FPU_Float); } +void CRecompilerOps::COP1_S_ROUND_L() +{ + CPU_Message(" %X %s", m_CompilePC, R4300iOpcodeName(m_Opcode.Hex, m_CompilePC)); + + m_Section->CompileCop1Test(); + if (m_Opcode.fd != m_Opcode.fs || !RegInStack(m_Opcode.fd, CRegInfo::FPU_Float)) + { + Load_FPR_ToTop(m_Opcode.fd, m_Opcode.fs, CRegInfo::FPU_Float); + } + ChangeFPURegFormat(m_Opcode.fd, CRegInfo::FPU_Float, CRegInfo::FPU_Qword, CRegInfo::RoundNearest); +} + void CRecompilerOps::COP1_S_TRUNC_L() { CPU_Message(" %X %s", m_CompilePC, R4300iOpcodeName(m_Opcode.Hex, m_CompilePC)); diff --git a/Source/Project64-core/N64System/Recompiler/RecompilerOps.h b/Source/Project64-core/N64System/Recompiler/RecompilerOps.h index 0bcc46866..983f85eb7 100644 --- a/Source/Project64-core/N64System/Recompiler/RecompilerOps.h +++ b/Source/Project64-core/N64System/Recompiler/RecompilerOps.h @@ -160,6 +160,7 @@ protected: static void COP1_S_NEG (); static void COP1_S_SQRT (); static void COP1_S_MOV (); + static void COP1_S_ROUND_L (); static void COP1_S_TRUNC_L (); static void COP1_S_CEIL_L (); //added by Witten static void COP1_S_FLOOR_L (); //added by Witten