From fa3288971f2d855e72b903d41243e4f69cf0fa3d Mon Sep 17 00:00:00 2001 From: sudonim1 Date: Tue, 17 Mar 2009 20:58:59 +0000 Subject: [PATCH] Save a few bytes on const flushing using 5 byte eax movs for 0 and -1 instead of 10 byte immediate movs. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@808 96395faa-99c1-11dd-bbfe-3dabce05a288 --- pcsx2/x86/ix86-32/iCore-32.cpp | 64 +++++++++++++++++++++++++++++----- 1 file changed, 55 insertions(+), 9 deletions(-) diff --git a/pcsx2/x86/ix86-32/iCore-32.cpp b/pcsx2/x86/ix86-32/iCore-32.cpp index 2a8411d4cf..d3557228e0 100644 --- a/pcsx2/x86/ix86-32/iCore-32.cpp +++ b/pcsx2/x86/ix86-32/iCore-32.cpp @@ -139,17 +139,63 @@ void _flushConstReg(int reg) void _flushConstRegs() { - int i; + int i, j; + int zero_cnt = 0, minusone_cnt = 0; + int eaxval = 1; // 0, -1 + unsigned long done[4] = {0, 0, 0, 0}; + u8* rewindPtr; // flush constants + // flush 0 and -1 first // ignore r0 - for(i = 1; i < 32; ++i) { - if( g_cpuHasConstReg & (1< 0) + XOR32RtoR(EAX, EAX), eaxval = 0; +#else + if (eaxval > 0) + MOV32ItoR(EAX, -1), eaxval = -1; +#endif + if (eaxval == 0) + NOT32R(EAX), eaxval = -1; + MOV32RtoM((uptr)&cpuRegs.GPR.r[i].SL[j], EAX); + done[j + 2] |= 1<