From d3716fd295f007fa0bbcedb284dfb54837f815f1 Mon Sep 17 00:00:00 2001 From: ramapcsx2 Date: Wed, 10 Mar 2010 10:59:10 +0000 Subject: [PATCH] Avoid using MMX in EErec operations where possible. This bypasses hangs in Bully for now. The problem needs to be fixed more thoroughly in the future, by rewriting several opcodes. You can find all changed locations via the comment "// Fixme: MMX problem". git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2688 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/x86/ix86-32/iR5900Arit.cpp | 18 ++++++++++++------ pcsx2/x86/ix86-32/iR5900Branch.cpp | 7 ++++--- pcsx2/x86/ix86-32/iR5900Move.cpp | 12 ++++++++---- pcsx2/x86/ix86-32/iR5900Templates.cpp | 5 +++-- 4 files changed, 27 insertions(+), 15 deletions(-) diff --git a/pcsx2/x86/ix86-32/iR5900Arit.cpp b/pcsx2/x86/ix86-32/iR5900Arit.cpp index 074a940e42..edd15d31ee 100644 --- a/pcsx2/x86/ix86-32/iR5900Arit.cpp +++ b/pcsx2/x86/ix86-32/iR5900Arit.cpp @@ -65,7 +65,8 @@ void recADD_constv(int info, int creg, int vreg) { pxAssert( !(info&PROCESS_EE_XMM) ); - if(!g_cpuConstRegs[ creg ].UL[0]) { + // Fixme: MMX problem + if(0/*!g_cpuConstRegs[ creg ].UL[0]*/) { int mmreg = _allocMMXreg(-1, MMX_GPR+_Rd_, MODE_WRITE); SetMMXstate(); @@ -200,7 +201,8 @@ void recDADD_constv(int info, int creg, int vreg) { pxAssert( !(info&PROCESS_EE_XMM) ); - if( g_cpuConstRegs[ creg ].UL[0] == 0 && g_cpuConstRegs[ creg ].UL[1] == 0 && _hasFreeMMXreg() ) { + // Fixme: MMX problem + if(0/* g_cpuConstRegs[ creg ].UL[0] == 0 && g_cpuConstRegs[ creg ].UL[1] == 0 && _hasFreeMMXreg() */) { // copy int mmreg = _allocMMXreg(-1, MMX_GPR+_Rd_, MODE_WRITE); if( EEINST_ISLIVE1(_Rd_) ) MOVQMtoR(mmreg, (int)&cpuRegs.GPR.r[ vreg ].UL[ 0 ]); @@ -342,7 +344,8 @@ void recSUB_constt(int info) EEINST_SETSIGNEXT(_Rs_); EEINST_SETSIGNEXT(_Rd_); - if(!g_cpuConstRegs[_Rt_].UL[0]) { + // Fixme: MMX problem + if(0/*!g_cpuConstRegs[_Rt_].UL[0]*/) { int mmreg = _allocMMXreg(-1, MMX_GPR+_Rd_, MODE_WRITE); SetMMXstate(); @@ -675,7 +678,8 @@ void recOR_constv(int info, int creg, int vreg) { pxAssert( !(info & PROCESS_EE_XMM) ); - if(_Rd_ != vreg && _hasFreeMMXreg()) { + // Fixme: MMX problem + if(0/*_Rd_ != vreg && _hasFreeMMXreg()*/) { int rdreg = _allocMMXreg(-1, MMX_GPR+_Rd_, MODE_WRITE); SetMMXstate(); @@ -738,7 +742,8 @@ void recXOR_constv(int info, int creg, int vreg) { pxAssert( !(info & PROCESS_EE_XMM) ); - if(_Rd_ != vreg && _hasFreeMMXreg()) { + // Fixme: MMX problem + if(0/*_Rd_ != vreg && _hasFreeMMXreg()*/) { int rdreg = _allocMMXreg(-1, MMX_GPR+_Rd_, MODE_WRITE); SetMMXstate(); MOVQMtoR(rdreg, (u32)&cpuRegs.GPR.r[vreg].UL[0] ); @@ -800,7 +805,8 @@ void recNOR_constv(int info, int creg, int vreg) { pxAssert( !(info & PROCESS_EE_XMM) ); - if(_Rd_ != vreg && _hasFreeMMXreg()) { + // Fixme: MMX problem + if(0/*_Rd_ != vreg && _hasFreeMMXreg()*/) { int rdreg = _allocMMXreg(-1, MMX_GPR+_Rd_, MODE_WRITE); int t0reg = _allocMMXreg(-1, MMX_TEMP, 0); diff --git a/pcsx2/x86/ix86-32/iR5900Branch.cpp b/pcsx2/x86/ix86-32/iR5900Branch.cpp index c906271f20..997a4a3452 100644 --- a/pcsx2/x86/ix86-32/iR5900Branch.cpp +++ b/pcsx2/x86/ix86-32/iR5900Branch.cpp @@ -192,9 +192,10 @@ void recSetBranchEQ(int info, int bne, int process) void recSetBranchL(int ltz) { - int regs = _checkMMXreg(MMX_GPR+_Rs_, MODE_READ); + // Fixme: MMX problem + int regs;/* = _checkMMXreg(MMX_GPR+_Rs_, MODE_READ);*/ - if( regs >= 0 ) { + /*if( regs >= 0 ) { int t0reg = _allocMMXreg(-1, MMX_TEMP, 0); @@ -213,7 +214,7 @@ void recSetBranchL(int ltz) else j32Ptr[ 0 ] = JNZ32( 0 ); return; - } + }*/ regs = _checkXMMreg(XMMTYPE_GPRREG, _Rs_, MODE_READ); diff --git a/pcsx2/x86/ix86-32/iR5900Move.cpp b/pcsx2/x86/ix86-32/iR5900Move.cpp index 14e38aa41e..e434372949 100644 --- a/pcsx2/x86/ix86-32/iR5900Move.cpp +++ b/pcsx2/x86/ix86-32/iR5900Move.cpp @@ -442,7 +442,8 @@ void recMOVZtemp_consts(int info) void recMOVZtemp_constt(int info) { - if( _hasFreeXMMreg() ) { + // Fixme: MMX problem + if(0/* _hasFreeXMMreg() */) { int t0reg = _allocMMXreg(-1, MMX_TEMP, 0); MOVQMtoR(t0reg, (int)&cpuRegs.GPR.r[ _Rs_ ].UL[ 0 ]); MOVQRtoM((int)&cpuRegs.GPR.r[ _Rd_ ].UL[ 0 ], t0reg); @@ -460,7 +461,8 @@ void recMOVZtemp_(int info) { int t0reg = -1; - if( _hasFreeXMMreg() ) + // Fixme: MMX problem + if(0/* _hasFreeXMMreg() */) t0reg = _allocMMXreg(-1, MMX_TEMP, 0); MOV32MtoR( EAX, (int)&cpuRegs.GPR.r[ _Rt_ ].UL[ 0 ] ); @@ -519,7 +521,8 @@ void recMOVNtemp_consts(int info) void recMOVNtemp_constt(int info) { - if( _hasFreeXMMreg() ) { + // Fixme: MMX problem + if(0/* _hasFreeXMMreg() */) { int t0reg = _allocMMXreg(-1, MMX_TEMP, 0); MOVQMtoR(t0reg, (int)&cpuRegs.GPR.r[ _Rs_ ].UL[ 0 ]); MOVQRtoM((int)&cpuRegs.GPR.r[ _Rd_ ].UL[ 0 ], t0reg); @@ -537,7 +540,8 @@ void recMOVNtemp_(int info) { int t0reg=-1; - if( _hasFreeXMMreg() ) + // Fixme: MMX problem + if(0/* _hasFreeXMMreg() */) t0reg = _allocMMXreg(-1, MMX_TEMP, 0); MOV32MtoR( EAX, (int)&cpuRegs.GPR.r[ _Rt_ ].UL[ 0 ] ); diff --git a/pcsx2/x86/ix86-32/iR5900Templates.cpp b/pcsx2/x86/ix86-32/iR5900Templates.cpp index aa9145df52..f9c17a8786 100644 --- a/pcsx2/x86/ix86-32/iR5900Templates.cpp +++ b/pcsx2/x86/ix86-32/iR5900Templates.cpp @@ -70,9 +70,10 @@ void _deleteEEreg(int reg, int flush) // if not mmx, then xmm int eeProcessHILO(int reg, int mode, int mmx) { - int usemmx = mmx && _hasFreeMMXreg(); + // Fixme: MMX problem + int usemmx = 0/*mmx && _hasFreeMMXreg()*/; if( (usemmx || _hasFreeXMMreg()) || !(g_pCurInstInfo->regs[reg]&EEINST_LASTUSE) ) { - if( usemmx ) return _allocMMXreg(-1, MMX_GPR+reg, mode); + //if( usemmx ) return _allocMMXreg(-1, MMX_GPR+reg, mode); return _allocGPRtoXMMreg(-1, reg, mode); }