mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-04-20 19:45:20 +00:00
PPU LLVM: Implement OE for few instructions
This commit is contained in:
parent
4e8e5a7fed
commit
929be0b4e6
2 changed files with 16 additions and 4 deletions
|
@ -4230,7 +4230,7 @@ auto NEG()
|
|||
const u64 RA = ppu.gpr[op.ra];
|
||||
ppu.gpr[op.rd] = 0 - RA;
|
||||
if constexpr (((Flags == has_oe) || ...))
|
||||
ppu_ov_set(ppu, (~RA >> 63 == 0) && (~RA >> 63 != ppu.gpr[op.rd] >> 63));
|
||||
ppu_ov_set(ppu, RA == (1ull << 63));
|
||||
if constexpr (((Flags == has_rc) || ...))
|
||||
ppu_cr_set<s64>(ppu, 0, ppu.gpr[op.rd], 0);
|
||||
};
|
||||
|
|
|
@ -2657,7 +2657,13 @@ void PPUTranslator::ADDC(ppu_opcode_t op)
|
|||
SetGpr(op.rd, result);
|
||||
SetCarry(m_ir->CreateICmpULT(result, b));
|
||||
if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0));
|
||||
if (op.oe) UNK(op);
|
||||
|
||||
if (op.oe)
|
||||
{
|
||||
//const auto s = m_ir->CreateCall(get_intrinsic<u64>(llvm::Intrinsic::sadd_with_overflow), {a, b});
|
||||
//SetOverflow(m_ir->CreateExtractValue(s, {1}));
|
||||
SetOverflow(m_ir->CreateICmpSLT(m_ir->CreateAnd(m_ir->CreateXor(a, m_ir->CreateNot(b)), m_ir->CreateXor(a, result)), m_ir->getInt64(0)));
|
||||
}
|
||||
}
|
||||
|
||||
void PPUTranslator::MULHDU(ppu_opcode_t op)
|
||||
|
@ -2812,7 +2818,13 @@ void PPUTranslator::SUBF(ppu_opcode_t op)
|
|||
const auto result = m_ir->CreateSub(b, a);
|
||||
SetGpr(op.rd, result);
|
||||
if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0));
|
||||
if (op.oe) UNK(op);
|
||||
|
||||
if (op.oe)
|
||||
{
|
||||
//const auto s = m_ir->CreateCall(get_intrinsic<u64>(llvm::Intrinsic::ssub_with_overflow), {b, m_ir->CreateNot(a)});
|
||||
//SetOverflow(m_ir->CreateExtractValue(s, {1}));
|
||||
SetOverflow(m_ir->CreateICmpSLT(m_ir->CreateAnd(m_ir->CreateXor(a, b), m_ir->CreateXor(m_ir->CreateNot(a), result)), m_ir->getInt64(0)));
|
||||
}
|
||||
}
|
||||
|
||||
void PPUTranslator::LDUX(ppu_opcode_t op)
|
||||
|
@ -2914,7 +2926,7 @@ void PPUTranslator::NEG(ppu_opcode_t op)
|
|||
const auto result = m_ir->CreateNeg(reg);
|
||||
SetGpr(op.rd, result);
|
||||
if (op.rc) SetCrFieldSignedCmp(0, result, m_ir->getInt64(0));
|
||||
if (op.oe) UNK(op);
|
||||
if (op.oe) SetOverflow(m_ir->CreateICmpEQ(result, m_ir->getInt64(1ull << 63)));
|
||||
}
|
||||
|
||||
void PPUTranslator::LBZUX(ppu_opcode_t op)
|
||||
|
|
Loading…
Add table
Reference in a new issue