From 59e37dad4bf529d00450ab27a4319ae7c6008ab1 Mon Sep 17 00:00:00 2001 From: arcum42 Date: Mon, 15 Dec 2008 02:49:30 +0000 Subject: [PATCH] Prevent t2reg from having a chance of being assigned to the same register as t1reg. Turn FPU_ADD_SUB_HACK off for 64 bit builds. git-svn-id: http://pcsx2-playground.googlecode.com/svn/trunk@432 a6443dda-0b58-4228-96e9-037be469359c --- pcsx2/x86/iFPU.c | 4 ++++ pcsx2/x86/iVUmicro.c | 12 ++++++------ pcsx2/x86/iVUzerorec.cpp | 2 ++ 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/pcsx2/x86/iFPU.c b/pcsx2/x86/iFPU.c index 5f6f1a7a21..dff632fdb1 100644 --- a/pcsx2/x86/iFPU.c +++ b/pcsx2/x86/iFPU.c @@ -49,7 +49,11 @@ #define FPUflagSO 0X00000010 #define FPUflagSU 0X00000008 +#ifndef __x86_64__ #define FPU_ADD_SUB_HACK 1 // Add/Sub opcodes produce more ps2-like results if set to 1 +#else +#define FPU_ADD_SUB_HACK 0 // DEC32R doesn't work on 64 bits +#endif extern PCSX2_ALIGNED16_DECL(u32 g_minvals[4]); extern PCSX2_ALIGNED16_DECL(u32 g_maxvals[4]); diff --git a/pcsx2/x86/iVUmicro.c b/pcsx2/x86/iVUmicro.c index 9680db1751..49f0b2d887 100644 --- a/pcsx2/x86/iVUmicro.c +++ b/pcsx2/x86/iVUmicro.c @@ -3589,7 +3589,7 @@ void recVUMI_FTOI0(VURegs *VU, int info) t1reg = _vuGetTempXMMreg(info); if( t1reg >= 0 ) { // If theres a temp XMM reg available - for (t2reg = 0; ( (t2reg == EEREC_S) || (t2reg == EEREC_T) || (t2reg == EEREC_TEMP) ); t2reg++) + for (t2reg = 0; ( (t2reg == EEREC_S) || (t2reg == EEREC_T) || (t2reg == EEREC_TEMP) || (t2reg == t1reg) ); t2reg++) ; // Find unused reg (For second temp reg) SSE_MOVAPS_XMM_to_M128((uptr)FTIO_Temp1, t2reg); // Backup XMM reg @@ -3633,7 +3633,7 @@ void recVUMI_FTOI0(VURegs *VU, int info) SSE_MOVAPS_XMM_to_M128((uptr)FTIO_Temp1, t1reg); // Backup t1reg XMM reg recVUMI_FTOI_Saturate(EEREC_S, EEREC_T, EEREC_TEMP, t1reg); // Saturate if Float->Int conversion returned illegal result - + SSE_MOVAPS_M128_to_XMM(t1reg, (uptr)FTIO_Temp1); // Restore t1reg XMM reg } } @@ -3645,7 +3645,7 @@ void recVUMI_FTOI0(VURegs *VU, int info) t1reg = _vuGetTempXMMreg(info); if( t1reg >= 0 ) { // If theres a temp XMM reg available - for (t2reg = 0; ( (t2reg == EEREC_S) || (t2reg == EEREC_T) || (t2reg == EEREC_TEMP) ); t2reg++) + for (t2reg = 0; ( (t2reg == EEREC_S) || (t2reg == EEREC_T) || (t2reg == EEREC_TEMP) || (t2reg == t1reg)); t2reg++) ; // Find unused reg (For second temp reg) SSE_MOVAPS_XMM_to_M128((uptr)FTIO_Temp1, t2reg); // Backup XMM reg @@ -3691,7 +3691,7 @@ void recVUMI_FTOIX(VURegs *VU, int addr, int info) t1reg = _vuGetTempXMMreg(info); if( t1reg >= 0 ) { // If theres a temp XMM reg available - for (t2reg = 0; ( (t2reg == EEREC_S) || (t2reg == EEREC_T) || (t2reg == EEREC_TEMP) ); t2reg++) + for (t2reg = 0; ( (t2reg == EEREC_S) || (t2reg == EEREC_T) || (t2reg == EEREC_TEMP) || (t2reg == t1reg)); t2reg++) ; // Find unused reg (For second temp reg) SSE_MOVAPS_XMM_to_M128((uptr)FTIO_Temp1, t2reg); // Backup XMM reg @@ -3736,7 +3736,7 @@ void recVUMI_FTOIX(VURegs *VU, int addr, int info) SSE_MOVAPS_XMM_to_M128((uptr)FTIO_Temp1, t1reg); // Backup t1reg XMM reg recVUMI_FTOI_Saturate(EEREC_S, EEREC_T, EEREC_TEMP, t1reg); // Saturate if Float->Int conversion returned illegal result - + SSE_MOVAPS_M128_to_XMM(t1reg, (uptr)FTIO_Temp1); // Restore t1reg XMM reg } } @@ -3749,7 +3749,7 @@ void recVUMI_FTOIX(VURegs *VU, int addr, int info) t1reg = _vuGetTempXMMreg(info); if( t1reg >= 0 ) { // If theres a temp XMM reg available - for (t2reg = 0; ( (t2reg == EEREC_S) || (t2reg == EEREC_T) || (t2reg == EEREC_TEMP) ); t2reg++) + for (t2reg = 0; ( (t2reg == EEREC_S) || (t2reg == EEREC_T) || (t2reg == EEREC_TEMP) || (t2reg == t1reg)); t2reg++) ; // Find unused reg (For second temp reg) SSE_MOVAPS_XMM_to_M128((uptr)FTIO_Temp1, t2reg); // Backup XMM reg diff --git a/pcsx2/x86/iVUzerorec.cpp b/pcsx2/x86/iVUzerorec.cpp index 5b0e18527c..1f241fc2f2 100644 --- a/pcsx2/x86/iVUzerorec.cpp +++ b/pcsx2/x86/iVUzerorec.cpp @@ -131,6 +131,8 @@ extern void (*recSVU_LOWER_OPCODE[128])(); #define INST_MAC_WRITE 0x0100 #define INST_Q_WRITE 0x0200 #define INST_CACHE_VI 0x0400 // write old vi value to s_VIBranchDelay + +// Let's tempt fate by defining two different constants with almost identical names #define INST_DUMMY_ 0x8000 #define INST_DUMMY 0x83c0