Merge pull request #3658 from Tilka/helpers
Interpreter: simplify some helpers
This commit is contained in:
commit
ea82fcc24f
|
@ -11,11 +11,7 @@
|
|||
|
||||
void Interpreter::Helper_UpdateCR0(u32 value)
|
||||
{
|
||||
s64 sign_extended = (s64)(s32)value;
|
||||
u64 cr_val = (u64)sign_extended;
|
||||
cr_val = (cr_val & ~(1ull << 61)) | ((u64)GetXER_SO() << 61);
|
||||
|
||||
PowerPC::ppcState.cr_val[0] = cr_val;
|
||||
Helper_UpdateCRx(0, value);
|
||||
}
|
||||
|
||||
void Interpreter::Helper_UpdateCRx(int idx, u32 value)
|
||||
|
@ -37,7 +33,7 @@ u32 Interpreter::Helper_Mask(int mb, int me)
|
|||
//first make 001111111111111 part
|
||||
u32 begin = 0xFFFFFFFF >> mb;
|
||||
//then make 000000000001111 part, which is used to flip the bits of the first one
|
||||
u32 end = me < 31 ? (0xFFFFFFFF >> (me + 1)) : 0;
|
||||
u32 end = 0x7FFFFFFF >> me;
|
||||
//do the bitflip
|
||||
u32 mask = begin ^ end;
|
||||
//and invert if backwards
|
||||
|
|
|
@ -19,11 +19,11 @@ static GekkoOPInfo unknownopinfo = { "unknown_instruction", OPTYPE_UNKNOWN, FL_E
|
|||
|
||||
static GekkoOPTemplate primarytable[] =
|
||||
{
|
||||
{4, Interpreter::RunTable4, {"RunTable4", OPTYPE_SUBTABLE | (4<<24), 0, 0, 0, 0, 0}},
|
||||
{19, Interpreter::RunTable19, {"RunTable19", OPTYPE_SUBTABLE | (19<<24), 0, 0, 0, 0, 0}},
|
||||
{31, Interpreter::RunTable31, {"RunTable31", OPTYPE_SUBTABLE | (31<<24), 0, 0, 0, 0, 0}},
|
||||
{59, Interpreter::RunTable59, {"RunTable59", OPTYPE_SUBTABLE | (59<<24), 0, 0, 0, 0, 0}},
|
||||
{63, Interpreter::RunTable63, {"RunTable63", OPTYPE_SUBTABLE | (63<<24), 0, 0, 0, 0, 0}},
|
||||
{4, Interpreter::RunTable4, {"RunTable4", OPTYPE_SUBTABLE, 0, 0, 0, 0, 0}},
|
||||
{19, Interpreter::RunTable19, {"RunTable19", OPTYPE_SUBTABLE, 0, 0, 0, 0, 0}},
|
||||
{31, Interpreter::RunTable31, {"RunTable31", OPTYPE_SUBTABLE, 0, 0, 0, 0, 0}},
|
||||
{59, Interpreter::RunTable59, {"RunTable59", OPTYPE_SUBTABLE, 0, 0, 0, 0, 0}},
|
||||
{63, Interpreter::RunTable63, {"RunTable63", OPTYPE_SUBTABLE, 0, 0, 0, 0, 0}},
|
||||
|
||||
{16, Interpreter::bcx, {"bcx", OPTYPE_SYSTEM, FL_ENDBLOCK, 1, 0, 0, 0}},
|
||||
{18, Interpreter::bx, {"bx", OPTYPE_SYSTEM, FL_ENDBLOCK, 1, 0, 0, 0}},
|
||||
|
|
|
@ -37,10 +37,9 @@ const u64 m_crTable[16] =
|
|||
GekkoOPInfo *GetOpInfo(UGeckoInstruction _inst)
|
||||
{
|
||||
GekkoOPInfo *info = m_infoTable[_inst.OPCD];
|
||||
if ((info->type & 0xFFFFFF) == OPTYPE_SUBTABLE)
|
||||
if (info->type == OPTYPE_SUBTABLE)
|
||||
{
|
||||
int table = info->type>>24;
|
||||
switch (table)
|
||||
switch (_inst.OPCD)
|
||||
{
|
||||
case 4: return m_infoTable4[_inst.SUBOP10];
|
||||
case 19: return m_infoTable19[_inst.SUBOP10];
|
||||
|
@ -54,7 +53,7 @@ GekkoOPInfo *GetOpInfo(UGeckoInstruction _inst)
|
|||
}
|
||||
else
|
||||
{
|
||||
if ((info->type & 0xFFFFFF) == OPTYPE_INVALID)
|
||||
if (info->type == OPTYPE_INVALID)
|
||||
{
|
||||
_assert_msg_(POWERPC,0,"GetOpInfo - invalid op %08x @ %08x", _inst.hex, PC);
|
||||
return nullptr;
|
||||
|
@ -66,10 +65,9 @@ GekkoOPInfo *GetOpInfo(UGeckoInstruction _inst)
|
|||
Interpreter::Instruction GetInterpreterOp(UGeckoInstruction _inst)
|
||||
{
|
||||
const GekkoOPInfo *info = m_infoTable[_inst.OPCD];
|
||||
if ((info->type & 0xFFFFFF) == OPTYPE_SUBTABLE)
|
||||
if (info->type == OPTYPE_SUBTABLE)
|
||||
{
|
||||
int table = info->type>>24;
|
||||
switch (table)
|
||||
switch (_inst.OPCD)
|
||||
{
|
||||
case 4: return Interpreter::m_opTable4[_inst.SUBOP10];
|
||||
case 19: return Interpreter::m_opTable19[_inst.SUBOP10];
|
||||
|
@ -83,7 +81,7 @@ Interpreter::Instruction GetInterpreterOp(UGeckoInstruction _inst)
|
|||
}
|
||||
else
|
||||
{
|
||||
if ((info->type & 0xFFFFFF) == OPTYPE_INVALID)
|
||||
if (info->type == OPTYPE_INVALID)
|
||||
{
|
||||
_assert_msg_(POWERPC,0,"GetInterpreterOp - invalid op %08x @ %08x", _inst.hex, PC);
|
||||
return nullptr;
|
||||
|
|
Loading…
Reference in New Issue