microVU/macroVU: When subtracting a reg by itself, its safer to just set the reg to 0, instead of actually doing the floating point subtraction.

This fixes the problems in FFX2 introduced in r1710.
Also thanks to rama who found out it was SUB that was breaking the game. (Saved me a lot of debugging to narrow down the problem ;p)

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@1726 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
cottonvibes 2009-09-02 04:48:42 +00:00
parent 646bf1bfac
commit 5494e9cd6f
1 changed files with 16 additions and 0 deletions

View File

@ -117,6 +117,20 @@ void setupPass1(microVU* mVU, int opCase, bool isACC, bool noFlagUpdate) {
if (noFlagUpdate) { sFLAG.doFlag = 0; }
}
// Safer to force 0 as the result for X minus X than to do actual subtraction
bool doSafeSub(microVU* mVU, int opCase, int opType, bool isACC) {
opCase1 {
if ((opType == 1) && (_Ft_ == _Fs_)) {
int Fs = mVU->regAlloc->allocReg(-1, isACC ? 32 : _Fd_, _X_Y_Z_W);
SSE2_PXOR_XMM_to_XMM(Fs, Fs); // Set to Positive 0
mVUupdateFlags(mVU, Fs, -1);
mVU->regAlloc->clearNeeded(Fs);
return 1;
}
}
return 0;
}
// Sets Up Ft Reg for Normal, BC, I, and Q Cases
void setupFtReg(microVU* mVU, int& Ft, int& tempFt, int opCase) {
opCase1 {
@ -141,6 +155,8 @@ void setupFtReg(microVU* mVU, int& Ft, int& tempFt, int opCase) {
void mVU_FMACa(microVU* mVU, int recPass, int opCase, int opType, bool isACC, const char* opName) {
pass1 { setupPass1(mVU, opCase, isACC, ((opType == 3) || (opType == 4))); }
pass2 {
if (doSafeSub(mVU, opCase, opType, isACC)) return;
int Fs, Ft, ACC, tempFt;
setupFtReg(mVU, Ft, tempFt, opCase);