diff --git a/3rdparty/bzip2/bzip2.vcproj b/3rdparty/bzip2/bzip2.vcproj index 74f0a8036d..37821de9b7 100644 --- a/3rdparty/bzip2/bzip2.vcproj +++ b/3rdparty/bzip2/bzip2.vcproj @@ -98,8 +98,13 @@ @@ -157,9 +160,12 @@ diff --git a/pcsx2/x86/ix86/ix86_sse.inl b/pcsx2/x86/ix86/ix86_sse.inl index 0b569eba7e..25968c13b4 100644 --- a/pcsx2/x86/ix86/ix86_sse.inl +++ b/pcsx2/x86/ix86/ix86_sse.inl @@ -22,6 +22,14 @@ // SSE instructions //------------------------------------------------------------------ +// This tells the recompiler's emitter to always use movaps instead of movdqa. Both instructions +// do the exact same thing, but movaps is 1 byte shorter, and thus results in a cleaner L1 cache +// and some marginal speed gains as a result. (it's possible someday in the future the per- +// formance of the two instructions could change, so this constant is provided to restore MOVDQA +// use easily at a later time, if needed). + +static const bool AlwaysUseMovaps = true; + #define SSEMtoR( code, overb ) \ assert( to < XMMREGS ) ; \ RexR(0, to); \ @@ -203,19 +211,29 @@ emitterT void eSSE_MOVAPSRtoRmOffset( x86IntRegType to, x86SSERegType from, int // movdqa [r32+offset] to r32 emitterT void eSSE2_MOVDQARmtoROffset( x86SSERegType to, x86IntRegType from, int offset ) { - write8(0x66); - RexRB(0, to, from); - write16( 0x6f0f ); - WriteRmOffsetFrom(to, from, offset); + if( AlwaysUseMovaps ) + eSSE_MOVAPSRmtoROffset( to, from, offset ); + else + { + write8(0x66); + RexRB(0, to, from); + write16( 0x6f0f ); + WriteRmOffsetFrom(to, from, offset); + } } // movdqa r32 to [r32+offset] emitterT void eSSE2_MOVDQARtoRmOffset( x86IntRegType to, x86SSERegType from, int offset ) { - write8(0x66); - RexRB(0, from, to); - write16( 0x7f0f ); - WriteRmOffsetFrom(from, to, offset); + if( AlwaysUseMovaps ) + eSSE_MOVAPSRtoRmOffset( to, from, offset ); + else + { + write8(0x66); + RexRB(0, from, to); + write16( 0x7f0f ); + WriteRmOffsetFrom(from, to, offset); + } } // movups [r32+offset] to r32 @@ -833,13 +851,30 @@ emitterT void eSSE2_PXOR_XMM_to_XMM( x86SSERegType to, x86SSERegType from ) { S emitterT void eSSE2_PXOR_M128_to_XMM( x86SSERegType to, uptr from ) { SSEMtoR66( 0xEF0F ) }; /////////////////////////////////////////////////////////////////////////////////////// -emitterT void eSSE2_MOVDQA_M128_to_XMM(x86SSERegType to, uptr from) { SSEMtoR66(0x6F0F); } -emitterT void eSSE2_MOVDQA_XMM_to_M128( uptr to, x86SSERegType from ) { SSERtoM66(0x7F0F); } -emitterT void eSSE2_MOVDQA_XMM_to_XMM( x86SSERegType to, x86SSERegType from) { if (to != from) { SSERtoR66(0x6F0F); } } +emitterT void eSSE2_MOVDQA_M128_to_XMM(x86SSERegType to, uptr from) { if( AlwaysUseMovaps ) eSSE_MOVAPS_M128_to_XMM( to, from ); else SSEMtoR66(0x6F0F); } +emitterT void eSSE2_MOVDQA_XMM_to_M128( uptr to, x86SSERegType from ) { if( AlwaysUseMovaps ) eSSE_MOVAPS_XMM_to_M128( to, from ); else SSERtoM66(0x7F0F); } +emitterT void eSSE2_MOVDQA_XMM_to_XMM( x86SSERegType to, x86SSERegType from) { if (to != from) { if( AlwaysUseMovaps ) eSSE_MOVAPS_XMM_to_XMM( to, from ); else SSERtoR66(0x6F0F); } } -emitterT void eSSE2_MOVDQU_M128_to_XMM(x86SSERegType to, uptr from) { write8(0xF3); SSEMtoR(0x6F0F, 0); } -emitterT void eSSE2_MOVDQU_XMM_to_M128( uptr to, x86SSERegType from) { write8(0xF3); SSERtoM(0x7F0F, 0); } -emitterT void eSSE2_MOVDQU_XMM_to_XMM( x86SSERegType to, x86SSERegType from) { write8(0xF3); SSERtoR(0x6F0F); } +emitterT void eSSE2_MOVDQU_M128_to_XMM(x86SSERegType to, uptr from) +{ + if( AlwaysUseMovaps ) + eSSE_MOVUPS_M128_to_XMM( to, from ); + else + { + write8(0xF3); + SSEMtoR(0x6F0F, 0); + } +} +emitterT void eSSE2_MOVDQU_XMM_to_M128( uptr to, x86SSERegType from) +{ + if( AlwaysUseMovaps ) + eSSE_MOVUPS_XMM_to_M128( to, from ); + else + { + write8(0xF3); + SSERtoM(0x7F0F, 0); + } +} // shift right logical diff --git a/pcsx2/x86/ix86/ix86_sse_helpers.h b/pcsx2/x86/ix86/ix86_sse_helpers.h index 1e0a132307..7561e5f96f 100644 --- a/pcsx2/x86/ix86/ix86_sse_helpers.h +++ b/pcsx2/x86/ix86/ix86_sse_helpers.h @@ -26,54 +26,51 @@ #error Dependency fail: Please define _EmitterId_ and include ix86.h first. #endif +// Added AlwaysUseMovaps check to the relevant functions here, which helps reduce the +// overhead of dynarec instructions that use these. + static __forceinline void SSEX_MOVDQA_M128_to_XMM( x86SSERegType to, uptr from ) { - if( g_xmmtypes[to] == XMMT_INT ) SSE2_MOVDQA_M128_to_XMM(to, from); + if( !AlwaysUseMovaps && g_xmmtypes[to] == XMMT_INT ) SSE2_MOVDQA_M128_to_XMM(to, from); else SSE_MOVAPS_M128_to_XMM(to, from); } static __forceinline void SSEX_MOVDQA_XMM_to_M128( uptr to, x86SSERegType from ) { - if( g_xmmtypes[from] == XMMT_INT ) SSE2_MOVDQA_XMM_to_M128(to, from); + if( !AlwaysUseMovaps && g_xmmtypes[from] == XMMT_INT ) SSE2_MOVDQA_XMM_to_M128(to, from); else SSE_MOVAPS_XMM_to_M128(to, from); } static __forceinline void SSEX_MOVDQA_XMM_to_XMM( x86SSERegType to, x86SSERegType from ) { - if( g_xmmtypes[from] == XMMT_INT ) SSE2_MOVDQA_XMM_to_XMM(to, from); + if( !AlwaysUseMovaps && g_xmmtypes[from] == XMMT_INT ) SSE2_MOVDQA_XMM_to_XMM(to, from); else SSE_MOVAPS_XMM_to_XMM(to, from); } static __forceinline void SSEX_MOVDQARmtoROffset( x86SSERegType to, x86IntRegType from, int offset ) { - if( g_xmmtypes[to] == XMMT_INT ) SSE2_MOVDQARmtoROffset(to, from, offset); + if( !AlwaysUseMovaps && g_xmmtypes[to] == XMMT_INT ) SSE2_MOVDQARmtoROffset(to, from, offset); else SSE_MOVAPSRmtoROffset(to, from, offset); } static __forceinline void SSEX_MOVDQARtoRmOffset( x86IntRegType to, x86SSERegType from, int offset ) { - if( g_xmmtypes[from] == XMMT_INT ) SSE2_MOVDQARtoRmOffset(to, from, offset); + if( !AlwaysUseMovaps && g_xmmtypes[from] == XMMT_INT ) SSE2_MOVDQARtoRmOffset(to, from, offset); else SSE_MOVAPSRtoRmOffset(to, from, offset); } static __forceinline void SSEX_MOVDQU_M128_to_XMM( x86SSERegType to, uptr from ) { - if( g_xmmtypes[to] == XMMT_INT ) SSE2_MOVDQU_M128_to_XMM(to, from); + if( !AlwaysUseMovaps && g_xmmtypes[to] == XMMT_INT ) SSE2_MOVDQU_M128_to_XMM(to, from); else SSE_MOVAPS_M128_to_XMM(to, from); } static __forceinline void SSEX_MOVDQU_XMM_to_M128( uptr to, x86SSERegType from ) { - if( g_xmmtypes[from] == XMMT_INT ) SSE2_MOVDQU_XMM_to_M128(to, from); + if( !AlwaysUseMovaps && g_xmmtypes[from] == XMMT_INT ) SSE2_MOVDQU_XMM_to_M128(to, from); else SSE_MOVAPS_XMM_to_M128(to, from); } -static __forceinline void SSEX_MOVDQU_XMM_to_XMM( x86SSERegType to, x86SSERegType from ) -{ - if( g_xmmtypes[from] == XMMT_INT ) SSE2_MOVDQU_XMM_to_XMM(to, from); - else SSE_MOVAPS_XMM_to_XMM(to, from); -} - static __forceinline void SSEX_MOVD_M32_to_XMM( x86SSERegType to, uptr from ) { if( g_xmmtypes[to] == XMMT_INT ) SSE2_MOVD_M32_to_XMM(to, from);