From 8edd66c662aaa38a7c27cb1d78d5fa6c2f2c70c2 Mon Sep 17 00:00:00 2001 From: ramapcsx2 Date: Mon, 15 Sep 2008 08:01:11 +0000 Subject: [PATCH] Added hacks to VU interpreters, only accessible via source. Note: these hacks are more like a reference, they help show what makes interpreters so slow. Most games break with these enabled, but my testing game is fine. Speedup in it is about 30%. Note2: I'll remove these hacks, once interpreters are fast enough. git-svn-id: http://pcsx2-playground.googlecode.com/svn/trunk@123 a6443dda-0b58-4228-96e9-037be469359c --- pcsx2/VU.h | 4 ++++ pcsx2/VU0micro.c | 4 ++++ pcsx2/VU1micro.c | 4 ++++ pcsx2/VUops.c | 8 +++++++- 4 files changed, 19 insertions(+), 1 deletion(-) diff --git a/pcsx2/VU.h b/pcsx2/VU.h index eec3ae2ef8..6076e2e0f5 100644 --- a/pcsx2/VU.h +++ b/pcsx2/VU.h @@ -36,6 +36,10 @@ #define REG_VPU_STAT 29 #define REG_CMSAR1 31 +//interpreter hacks, WIP +//#define INT_VUSTALLHACK //some games work without those, big speedup +//#define INT_VUDOUBLEHACK + enum VUStatus { VU_Ready = 0, VU_Run = 1, diff --git a/pcsx2/VU0micro.c b/pcsx2/VU0micro.c index 84255f060b..533b38d737 100644 --- a/pcsx2/VU0micro.c +++ b/pcsx2/VU0micro.c @@ -273,7 +273,9 @@ void _vu0Exec(VURegs* VU) { VU->code = ptr[1]; VU0regs_UPPER_OPCODE[VU->code & 0x3f](&uregs); +#ifndef INT_VUSTALLHACK _vuTestUpperStalls(VU, &uregs); +#endif /* check upper flags */ if (ptr[1] & 0x80000000) { /* I flag */ @@ -284,7 +286,9 @@ void _vu0Exec(VURegs* VU) { } else { VU->code = ptr[0]; VU0regs_LOWER_OPCODE[VU->code >> 25](&lregs); +#ifndef INT_VUSTALLHACK _vuTestLowerStalls(VU, &lregs); +#endif vu0branch = lregs.pipe == VUPIPE_BRANCH; diff --git a/pcsx2/VU1micro.c b/pcsx2/VU1micro.c index ea31e9225b..54bc03defb 100644 --- a/pcsx2/VU1micro.c +++ b/pcsx2/VU1micro.c @@ -235,7 +235,9 @@ void _vu1Exec(VURegs* VU) { VU->code = ptr[1]; VU1regs_UPPER_OPCODE[VU->code & 0x3f](&uregs); +#ifndef INT_VUSTALLHACK _vuTestUpperStalls(VU, &uregs); +#endif /* check upper flags */ if (ptr[1] & 0x80000000) { /* I flag */ @@ -245,7 +247,9 @@ void _vu1Exec(VURegs* VU) { } else { VU->code = ptr[0]; VU1regs_LOWER_OPCODE[VU->code >> 25](&lregs); +#ifndef INT_VUSTALLHACK _vuTestLowerStalls(VU, &lregs); +#endif vu1branch = lregs.pipe == VUPIPE_BRANCH; diff --git a/pcsx2/VUops.c b/pcsx2/VUops.c index 8d53f0a40b..92a05c6bf4 100644 --- a/pcsx2/VUops.c +++ b/pcsx2/VUops.c @@ -330,8 +330,8 @@ void _vuAddLowerStalls(VURegs * VU, _VURegsNum *VUregsn) { /******************************/ /* VU Upper instructions */ /******************************/ +#ifndef INT_VUDOUBLEHACK static u32 d; - float vuDouble(u32 f) { switch(f & 0x7f800000){ @@ -348,6 +348,12 @@ float vuDouble(u32 f) break; } } +#else +float vuDouble(u32 f) +{ + return *(float*)&f; +} +#endif void _vuABS(VURegs * VU) { if (_Ft_ == 0) return;