1
0
mirror of https://github.com/RPCS3/rpcs3.git synced 2025-01-31 12:31:45 +01:00

ppu: Set link unconditionally

This commit is contained in:
eladash 2018-11-23 12:49:03 +02:00 committed by Ivan
parent 5207b00973
commit fb8302817f
2 changed files with 13 additions and 13 deletions

View File

@ -2903,15 +2903,14 @@ bool ppu_interpreter::BC(ppu_thread& ppu, ppu_opcode_t op)
const bool bo3 = (op.bo & 0x02) != 0;
ppu.ctr -= (bo2 ^ true);
if (op.lk) ppu.lr = ppu.cia + 4;
const bool ctr_ok = bo2 | ((ppu.ctr != 0) ^ bo3);
const bool cond_ok = bo0 | (ppu.cr[op.bi] ^ (bo1 ^ true));
if (ctr_ok && cond_ok)
{
const u32 link = ppu.cia + 4;
ppu.cia = (op.aa ? 0 : ppu.cia) + op.bt14;
if (op.lk) ppu.lr = link;
return false;
}
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 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)
{
const u32 link = ppu.cia + 4;
ppu.cia = (u32)ppu.lr & ~3;
if (op.lk) ppu.lr = link;
ppu.cia = target;
return false;
}
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)
{
if (op.lk) ppu.lr = ppu.cia + 4;
if (op.bo & 0x10 || ppu.cr[op.bi] == ((op.bo & 0x8) != 0))
{
const u32 link = ppu.cia + 4;
ppu.cia = (u32)ppu.ctr & ~3;
if (op.lk) ppu.lr = link;
return false;
}

View File

@ -1772,13 +1772,13 @@ void PPUTranslator::BC(ppu_opcode_t op)
CompilationError("Branch with absolute address");
}
UseCondition(CheckBranchProbability(op.bo), CheckBranchCondition(op.bo, op.bi));
if (op.lk)
{
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);
}
@ -1842,13 +1842,13 @@ void PPUTranslator::BCLR(ppu_opcode_t op)
{
const auto target = RegLoad(m_lr);
UseCondition(CheckBranchProbability(op.bo), CheckBranchCondition(op.bo, op.bi));
if (op.lk)
{
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);
}
@ -1905,13 +1905,13 @@ void PPUTranslator::BCCTR(ppu_opcode_t op)
{
const auto target = RegLoad(m_ctr);
UseCondition(CheckBranchProbability(op.bo | 0x4), CheckBranchCondition(op.bo | 0x4, op.bi));
if (op.lk)
{
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);
}