Merge pull request #1454 from lioncash/interp

Interpreter: Remove a redundant macro
This commit is contained in:
Ryan Houdek
2014-11-02 09:33:19 -06:00
5 changed files with 242 additions and 244 deletions
@@ -34,8 +34,6 @@ public:
void Log();
// to keep the code cleaner
#define m_GPR (PowerPC::ppcState.gpr)
static bool m_EndBlock;
static void unknown_instruction(UGeckoInstruction _inst);
File diff suppressed because it is too large Load Diff
File diff suppressed because it is too large Load Diff
@@ -139,7 +139,7 @@ void Interpreter::psq_l(UGeckoInstruction _inst)
const EQuantizeType ldType = gqr.ld_type;
const unsigned int ldScale = gqr.ld_scale;
const u32 EA = _inst.RA ?
(m_GPR[_inst.RA] + _inst.SIMM_12) : (u32)_inst.SIMM_12;
(rGPR[_inst.RA] + _inst.SIMM_12) : (u32)_inst.SIMM_12;
int c = 4;
if (ldType == QUANTIZE_U8 || ldType == QUANTIZE_S8)
@@ -175,7 +175,7 @@ void Interpreter::psq_lu(UGeckoInstruction _inst)
const UGQR gqr(rSPR(SPR_GQR0 + _inst.I));
const EQuantizeType ldType = gqr.ld_type;
const unsigned int ldScale = gqr.ld_scale;
const u32 EA = m_GPR[_inst.RA] + _inst.SIMM_12;
const u32 EA = rGPR[_inst.RA] + _inst.SIMM_12;
int c = 4;
if (ldType == QUANTIZE_U8 || ldType == QUANTIZE_S8)
@@ -204,7 +204,7 @@ void Interpreter::psq_lu(UGeckoInstruction _inst)
rPS0(_inst.RS) = ps0;
rPS1(_inst.RS) = 1.0f;
}
m_GPR[_inst.RA] = EA;
rGPR[_inst.RA] = EA;
}
void Interpreter::psq_st(UGeckoInstruction _inst)
@@ -213,7 +213,7 @@ void Interpreter::psq_st(UGeckoInstruction _inst)
const EQuantizeType stType = gqr.st_type;
const unsigned int stScale = gqr.st_scale;
const u32 EA = _inst.RA ?
(m_GPR[_inst.RA] + _inst.SIMM_12) : (u32)_inst.SIMM_12;
(rGPR[_inst.RA] + _inst.SIMM_12) : (u32)_inst.SIMM_12;
int c = 4;
if (stType == QUANTIZE_U8 || stType == QUANTIZE_S8)
@@ -237,7 +237,7 @@ void Interpreter::psq_stu(UGeckoInstruction _inst)
const UGQR gqr(rSPR(SPR_GQR0 + _inst.I));
const EQuantizeType stType = gqr.st_type;
const unsigned int stScale = gqr.st_scale;
const u32 EA = m_GPR[_inst.RA] + _inst.SIMM_12;
const u32 EA = rGPR[_inst.RA] + _inst.SIMM_12;
int c = 4;
if (stType == QUANTIZE_U8 || stType == QUANTIZE_S8)
@@ -258,7 +258,7 @@ void Interpreter::psq_stu(UGeckoInstruction _inst)
{
return;
}
m_GPR[_inst.RA] = EA;
rGPR[_inst.RA] = EA;
}
void Interpreter::psq_lx(UGeckoInstruction _inst)
@@ -266,7 +266,7 @@ void Interpreter::psq_lx(UGeckoInstruction _inst)
const UGQR gqr(rSPR(SPR_GQR0 + _inst.Ix));
const EQuantizeType ldType = gqr.ld_type;
const unsigned int ldScale = gqr.ld_scale;
const u32 EA = _inst.RA ? (m_GPR[_inst.RA] + m_GPR[_inst.RB]) : m_GPR[_inst.RB];
const u32 EA = _inst.RA ? (rGPR[_inst.RA] + rGPR[_inst.RB]) : rGPR[_inst.RB];
int c = 4;
if (ldType == QUANTIZE_U8 || ldType == QUANTIZE_S8)
@@ -307,7 +307,7 @@ void Interpreter::psq_stx(UGeckoInstruction _inst)
const UGQR gqr(rSPR(SPR_GQR0 + _inst.Ix));
const EQuantizeType stType = gqr.st_type;
const unsigned int stScale = gqr.st_scale;
const u32 EA = _inst.RA ? (m_GPR[_inst.RA] + m_GPR[_inst.RB]) : m_GPR[_inst.RB];
const u32 EA = _inst.RA ? (rGPR[_inst.RA] + rGPR[_inst.RB]) : rGPR[_inst.RB];
int c = 4;
if (stType == QUANTIZE_U8 || stType == QUANTIZE_S8)
@@ -331,7 +331,7 @@ void Interpreter::psq_lux(UGeckoInstruction _inst)
const UGQR gqr(rSPR(SPR_GQR0 + _inst.Ix));
const EQuantizeType ldType = gqr.ld_type;
const unsigned int ldScale = gqr.ld_scale;
const u32 EA = m_GPR[_inst.RA] + m_GPR[_inst.RB];
const u32 EA = rGPR[_inst.RA] + rGPR[_inst.RB];
int c = 4;
if (ldType == QUANTIZE_U8 || ldType == QUANTIZE_S8)
@@ -360,7 +360,7 @@ void Interpreter::psq_lux(UGeckoInstruction _inst)
rPS0(_inst.RS) = ps0;
rPS1(_inst.RS) = 1.0f;
}
m_GPR[_inst.RA] = EA;
rGPR[_inst.RA] = EA;
}
void Interpreter::psq_stux(UGeckoInstruction _inst)
@@ -368,7 +368,7 @@ void Interpreter::psq_stux(UGeckoInstruction _inst)
const UGQR gqr(rSPR(SPR_GQR0 + _inst.Ix));
const EQuantizeType stType = gqr.st_type;
const unsigned int stScale = gqr.st_scale;
const u32 EA = m_GPR[_inst.RA] + m_GPR[_inst.RB];
const u32 EA = rGPR[_inst.RA] + rGPR[_inst.RB];
int c = 4;
if (stType == QUANTIZE_U8 || stType == QUANTIZE_S8)
@@ -389,6 +389,6 @@ void Interpreter::psq_stux(UGeckoInstruction _inst)
{
return;
}
m_GPR[_inst.RA] = EA;
rGPR[_inst.RA] = EA;
} // namespace=======
@@ -119,7 +119,7 @@ void Interpreter::mcrxr(UGeckoInstruction _inst)
void Interpreter::mfcr(UGeckoInstruction _inst)
{
m_GPR[_inst.RD] = GetCR();
rGPR[_inst.RD] = GetCR();
}
void Interpreter::mtcrf(UGeckoInstruction _inst)
@@ -127,7 +127,7 @@ void Interpreter::mtcrf(UGeckoInstruction _inst)
u32 crm = _inst.CRM;
if (crm == 0xFF)
{
SetCR(m_GPR[_inst.RS]);
SetCR(rGPR[_inst.RS]);
}
else
{
@@ -139,7 +139,7 @@ void Interpreter::mtcrf(UGeckoInstruction _inst)
mask |= 0xF << (i*4);
}
SetCR((GetCR() & ~mask) | (m_GPR[_inst.RS] & mask));
SetCR((GetCR() & ~mask) | (rGPR[_inst.RS] & mask));
}
}
@@ -147,24 +147,24 @@ void Interpreter::mtcrf(UGeckoInstruction _inst)
void Interpreter::mfmsr(UGeckoInstruction _inst)
{
//Privileged?
m_GPR[_inst.RD] = MSR;
rGPR[_inst.RD] = MSR;
}
void Interpreter::mfsr(UGeckoInstruction _inst)
{
m_GPR[_inst.RD] = PowerPC::ppcState.sr[_inst.SR];
rGPR[_inst.RD] = PowerPC::ppcState.sr[_inst.SR];
}
void Interpreter::mfsrin(UGeckoInstruction _inst)
{
int index = (m_GPR[_inst.RB] >> 28) & 0xF;
m_GPR[_inst.RD] = PowerPC::ppcState.sr[index];
int index = (rGPR[_inst.RB] >> 28) & 0xF;
rGPR[_inst.RD] = PowerPC::ppcState.sr[index];
}
void Interpreter::mtmsr(UGeckoInstruction _inst)
{
// Privileged?
MSR = m_GPR[_inst.RS];
MSR = rGPR[_inst.RS];
PowerPC::CheckExceptions();
m_EndBlock = true;
}
@@ -180,14 +180,14 @@ static void SetSR(int index, u32 value)
void Interpreter::mtsr(UGeckoInstruction _inst)
{
int index = _inst.SR;
u32 value = m_GPR[_inst.RS];
u32 value = rGPR[_inst.RS];
SetSR(index, value);
}
void Interpreter::mtsrin(UGeckoInstruction _inst)
{
int index = (m_GPR[_inst.RB] >> 28) & 0xF;
u32 value = m_GPR[_inst.RS];
int index = (rGPR[_inst.RB] >> 28) & 0xF;
u32 value = rGPR[_inst.RS];
SetSR(index, value);
}
@@ -239,14 +239,14 @@ void Interpreter::mfspr(UGeckoInstruction _inst)
rSPR(iIndex) = GetXER().Hex;
break;
}
m_GPR[_inst.RD] = rSPR(iIndex);
rGPR[_inst.RD] = rSPR(iIndex);
}
void Interpreter::mtspr(UGeckoInstruction _inst)
{
u32 iIndex = (_inst.SPRU << 5) | (_inst.SPRL & 0x1F);
u32 oldValue = rSPR(iIndex);
rSPR(iIndex) = m_GPR[_inst.RD];
rSPR(iIndex) = rGPR[_inst.RD];
//TODO - check processor privilege level - many of these require privilege
//XER LR CTR are the only ones available in user mode, time base can be read too.
@@ -263,12 +263,12 @@ void Interpreter::mtspr(UGeckoInstruction _inst)
break;
case SPR_TL_W:
TL = m_GPR[_inst.RD];
TL = rGPR[_inst.RD];
SystemTimers::TimeBaseSet();
break;
case SPR_TU_W:
TU = m_GPR[_inst.RD];
TU = rGPR[_inst.RD];
SystemTimers::TimeBaseSet();
break;
@@ -302,7 +302,7 @@ void Interpreter::mtspr(UGeckoInstruction _inst)
break;
case SPR_WPAR:
_assert_msg_(POWERPC, m_GPR[_inst.RD] == 0x0C008000, "Gather pipe @ %08x", PC);
_assert_msg_(POWERPC, rGPR[_inst.RD] == 0x0C008000, "Gather pipe @ %08x", PC);
GPFifo::ResetGatherPipe();
break;
@@ -341,7 +341,7 @@ void Interpreter::mtspr(UGeckoInstruction _inst)
break;
case SPR_DEC:
if (!(oldValue >> 31) && (m_GPR[_inst.RD]>>31)) //top bit from 0 to 1
if (!(oldValue >> 31) && (rGPR[_inst.RD]>>31)) //top bit from 0 to 1
{
PanicAlert("Interesting - Software triggered Decrementer exception");
Common::AtomicOr(PowerPC::ppcState.Exceptions, EXCEPTION_DECREMENTER);