CPU/Recompiler: Add EmitBindLabel and EmitBranchIfBitClear
This commit is contained in:
parent
03a36645a2
commit
4f2c1e1a6b
|
@ -80,6 +80,8 @@ public:
|
||||||
|
|
||||||
// Branching, generates two paths.
|
// Branching, generates two paths.
|
||||||
void EmitBranch(Condition condition, Reg lr_reg, Value&& branch_target);
|
void EmitBranch(Condition condition, Reg lr_reg, Value&& branch_target);
|
||||||
|
void EmitBranchIfBitClear(HostReg reg, RegSize size, u8 bit, LabelType* label);
|
||||||
|
void EmitBindLabel(LabelType* label);
|
||||||
|
|
||||||
// Raising exception if condition is true.
|
// Raising exception if condition is true.
|
||||||
void EmitRaiseException(Exception excode, Condition condition = Condition::Always);
|
void EmitRaiseException(Exception excode, Condition condition = Condition::Always);
|
||||||
|
|
|
@ -1541,6 +1541,27 @@ void CodeGenerator::EmitBranch(Condition condition, Reg lr_reg, Value&& branch_t
|
||||||
m_register_cache.InvalidateGuestRegister(lr_reg);
|
m_register_cache.InvalidateGuestRegister(lr_reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CodeGenerator::EmitBranchIfBitClear(HostReg reg, RegSize size, u8 bit, LabelType* label)
|
||||||
|
{
|
||||||
|
switch (size)
|
||||||
|
{
|
||||||
|
case RegSize_8:
|
||||||
|
case RegSize_16:
|
||||||
|
case RegSize_32:
|
||||||
|
m_emit->tbz(GetHostReg32(reg), bit, label);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
UnreachableCode();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CodeGenerator::EmitBindLabel(LabelType* label)
|
||||||
|
{
|
||||||
|
m_emit->Bind(label);
|
||||||
|
}
|
||||||
|
|
||||||
void CodeGenerator::EmitRaiseException(Exception excode, Condition condition /* = Condition::Always */)
|
void CodeGenerator::EmitRaiseException(Exception excode, Condition condition /* = Condition::Always */)
|
||||||
{
|
{
|
||||||
if (condition == Condition::Always)
|
if (condition == Condition::Always)
|
||||||
|
|
|
@ -1937,6 +1937,36 @@ void CodeGenerator::EmitBranch(Condition condition, Reg lr_reg, Value&& branch_t
|
||||||
m_register_cache.InvalidateGuestRegister(lr_reg);
|
m_register_cache.InvalidateGuestRegister(lr_reg);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void CodeGenerator::EmitBranchIfBitClear(HostReg reg, RegSize size, u8 bit, LabelType* label)
|
||||||
|
{
|
||||||
|
switch (size)
|
||||||
|
{
|
||||||
|
case RegSize_8:
|
||||||
|
m_emit->bt(GetHostReg8(reg), bit);
|
||||||
|
m_emit->jnc(*label);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RegSize_16:
|
||||||
|
m_emit->bt(GetHostReg16(reg), bit);
|
||||||
|
m_emit->jnc(*label);
|
||||||
|
break;
|
||||||
|
|
||||||
|
case RegSize_32:
|
||||||
|
m_emit->bt(GetHostReg32(reg), bit);
|
||||||
|
m_emit->jnc(*label);
|
||||||
|
break;
|
||||||
|
|
||||||
|
default:
|
||||||
|
UnreachableCode();
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void CodeGenerator::EmitBindLabel(LabelType* label)
|
||||||
|
{
|
||||||
|
m_emit->L(*label);
|
||||||
|
}
|
||||||
|
|
||||||
void CodeGenerator::EmitRaiseException(Exception excode, Condition condition /* = Condition::Always */)
|
void CodeGenerator::EmitRaiseException(Exception excode, Condition condition /* = Condition::Always */)
|
||||||
{
|
{
|
||||||
if (condition == Condition::Always)
|
if (condition == Condition::Always)
|
||||||
|
|
|
@ -52,6 +52,7 @@ enum class Condition : u8
|
||||||
|
|
||||||
using HostReg = Xbyak::Operand::Code;
|
using HostReg = Xbyak::Operand::Code;
|
||||||
using CodeEmitter = Xbyak::CodeGenerator;
|
using CodeEmitter = Xbyak::CodeGenerator;
|
||||||
|
using LabelType = Xbyak::Label;
|
||||||
enum : u32
|
enum : u32
|
||||||
{
|
{
|
||||||
HostReg_Count = 16
|
HostReg_Count = 16
|
||||||
|
@ -70,6 +71,7 @@ constexpr bool SHIFTS_ARE_IMPLICITLY_MASKED = true;
|
||||||
|
|
||||||
using HostReg = unsigned;
|
using HostReg = unsigned;
|
||||||
using CodeEmitter = vixl::aarch64::MacroAssembler;
|
using CodeEmitter = vixl::aarch64::MacroAssembler;
|
||||||
|
using LabelType = vixl::aarch64::Label;
|
||||||
enum : u32
|
enum : u32
|
||||||
{
|
{
|
||||||
HostReg_Count = vixl::aarch64::kNumberOfRegisters
|
HostReg_Count = vixl::aarch64::kNumberOfRegisters
|
||||||
|
|
Loading…
Reference in New Issue