Split some parts of UpdateBoundingBox into multiple lines. Also,

fix issues causing failure on Lint.
This commit is contained in:
Rohit Nirmal 2014-09-06 01:24:03 -05:00
parent 1ecb318bcc
commit 629ceaf2b1
4 changed files with 131 additions and 46 deletions

View File

@ -694,8 +694,7 @@ void XEmitter::UD2()
void XEmitter::PREFETCH(PrefetchLevel level, OpArg arg) void XEmitter::PREFETCH(PrefetchLevel level, OpArg arg)
{ {
if (arg.IsImm()) _assert_msg_(DYNA_REC, !arg.IsImm(), "PREFETCH - Imm argument");
_assert_msg_(DYNA_REC, 0, "PREFETCH - Imm argument");
arg.operandReg = (u8)level; arg.operandReg = (u8)level;
arg.WriteRex(this, 0, 0); arg.WriteRex(this, 0, 0);
Write8(0x0F); Write8(0x0F);
@ -705,8 +704,7 @@ void XEmitter::PREFETCH(PrefetchLevel level, OpArg arg)
void XEmitter::SETcc(CCFlags flag, OpArg dest) void XEmitter::SETcc(CCFlags flag, OpArg dest)
{ {
if (dest.IsImm()) _assert_msg_(DYNA_REC, !dest.IsImm(), "SETcc - Imm argument");
_assert_msg_(DYNA_REC, 0, "SETcc - Imm argument");
dest.operandReg = 0; dest.operandReg = 0;
dest.WriteRex(this, 0, 8); dest.WriteRex(this, 0, 8);
Write8(0x0F); Write8(0x0F);
@ -716,10 +714,8 @@ void XEmitter::SETcc(CCFlags flag, OpArg dest)
void XEmitter::CMOVcc(int bits, X64Reg dest, OpArg src, CCFlags flag) void XEmitter::CMOVcc(int bits, X64Reg dest, OpArg src, CCFlags flag)
{ {
if (src.IsImm()) _assert_msg_(DYNA_REC, !src.IsImm(), "CMOVcc - Imm argument");
_assert_msg_(DYNA_REC, 0, "CMOVcc - Imm argument"); _assert_msg_(DYNA_REC, bits != 8, "CMOVcc - 8 bits unsupported");
if (bits == 8)
_assert_msg_(DYNA_REC, 0, "CMOVcc - 8 bits unsupported");
if (bits == 16) if (bits == 16)
Write8(0x66); Write8(0x66);
src.operandReg = dest; src.operandReg = dest;
@ -731,8 +727,7 @@ void XEmitter::CMOVcc(int bits, X64Reg dest, OpArg src, CCFlags flag)
void XEmitter::WriteMulDivType(int bits, OpArg src, int ext) void XEmitter::WriteMulDivType(int bits, OpArg src, int ext)
{ {
if (src.IsImm()) _assert_msg_(DYNA_REC, !src.IsImm(), "WriteMulDivType - Imm argument");
_assert_msg_(DYNA_REC, 0, "WriteMulDivType - Imm argument");
src.operandReg = ext; src.operandReg = ext;
if (bits == 16) if (bits == 16)
Write8(0x66); Write8(0x66);
@ -757,8 +752,7 @@ void XEmitter::NOT(int bits, OpArg src) {WriteMulDivType(bits, src, 2);}
void XEmitter::WriteBitSearchType(int bits, X64Reg dest, OpArg src, u8 byte2) void XEmitter::WriteBitSearchType(int bits, X64Reg dest, OpArg src, u8 byte2)
{ {
if (src.IsImm()) _assert_msg_(DYNA_REC, !src.IsImm(), "WriteBitSearchType - Imm argument");
_assert_msg_(DYNA_REC, 0, "WriteBitSearchType - Imm argument");
src.operandReg = (u8)dest; src.operandReg = (u8)dest;
if (bits == 16) if (bits == 16)
Write8(0x66); Write8(0x66);
@ -780,8 +774,7 @@ void XEmitter::BSR(int bits, X64Reg dest, OpArg src) {WriteBitSearchType(bits,de
void XEmitter::MOVSX(int dbits, int sbits, X64Reg dest, OpArg src) void XEmitter::MOVSX(int dbits, int sbits, X64Reg dest, OpArg src)
{ {
if (src.IsImm()) _assert_msg_(DYNA_REC, !src.IsImm(), "MOVSX - Imm argument");
_assert_msg_(DYNA_REC, 0, "MOVSX - Imm argument");
if (dbits == sbits) if (dbits == sbits)
{ {
MOV(dbits, R(dest), src); MOV(dbits, R(dest), src);
@ -814,8 +807,7 @@ void XEmitter::MOVSX(int dbits, int sbits, X64Reg dest, OpArg src)
void XEmitter::MOVZX(int dbits, int sbits, X64Reg dest, OpArg src) void XEmitter::MOVZX(int dbits, int sbits, X64Reg dest, OpArg src)
{ {
if (src.IsImm()) _assert_msg_(DYNA_REC, !src.IsImm(), "MOVZX - Imm argument");
_assert_msg_(DYNA_REC, 0, "MOVZX - Imm argument");
if (dbits == sbits) if (dbits == sbits)
{ {
MOV(dbits, R(dest), src); MOV(dbits, R(dest), src);
@ -882,8 +874,7 @@ void XEmitter::MOVBE(int bits, const OpArg& dest, const OpArg& src)
void XEmitter::LEA(int bits, X64Reg dest, OpArg src) void XEmitter::LEA(int bits, X64Reg dest, OpArg src)
{ {
if (src.IsImm()) _assert_msg_(DYNA_REC, !src.IsImm(), "LEA - Imm argument");
_assert_msg_(DYNA_REC, 0, "LEA - Imm argument");
src.operandReg = (u8)dest; src.operandReg = (u8)dest;
if (bits == 16) if (bits == 16)
Write8(0x66); //TODO: performance warning Write8(0x66); //TODO: performance warning

View File

@ -180,7 +180,8 @@ static void gdb_bp_remove(u32 type, u32 addr, u32 len)
{ {
gdb_bp_t *p; gdb_bp_t *p;
do { do
{
p = gdb_bp_find(type, addr, len); p = gdb_bp_find(type, addr, len);
if (p != nullptr) if (p != nullptr)
{ {

View File

@ -147,7 +147,7 @@ namespace PowerPC
else else
lookup_table[(addr>>5) & 0xfffff] = t; lookup_table[(addr>>5) & 0xfffff] = t;
tags[set][t] = tag; tags[set][t] = tag;
valid[set] |= 1<<t; valid[set] |= (1 << t);
} }
// update plru // update plru
plru[set] = (plru[set] & ~plru_mask[t]) | plru_value[t]; plru[set] = (plru[set] & ~plru_mask[t]) | plru_value[t];

View File

@ -374,10 +374,41 @@ static void LOADERDECL UpdateBoundingBox()
{ {
m = (p1.x - p0.x) ? ((p1.y - p0.y) / (p1.x - p0.x)) : highNum; m = (p1.x - p0.x) ? ((p1.y - p0.y) / (p1.x - p0.x)) : highNum;
c = p0.y - (m * p0.x); c = p0.y - (m * p0.x);
if (i0 & 1) { s = (s32)(c + roundUp); if (s >= 0 && s <= 479) left = 0; top = std::min(s, top); bottom = std::max(s, bottom); } if (i0 & 1)
if (i0 & 2) { s = (s32)((-c / m) + roundUp); if (s >= 0 && s <= 607) top = 0; left = std::min(s, left); right = std::max(s, right); } {
if (i0 & 4) { s = (s32)((m * 607) + c + roundUp); if (s >= 0 && s <= 479) right = 607; top = std::min(s, top); bottom = std::max(s, bottom); } s = (s32)(c + roundUp);
if (i0 & 8) { s = (s32)(((479 - c) / m) + roundUp); if (s >= 0 && s <= 607) bottom = 479; left = std::min(s, left); right = std::max(s, right); } if (s >= 0 && s <= 479)
left = 0;
top = std::min(s, top);
bottom = std::max(s, bottom);
}
if (i0 & 2)
{
s = (s32)((-c / m) + roundUp);
if (s >= 0 && s <= 607)
top = 0;
left = std::min(s, left);
right = std::max(s, right);
}
if (i0 & 4)
{
s = (s32)((m * 607) + c + roundUp);
if (s >= 0 && s <= 479)
right = 607;
top = std::min(s, top);
bottom = std::max(s, bottom);
}
if (i0 & 8)
{
s = (s32)(((479 - c) / m) + roundUp);
if (s >= 0 && s <= 607)
bottom = 479;
left = std::min(s, left);
right = std::max(s, right);
}
} }
// Only check other lines if we are dealing with a triangle // Only check other lines if we are dealing with a triangle
@ -388,10 +419,41 @@ static void LOADERDECL UpdateBoundingBox()
{ {
m = (p2.x - p1.x) ? ((p2.y - p1.y) / (p2.x - p1.x)) : highNum; m = (p2.x - p1.x) ? ((p2.y - p1.y) / (p2.x - p1.x)) : highNum;
c = p1.y - (m * p1.x); c = p1.y - (m * p1.x);
if (i1 & 1) { s = (s32)(c + roundUp); if (s >= 0 && s <= 479) left = 0; top = std::min(s, top); bottom = std::max(s, bottom); } if (i1 & 1)
if (i1 & 2) { s = (s32)((-c / m) + roundUp); if (s >= 0 && s <= 607) top = 0; left = std::min(s, left); right = std::max(s, right); } {
if (i1 & 4) { s = (s32)((m * 607) + c + roundUp); if (s >= 0 && s <= 479) right = 607; top = std::min(s, top); bottom = std::max(s, bottom); } s = (s32)(c + roundUp);
if (i1 & 8) { s = (s32)(((479 - c) / m) + roundUp); if (s >= 0 && s <= 607) bottom = 479; left = std::min(s, left); right = std::max(s, right); } if (s >= 0 && s <= 479)
left = 0;
top = std::min(s, top);
bottom = std::max(s, bottom);
}
if (i1 & 2)
{
s = (s32)((-c / m) + roundUp);
if (s >= 0 && s <= 607)
top = 0;
left = std::min(s, left);
right = std::max(s, right);
}
if (i1 & 4)
{
s = (s32)((m * 607) + c + roundUp);
if (s >= 0 && s <= 479)
right = 607;
top = std::min(s, top);
bottom = std::max(s, bottom);
}
if (i1 & 8)
{
s = (s32)(((479 - c) / m) + roundUp);
if (s >= 0 && s <= 607)
bottom = 479;
left = std::min(s, left);
right = std::max(s, right);
}
} }
// Third line intersects // Third line intersects
@ -399,10 +461,41 @@ static void LOADERDECL UpdateBoundingBox()
{ {
m = (p2.x - p0.x) ? ((p2.y - p0.y) / (p2.x - p0.x)) : highNum; m = (p2.x - p0.x) ? ((p2.y - p0.y) / (p2.x - p0.x)) : highNum;
c = p0.y - (m * p0.x); c = p0.y - (m * p0.x);
if (i2 & 1) { s = (s32)(c + roundUp); if (s >= 0 && s <= 479) left = 0; top = std::min(s, top); bottom = std::max(s, bottom); } if (i2 & 1)
if (i2 & 2) { s = (s32)((-c / m) + roundUp); if (s >= 0 && s <= 607) top = 0; left = std::min(s, left); right = std::max(s, right); } {
if (i2 & 4) { s = (s32)((m * 607) + c + roundUp); if (s >= 0 && s <= 479) right = 607; top = std::min(s, top); bottom = std::max(s, bottom); } s = (s32)(c + roundUp);
if (i2 & 8) { s = (s32)(((479 - c) / m) + roundUp); if (s >= 0 && s <= 607) bottom = 479; left = std::min(s, left); right = std::max(s, right); } if (s >= 0 && s <= 479)
left = 0;
top = std::min(s, top);
bottom = std::max(s, bottom);
}
if (i2 & 2)
{
s = (s32)((-c / m) + roundUp);
if (s >= 0 && s <= 607)
top = 0;
left = std::min(s, left);
right = std::max(s, right);
}
if (i2 & 4)
{
s = (s32)((m * 607) + c + roundUp);
if (s >= 0 && s <= 479)
right = 607;
top = std::min(s, top);
bottom = std::max(s, bottom);
}
if (i2 & 8)
{
s = (s32)(((479 - c) / m) + roundUp);
if (s >= 0 && s <= 607)
bottom = 479;
left = std::min(s, left);
right = std::max(s, right);
}
} }
} }