Implemented FPU precision control for 32-bit non-Windows platforms.

git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@272 8ced0084-cf51-0410-be5f-012b33b47a6e
This commit is contained in:
Maarten ter Huurne
2008-08-22 17:46:13 +00:00
parent 292120453e
commit 31c0bc4508

View File

@ -26,6 +26,11 @@
#include "../../Core.h" #include "../../Core.h"
#include "PowerPCDisasm.h" #include "PowerPCDisasm.h"
#include "../../IPC_HLE/WII_IPC_HLE.h" #include "../../IPC_HLE/WII_IPC_HLE.h"
static const unsigned short FPU_PREC_24 = 0 << 8;
static const unsigned short FPU_PREC_53 = 2 << 8;
static const unsigned short FPU_PREC_64 = 3 << 8;
static const unsigned short FPU_PREC_MASK = 3 << 8;
// cpu register to keep the code readable // cpu register to keep the code readable
u32* CInterpreter::m_GPR = PowerPC::ppcState.gpr; u32* CInterpreter::m_GPR = PowerPC::ppcState.gpr;
@ -50,11 +55,18 @@ void CInterpreter::RunTable63(UGeckoInstruction _inst) {m_opTable63[_inst.SUBOP1
void CInterpreter::sInit() void CInterpreter::sInit()
{ {
// Crash(); // Crash();
#ifdef _M_IX86
// sets the floating-point lib to 53-bit // sets the floating-point lib to 53-bit
// PowerPC has a 53bit floating pipeline only // PowerPC has a 53bit floating pipeline only
// eg: sscanf is very sensitive // eg: sscanf is very sensitive
#ifdef _M_IX86 #ifdef _WIN32
_control87(_PC_53, MCW_PC); _control87(_PC_53, MCW_PC);
#else
unsigned short mode;
asm ("fstcw %0" : : "m" (mode));
mode = (mode & ~FPU_PREC_MASK) | FPU_PREC_53;
asm ("fldcw %0" : : "m" (mode));
#endif
#else #else
//x64 doesn't need this - fpu is done with SSE //x64 doesn't need this - fpu is done with SSE
//but still - set any useful sse options here //but still - set any useful sse options here