mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-04 05:51:27 +12:00
ppu: Set link unconditionally
This commit is contained in:
parent
5207b00973
commit
fb8302817f
2 changed files with 13 additions and 13 deletions
|
@ -2903,15 +2903,14 @@ bool ppu_interpreter::BC(ppu_thread& ppu, ppu_opcode_t op)
|
||||||
const bool bo3 = (op.bo & 0x02) != 0;
|
const bool bo3 = (op.bo & 0x02) != 0;
|
||||||
|
|
||||||
ppu.ctr -= (bo2 ^ true);
|
ppu.ctr -= (bo2 ^ true);
|
||||||
|
if (op.lk) ppu.lr = ppu.cia + 4;
|
||||||
|
|
||||||
const bool ctr_ok = bo2 | ((ppu.ctr != 0) ^ bo3);
|
const bool ctr_ok = bo2 | ((ppu.ctr != 0) ^ bo3);
|
||||||
const bool cond_ok = bo0 | (ppu.cr[op.bi] ^ (bo1 ^ true));
|
const bool cond_ok = bo0 | (ppu.cr[op.bi] ^ (bo1 ^ true));
|
||||||
|
|
||||||
if (ctr_ok && cond_ok)
|
if (ctr_ok && cond_ok)
|
||||||
{
|
{
|
||||||
const u32 link = ppu.cia + 4;
|
|
||||||
ppu.cia = (op.aa ? 0 : ppu.cia) + op.bt14;
|
ppu.cia = (op.aa ? 0 : ppu.cia) + op.bt14;
|
||||||
if (op.lk) ppu.lr = link;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -2958,11 +2957,12 @@ bool ppu_interpreter::BCLR(ppu_thread& ppu, ppu_opcode_t op)
|
||||||
const bool ctr_ok = bo2 | ((ppu.ctr != 0) ^ bo3);
|
const bool ctr_ok = bo2 | ((ppu.ctr != 0) ^ bo3);
|
||||||
const bool cond_ok = bo0 | (ppu.cr[op.bi] ^ (bo1 ^ true));
|
const bool cond_ok = bo0 | (ppu.cr[op.bi] ^ (bo1 ^ true));
|
||||||
|
|
||||||
|
const u32 target = (u32)ppu.lr & ~3;
|
||||||
|
if (op.lk) ppu.lr = ppu.cia + 4;
|
||||||
|
|
||||||
if (ctr_ok && cond_ok)
|
if (ctr_ok && cond_ok)
|
||||||
{
|
{
|
||||||
const u32 link = ppu.cia + 4;
|
ppu.cia = target;
|
||||||
ppu.cia = (u32)ppu.lr & ~3;
|
|
||||||
if (op.lk) ppu.lr = link;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
@ -3027,11 +3027,11 @@ bool ppu_interpreter::CROR(ppu_thread& ppu, ppu_opcode_t op)
|
||||||
|
|
||||||
bool ppu_interpreter::BCCTR(ppu_thread& ppu, ppu_opcode_t op)
|
bool ppu_interpreter::BCCTR(ppu_thread& ppu, ppu_opcode_t op)
|
||||||
{
|
{
|
||||||
|
if (op.lk) ppu.lr = ppu.cia + 4;
|
||||||
|
|
||||||
if (op.bo & 0x10 || ppu.cr[op.bi] == ((op.bo & 0x8) != 0))
|
if (op.bo & 0x10 || ppu.cr[op.bi] == ((op.bo & 0x8) != 0))
|
||||||
{
|
{
|
||||||
const u32 link = ppu.cia + 4;
|
|
||||||
ppu.cia = (u32)ppu.ctr & ~3;
|
ppu.cia = (u32)ppu.ctr & ~3;
|
||||||
if (op.lk) ppu.lr = link;
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -1772,13 +1772,13 @@ void PPUTranslator::BC(ppu_opcode_t op)
|
||||||
CompilationError("Branch with absolute address");
|
CompilationError("Branch with absolute address");
|
||||||
}
|
}
|
||||||
|
|
||||||
UseCondition(CheckBranchProbability(op.bo), CheckBranchCondition(op.bo, op.bi));
|
|
||||||
|
|
||||||
if (op.lk)
|
if (op.lk)
|
||||||
{
|
{
|
||||||
m_ir->CreateStore(GetAddr(+4), m_ir->CreateStructGEP(nullptr, m_thread, &m_lr - m_locals));
|
m_ir->CreateStore(GetAddr(+4), m_ir->CreateStructGEP(nullptr, m_thread, &m_lr - m_locals));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UseCondition(CheckBranchProbability(op.bo), CheckBranchCondition(op.bo, op.bi));
|
||||||
|
|
||||||
CallFunction(target);
|
CallFunction(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1842,13 +1842,13 @@ void PPUTranslator::BCLR(ppu_opcode_t op)
|
||||||
{
|
{
|
||||||
const auto target = RegLoad(m_lr);
|
const auto target = RegLoad(m_lr);
|
||||||
|
|
||||||
UseCondition(CheckBranchProbability(op.bo), CheckBranchCondition(op.bo, op.bi));
|
|
||||||
|
|
||||||
if (op.lk)
|
if (op.lk)
|
||||||
{
|
{
|
||||||
m_ir->CreateStore(GetAddr(+4), m_ir->CreateStructGEP(nullptr, m_thread, &m_lr - m_locals));
|
m_ir->CreateStore(GetAddr(+4), m_ir->CreateStructGEP(nullptr, m_thread, &m_lr - m_locals));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UseCondition(CheckBranchProbability(op.bo), CheckBranchCondition(op.bo, op.bi));
|
||||||
|
|
||||||
CallFunction(0, target);
|
CallFunction(0, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1905,13 +1905,13 @@ void PPUTranslator::BCCTR(ppu_opcode_t op)
|
||||||
{
|
{
|
||||||
const auto target = RegLoad(m_ctr);
|
const auto target = RegLoad(m_ctr);
|
||||||
|
|
||||||
UseCondition(CheckBranchProbability(op.bo | 0x4), CheckBranchCondition(op.bo | 0x4, op.bi));
|
|
||||||
|
|
||||||
if (op.lk)
|
if (op.lk)
|
||||||
{
|
{
|
||||||
m_ir->CreateStore(GetAddr(+4), m_ir->CreateStructGEP(nullptr, m_thread, &m_lr - m_locals));
|
m_ir->CreateStore(GetAddr(+4), m_ir->CreateStructGEP(nullptr, m_thread, &m_lr - m_locals));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
UseCondition(CheckBranchProbability(op.bo | 0x4), CheckBranchCondition(op.bo | 0x4, op.bi));
|
||||||
|
|
||||||
CallFunction(0, target);
|
CallFunction(0, target);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue