From 996f229cbfa2b403af47f77f15728ea617085928 Mon Sep 17 00:00:00 2001 From: cottonvibes Date: Wed, 18 Mar 2009 08:22:01 +0000 Subject: [PATCH] pcsx2: got rid of the compile warning. microVU: minor changes/cleanup. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@811 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/windows/WinThreads.cpp | 2 +- pcsx2/x86/microVU.cpp | 32 +----------- pcsx2/x86/microVU.h | 2 +- pcsx2/x86/microVU_Lower.inl | 6 +-- pcsx2/x86/microVU_Misc.h | 96 ++++++++++++++++++++---------------- 5 files changed, 60 insertions(+), 78 deletions(-) diff --git a/pcsx2/windows/WinThreads.cpp b/pcsx2/windows/WinThreads.cpp index 4e61113b90..658aab7a0a 100644 --- a/pcsx2/windows/WinThreads.cpp +++ b/pcsx2/windows/WinThreads.cpp @@ -109,7 +109,7 @@ namespace Threading __forceinline long pcsx2_InterlockedExchangeAdd( volatile long* target, long srcval ) { - long result; + //long result; // Use our own implementation... // Pcsx2 won't use threads unless it's a multicore cpu, so no need to use diff --git a/pcsx2/x86/microVU.cpp b/pcsx2/x86/microVU.cpp index 935a197a21..cd96ba9259 100644 --- a/pcsx2/x86/microVU.cpp +++ b/pcsx2/x86/microVU.cpp @@ -29,37 +29,7 @@ PCSX2_ALIGNED16(microVU microVU0); PCSX2_ALIGNED16(microVU microVU1); -PCSX2_ALIGNED16(const u32 mVU_absclip[4]) = {0x7fffffff, 0x7fffffff, 0x7fffffff, 0x7fffffff}; -PCSX2_ALIGNED16(const u32 mVU_signbit[4]) = {0x80000000, 0x80000000, 0x80000000, 0x80000000}; -PCSX2_ALIGNED16(const u32 mVU_minvals[4]) = {0xff7fffff, 0xff7fffff, 0xff7fffff, 0xff7fffff}; -PCSX2_ALIGNED16(const u32 mVU_maxvals[4]) = {0x7f7fffff, 0x7f7fffff, 0x7f7fffff, 0x7f7fffff}; -PCSX2_ALIGNED16(const u32 mVU_one[4]) = {0x3f800000, 0x3f800000, 0x3f800000, 0x3f800000}; -PCSX2_ALIGNED16(const u32 mVU_T1[4]) = {0x3f7ffff5, 0x3f7ffff5, 0x3f7ffff5, 0x3f7ffff5}; -PCSX2_ALIGNED16(const u32 mVU_T2[4]) = {0xbeaaa61c, 0xbeaaa61c, 0xbeaaa61c, 0xbeaaa61c}; -PCSX2_ALIGNED16(const u32 mVU_T3[4]) = {0x3e4c40a6, 0x3e4c40a6, 0x3e4c40a6, 0x3e4c40a6}; -PCSX2_ALIGNED16(const u32 mVU_T4[4]) = {0xbe0e6c63, 0xbe0e6c63, 0xbe0e6c63, 0xbe0e6c63}; -PCSX2_ALIGNED16(const u32 mVU_T5[4]) = {0x3dc577df, 0x3dc577df, 0x3dc577df, 0x3dc577df}; -PCSX2_ALIGNED16(const u32 mVU_T6[4]) = {0xbd6501c4, 0xbd6501c4, 0xbd6501c4, 0xbd6501c4}; -PCSX2_ALIGNED16(const u32 mVU_T7[4]) = {0x3cb31652, 0x3cb31652, 0x3cb31652, 0x3cb31652}; -PCSX2_ALIGNED16(const u32 mVU_T8[4]) = {0xbb84d7e7, 0xbb84d7e7, 0xbb84d7e7, 0xbb84d7e7}; -PCSX2_ALIGNED16(const u32 mVU_Pi4[4]) = {0x3f490fdb, 0x3f490fdb, 0x3f490fdb, 0x3f490fdb}; -PCSX2_ALIGNED16(const u32 mVU_S2[4]) = {0xbe2aaaa4, 0xbe2aaaa4, 0xbe2aaaa4, 0xbe2aaaa4}; -PCSX2_ALIGNED16(const u32 mVU_S3[4]) = {0x3c08873e, 0x3c08873e, 0x3c08873e, 0x3c08873e}; -PCSX2_ALIGNED16(const u32 mVU_S4[4]) = {0xb94fb21f, 0xb94fb21f, 0xb94fb21f, 0xb94fb21f}; -PCSX2_ALIGNED16(const u32 mVU_S5[4]) = {0x362e9c14, 0x362e9c14, 0x362e9c14, 0x362e9c14}; -PCSX2_ALIGNED16(const u32 mVU_E1[4]) = {0x3e7fffa8, 0x3e7fffa8, 0x3e7fffa8, 0x3e7fffa8}; -PCSX2_ALIGNED16(const u32 mVU_E2[4]) = {0x3d0007f4, 0x3d0007f4, 0x3d0007f4, 0x3d0007f4}; -PCSX2_ALIGNED16(const u32 mVU_E3[4]) = {0x3b29d3ff, 0x3b29d3ff, 0x3b29d3ff, 0x3b29d3ff}; -PCSX2_ALIGNED16(const u32 mVU_E4[4]) = {0x3933e553, 0x3933e553, 0x3933e553, 0x3933e553}; -PCSX2_ALIGNED16(const u32 mVU_E5[4]) = {0x36b63510, 0x36b63510, 0x36b63510, 0x36b63510}; -PCSX2_ALIGNED16(const u32 mVU_E6[4]) = {0x353961ac, 0x353961ac, 0x353961ac, 0x353961ac}; -PCSX2_ALIGNED16(const float mVU_FTOI_4[4]) = {16.0, 16.0, 16.0, 16.0}; -PCSX2_ALIGNED16(const float mVU_FTOI_12[4]) = {4096.0, 4096.0, 4096.0, 4096.0}; -PCSX2_ALIGNED16(const float mVU_FTOI_15[4]) = {32768.0, 32768.0, 32768.0, 32768.0}; -PCSX2_ALIGNED16(const float mVU_ITOF_4[4]) = {0.0625f, 0.0625f, 0.0625f, 0.0625f}; -PCSX2_ALIGNED16(const float mVU_ITOF_12[4]) = {0.000244140625, 0.000244140625, 0.000244140625, 0.000244140625}; -PCSX2_ALIGNED16(const float mVU_ITOF_15[4]) = {0.000030517578125, 0.000030517578125, 0.000030517578125, 0.000030517578125}; - +declareAllVariables // Declares All Global Variables :D //------------------------------------------------------------------ // Micro VU - Main Functions //------------------------------------------------------------------ diff --git a/pcsx2/x86/microVU.h b/pcsx2/x86/microVU.h index f7490dc334..d755d28b61 100644 --- a/pcsx2/x86/microVU.h +++ b/pcsx2/x86/microVU.h @@ -31,7 +31,7 @@ struct microBlock { u8* x86ptrStart; // Start of code u8* x86ptrEnd; // End of code (first byte outside of block) u8* x86ptrBranch; // - //u32 size; + u32 size; // Number of 64bit VU Instructions in Block }; #define mMaxBlocks 32 // Max Blocks With Different Pipeline States (For n = 1, 2, 4, 8, 16, etc...) diff --git a/pcsx2/x86/microVU_Lower.inl b/pcsx2/x86/microVU_Lower.inl index ff391179f5..817cc46b1d 100644 --- a/pcsx2/x86/microVU_Lower.inl +++ b/pcsx2/x86/microVU_Lower.inl @@ -56,7 +56,7 @@ microVUf(void) mVU_DIV() { SSE_XORPS_XMM_to_XMM(xmmFs, xmmFt); SSE_ANDPS_M128_to_XMM(xmmFs, (uptr)mVU_signbit); - SSE_ORPS_M128_to_XMM(xmmFs, (uptr)mVU_maxvals); // If division by zero, then xmmFs = +/- fmax + SSE_ORPS_XMM_to_XMM(xmmFs, xmmMax); // If division by zero, then xmmFs = +/- fmax bjmp32 = JMP32(0); x86SetJ32(ajmp32); @@ -86,7 +86,7 @@ microVUf(void) mVU_SQRT() { //x86SetJ8(pjmp); SSE_ANDPS_M128_to_XMM(xmmFt, (uptr)mVU_absclip); // Do a cardinal sqrt - if (CHECK_VU_OVERFLOW) SSE_MINSS_M32_to_XMM(xmmFt, (uptr)mVU_maxvals); // Clamp infinities (only need to do positive clamp since xmmFt is positive) + if (CHECK_VU_OVERFLOW) SSE_MINSS_XMM_to_XMM(xmmFt, xmmMax); // Clamp infinities (only need to do positive clamp since xmmFt is positive) SSE_SQRTSS_XMM_to_XMM(xmmFt, xmmFt); mVUunpack_xyzw(xmmFt, xmmFt, 0); mVUmergeRegs(xmmPQ, xmmFt, writeQ ? 4 : 8); @@ -122,7 +122,7 @@ microVUf(void) mVU_RSQRT() { ajmp8 = JZ8(0); // Skip if none are //OR32ItoM(VU_VI_ADDR(REG_STATUS_FLAG, 2), 0x820); // Zero divide flag SSE_ANDPS_M128_to_XMM(xmmFs, (uptr)mVU_signbit); - SSE_ORPS_M128_to_XMM(xmmFs, (uptr)mVU_maxvals); // EEREC_TEMP = +/-Max + SSE_ORPS_XMM_to_XMM(xmmFs, xmmMax); // EEREC_TEMP = +/-Max bjmp8 = JMP8(0); x86SetJ8(ajmp8); SSE_DIVSS_XMM_to_XMM(xmmFs, xmmFt); diff --git a/pcsx2/x86/microVU_Misc.h b/pcsx2/x86/microVU_Misc.h index 2b76665365..47558d2d3c 100644 --- a/pcsx2/x86/microVU_Misc.h +++ b/pcsx2/x86/microVU_Misc.h @@ -22,35 +22,46 @@ // Global Variables //------------------------------------------------------------------ -PCSX2_ALIGNED16_EXTERN(const u32 mVU_absclip[4]); -PCSX2_ALIGNED16_EXTERN(const u32 mVU_signbit[4]); -PCSX2_ALIGNED16_EXTERN(const u32 mVU_minvals[4]); -PCSX2_ALIGNED16_EXTERN(const u32 mVU_maxvals[4]); -PCSX2_ALIGNED16_EXTERN(const u32 mVU_T1[4]); -PCSX2_ALIGNED16_EXTERN(const u32 mVU_T2[4]); -PCSX2_ALIGNED16_EXTERN(const u32 mVU_T3[4]); -PCSX2_ALIGNED16_EXTERN(const u32 mVU_T4[4]); -PCSX2_ALIGNED16_EXTERN(const u32 mVU_T5[4]); -PCSX2_ALIGNED16_EXTERN(const u32 mVU_T6[4]); -PCSX2_ALIGNED16_EXTERN(const u32 mVU_T7[4]); -PCSX2_ALIGNED16_EXTERN(const u32 mVU_T8[4]); -PCSX2_ALIGNED16_EXTERN(const u32 mVU_Pi4[4]); -PCSX2_ALIGNED16_EXTERN(const u32 mVU_S2[4]); -PCSX2_ALIGNED16_EXTERN(const u32 mVU_S3[4]); -PCSX2_ALIGNED16_EXTERN(const u32 mVU_S4[4]); -PCSX2_ALIGNED16_EXTERN(const u32 mVU_S5[4]); -PCSX2_ALIGNED16_EXTERN(const u32 mVU_E1[4]); -PCSX2_ALIGNED16_EXTERN(const u32 mVU_E2[4]); -PCSX2_ALIGNED16_EXTERN(const u32 mVU_E3[4]); -PCSX2_ALIGNED16_EXTERN(const u32 mVU_E4[4]); -PCSX2_ALIGNED16_EXTERN(const u32 mVU_E5[4]); -PCSX2_ALIGNED16_EXTERN(const u32 mVU_E6[4]); -PCSX2_ALIGNED16_EXTERN(const float mVU_FTOI_4[4]); -PCSX2_ALIGNED16_EXTERN(const float mVU_FTOI_12[4]); -PCSX2_ALIGNED16_EXTERN(const float mVU_FTOI_15[4]); -PCSX2_ALIGNED16_EXTERN(const float mVU_ITOF_4[4]); -PCSX2_ALIGNED16_EXTERN(const float mVU_ITOF_12[4]); -PCSX2_ALIGNED16_EXTERN(const float mVU_ITOF_15[4]); +#define declareAllVariables \ +initVariable( _somePrefix_, u32, mVU_absclip, 0x7fffffff ); \ +initVariable( _somePrefix_, u32, mVU_signbit, 0x80000000 ); \ +initVariable( _somePrefix_, u32, mVU_minvals, 0xff7fffff ); \ +initVariable( _somePrefix_, u32, mVU_maxvals, 0x7f7fffff ); \ +initVariable( _somePrefix_, u32, mVU_one, 0x3f800000 ); \ +initVariable( _somePrefix_, u32, mVU_T1, 0x3f7ffff5 ); \ +initVariable( _somePrefix_, u32, mVU_T2, 0xbeaaa61c ); \ +initVariable( _somePrefix_, u32, mVU_T3, 0x3e4c40a6 ); \ +initVariable( _somePrefix_, u32, mVU_T4, 0xbe0e6c63 ); \ +initVariable( _somePrefix_, u32, mVU_T5, 0x3dc577df ); \ +initVariable( _somePrefix_, u32, mVU_T6, 0xbd6501c4 ); \ +initVariable( _somePrefix_, u32, mVU_T7, 0x3cb31652 ); \ +initVariable( _somePrefix_, u32, mVU_T8, 0xbb84d7e7 ); \ +initVariable( _somePrefix_, u32, mVU_Pi4, 0x3f490fdb ); \ +initVariable( _somePrefix_, u32, mVU_S2, 0xbe2aaaa4 ); \ +initVariable( _somePrefix_, u32, mVU_S3, 0x3c08873e ); \ +initVariable( _somePrefix_, u32, mVU_S4, 0xb94fb21f ); \ +initVariable( _somePrefix_, u32, mVU_S5, 0x362e9c14 ); \ +initVariable( _somePrefix_, u32, mVU_E1, 0x3e7fffa8 ); \ +initVariable( _somePrefix_, u32, mVU_E2, 0x3d0007f4 ); \ +initVariable( _somePrefix_, u32, mVU_E3, 0x3b29d3ff ); \ +initVariable( _somePrefix_, u32, mVU_E4, 0x3933e553 ); \ +initVariable( _somePrefix_, u32, mVU_E5, 0x36b63510 ); \ +initVariable( _somePrefix_, u32, mVU_E6, 0x353961ac ); \ +initVariable( _somePrefix_, float, mVU_FTOI_4, 16.0 ); \ +initVariable( _somePrefix_, float, mVU_FTOI_12, 4096.0 ); \ +initVariable( _somePrefix_, float, mVU_FTOI_15, 32768.0 ); \ +initVariable( _somePrefix_, float, mVU_ITOF_4, 0.0625f ); \ +initVariable( _somePrefix_, float, mVU_ITOF_12, 0.000244140625 ); \ +initVariable( _somePrefix_, float, mVU_ITOF_15, 0.000030517578125 ); + +#define _somePrefix_ PCSX2_ALIGNED16_EXTERN +#define initVariable(aprefix, atype, aname, avalue) aprefix (const atype aname [4]); +declareAllVariables +#undef _somePrefix_ +#undef initVariable + +#define _somePrefix_ PCSX2_ALIGNED16 +#define initVariable(aprefix, atype, aname, avalue) aprefix (const atype aname [4]) = {avalue, avalue, avalue, avalue}; //------------------------------------------------------------------ // Helper Macros @@ -142,7 +153,7 @@ PCSX2_ALIGNED16_EXTERN(const float mVU_ITOF_15[4]); #define _writeQ (1<<5) #define _readQ (1<<6) #define _writeP (1<<7) -#define _readP (1<<7) +#define _readP (1<<7) // same as writeP #define _doFlags (3<<8) #define _doMac (1<<8) #define _doStatus (1<<9) @@ -159,23 +170,24 @@ PCSX2_ALIGNED16_EXTERN(const float mVU_ITOF_15[4]); #define isBranch (mVUinfo & (1<<1)) #define isEOB (mVUinfo & (1<<2)) #define isBdelay (mVUinfo & (1<<3)) -#define writeQ ((mVUinfo & (1<<5)) >> 5) -#define readQ ((mVUinfo & (1<<6)) >> 6) -#define writeP ((mVUinfo & (1<<7)) >> 7) -#define readP ((mVUinfo & (1<<7)) >> 7) // same as write +#define writeQ ((mVUinfo >> 5) & 1) +#define readQ ((mVUinfo >> 6) & 1) +#define writeP ((mVUinfo >> 7) & 1) +#define readP ((mVUinfo >> 7) & 1) // same as writeP #define doFlags (mVUinfo & (3<<8)) #define doMac (mVUinfo & (1<<8)) #define doStatus (mVUinfo & (1<<9)) -#define fmInstance ((mVUinfo & (3<<10)) >> 10) -#define fsInstance ((mVUinfo & (3<<12)) >> 12) -#define fcInstance ((mVUinfo & (3<<14)) >> 14) -#define fpmInstance (((u8)((mVUinfo & (3<<10)) >> 10) - 1) & 0x3) -#define fpsInstance (((u8)((mVUinfo & (3<<12)) >> 12) - 1) & 0x3) -#define fvmInstance ((mVUinfo & (3<<16)) >> 16) -#define fvsInstance ((mVUinfo & (3<<18)) >> 18) -#define fvcInstance ((mVUinfo & (3<<14)) >> 14) +#define fmInstance ((mVUinfo >> 10) & 3) +#define fsInstance ((mVUinfo >> 12) & 3) +#define fpsInstance ((((mVUinfo>>12) & 3) - 1) & 0x3) +#define fcInstance ((mVUinfo >> 14) & 3) +#define fvcInstance ((mVUinfo >> 14) & 3) +#define fvmInstance ((mVUinfo >> 16) & 3) +#define fvsInstance ((mVUinfo >> 18) & 3) + //#define getFs (mVUinfo & (1<<13)) //#define getFt (mVUinfo & (1<<14)) +//#define fpmInstance (((u8)((mVUinfo & (3<<10)) >> 10) - 1) & 0x3) #define isMMX(_VIreg_) (_VIreg_ >= 1 && _VIreg_ <=9) #define mmVI(_VIreg_) (_VIreg_ - 1)