mirror of
https://github.com/shadps4-emu/shadPS4.git
synced 2025-08-01 23:12:35 +00:00
Long jumps for condition and loops
This commit is contained in:
parent
a921e290c1
commit
0885dc733f
@ -15,24 +15,20 @@ using namespace Xbyak::util;
|
|||||||
namespace {
|
namespace {
|
||||||
|
|
||||||
static void EmitCondition(EmitContext& ctx, const IR::Inst* ref, Label& label, bool invert) {
|
static void EmitCondition(EmitContext& ctx, const IR::Inst* ref, Label& label, bool invert) {
|
||||||
|
CodeGenerator& c = ctx.Code();
|
||||||
IR::Value cond = ref->Arg(0);
|
IR::Value cond = ref->Arg(0);
|
||||||
if (cond.IsImmediate()) {
|
if (cond.IsImmediate()) {
|
||||||
// If imediate, we evaluate at compile time
|
// If imediate, we evaluate at compile time
|
||||||
if (cond.U1() != invert) {
|
if (cond.U1() != invert) {
|
||||||
ctx.Code().jmp(label);
|
c.jmp(label, CodeGenerator::LabelType::T_NEAR);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
const OperandHolder& op = ctx.Def(cond.InstRecursive())[0];
|
const OperandHolder& op = ctx.Def(cond.InstRecursive())[0];
|
||||||
if (op.IsReg()) {
|
c.test(op.Op(), 0x1);
|
||||||
Reg8 reg = op.Reg().cvt8();
|
|
||||||
ctx.Code().test(reg, reg);
|
|
||||||
} else {
|
|
||||||
ctx.Code().test(op.Mem(), 0xff);
|
|
||||||
}
|
|
||||||
if (invert) {
|
if (invert) {
|
||||||
ctx.Code().jz(label);
|
c.jz(label, CodeGenerator::LabelType::T_NEAR);
|
||||||
} else {
|
} else {
|
||||||
ctx.Code().jnz(label);
|
c.jnz(label, CodeGenerator::LabelType::T_NEAR);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user