mirror of
https://github.com/izzy2lost/dolphin.git
synced 2026-06-19 01:16:48 -07:00
Merge pull request #9402 from lioncash/emitter
Arm64Emitter: Interface cleanup
This commit is contained in:
+144
-146
File diff suppressed because it is too large
Load Diff
@@ -302,69 +302,69 @@ enum IndexType
|
||||
INDEX_SIGNED, // used in LDP/STP
|
||||
};
|
||||
|
||||
enum ShiftAmount
|
||||
enum class ShiftAmount
|
||||
{
|
||||
SHIFT_0 = 0,
|
||||
SHIFT_16 = 1,
|
||||
SHIFT_32 = 2,
|
||||
SHIFT_48 = 3,
|
||||
Shift0,
|
||||
Shift16,
|
||||
Shift32,
|
||||
Shift48,
|
||||
};
|
||||
|
||||
enum RoundingMode
|
||||
enum class RoundingMode
|
||||
{
|
||||
ROUND_A, // round to nearest, ties to away
|
||||
ROUND_M, // round towards -inf
|
||||
ROUND_N, // round to nearest, ties to even
|
||||
ROUND_P, // round towards +inf
|
||||
ROUND_Z, // round towards zero
|
||||
A, // round to nearest, ties to away
|
||||
M, // round towards -inf
|
||||
N, // round to nearest, ties to even
|
||||
P, // round towards +inf
|
||||
Z, // round towards zero
|
||||
};
|
||||
|
||||
struct FixupBranch
|
||||
{
|
||||
u8* ptr;
|
||||
// Type defines
|
||||
// 0 = CBZ (32bit)
|
||||
// 1 = CBNZ (32bit)
|
||||
// 2 = B (conditional)
|
||||
// 3 = TBZ
|
||||
// 4 = TBNZ
|
||||
// 5 = B (unconditional)
|
||||
// 6 = BL (unconditional)
|
||||
u32 type;
|
||||
enum class Type : u32
|
||||
{
|
||||
CBZ,
|
||||
CBNZ,
|
||||
BConditional,
|
||||
TBZ,
|
||||
TBNZ,
|
||||
B,
|
||||
BL,
|
||||
};
|
||||
|
||||
u8* ptr;
|
||||
Type type;
|
||||
// Used with B.cond
|
||||
CCFlags cond;
|
||||
|
||||
// Used with TBZ/TBNZ
|
||||
u8 bit;
|
||||
|
||||
// Used with Test/Compare and Branch
|
||||
ARM64Reg reg;
|
||||
};
|
||||
|
||||
enum PStateField
|
||||
enum class PStateField
|
||||
{
|
||||
FIELD_SPSel = 0,
|
||||
FIELD_DAIFSet,
|
||||
FIELD_DAIFClr,
|
||||
FIELD_NZCV, // The only system registers accessible from EL0 (user space)
|
||||
FIELD_PMCR_EL0,
|
||||
FIELD_PMCCNTR_EL0,
|
||||
FIELD_FPCR = 0x340,
|
||||
FIELD_FPSR = 0x341,
|
||||
SPSel = 0,
|
||||
DAIFSet,
|
||||
DAIFClr,
|
||||
NZCV, // The only system registers accessible from EL0 (user space)
|
||||
PMCR_EL0,
|
||||
PMCCNTR_EL0,
|
||||
FPCR = 0x340,
|
||||
FPSR = 0x341,
|
||||
};
|
||||
|
||||
enum SystemHint
|
||||
enum class SystemHint
|
||||
{
|
||||
HINT_NOP = 0,
|
||||
HINT_YIELD,
|
||||
HINT_WFE,
|
||||
HINT_WFI,
|
||||
HINT_SEV,
|
||||
HINT_SEVL,
|
||||
NOP,
|
||||
YIELD,
|
||||
WFE,
|
||||
WFI,
|
||||
SEV,
|
||||
SEVL,
|
||||
};
|
||||
|
||||
enum BarrierType
|
||||
enum class BarrierType
|
||||
{
|
||||
OSHLD = 1,
|
||||
OSHST = 2,
|
||||
@@ -603,6 +603,13 @@ public:
|
||||
void CNTVCT(ARM64Reg Rt);
|
||||
|
||||
void HINT(SystemHint op);
|
||||
void NOP() { HINT(SystemHint::NOP); }
|
||||
void SEV() { HINT(SystemHint::SEV); }
|
||||
void SEVL() { HINT(SystemHint::SEVL); }
|
||||
void WFE() { HINT(SystemHint::WFE); }
|
||||
void WFI() { HINT(SystemHint::WFI); }
|
||||
void YIELD() { HINT(SystemHint::YIELD); }
|
||||
|
||||
void CLREX();
|
||||
void DSB(BarrierType type);
|
||||
void DMB(BarrierType type);
|
||||
@@ -737,9 +744,9 @@ public:
|
||||
void CMP(ARM64Reg Rn, u32 imm, bool shift = false);
|
||||
|
||||
// Data Processing (Immediate)
|
||||
void MOVZ(ARM64Reg Rd, u32 imm, ShiftAmount pos = SHIFT_0);
|
||||
void MOVN(ARM64Reg Rd, u32 imm, ShiftAmount pos = SHIFT_0);
|
||||
void MOVK(ARM64Reg Rd, u32 imm, ShiftAmount pos = SHIFT_0);
|
||||
void MOVZ(ARM64Reg Rd, u32 imm, ShiftAmount pos = ShiftAmount::Shift0);
|
||||
void MOVN(ARM64Reg Rd, u32 imm, ShiftAmount pos = ShiftAmount::Shift0);
|
||||
void MOVK(ARM64Reg Rd, u32 imm, ShiftAmount pos = ShiftAmount::Shift0);
|
||||
|
||||
// Bitfield move
|
||||
void BFM(ARM64Reg Rd, ARM64Reg Rn, u32 immr, u32 imms);
|
||||
|
||||
@@ -19,8 +19,8 @@ void JitArm64BlockCache::WriteLinkBlock(Arm64Gen::ARM64XEmitter& emit,
|
||||
if (!dest)
|
||||
{
|
||||
// Use a fixed amount of instructions, so we can assume to use 3 instructions on patching.
|
||||
emit.MOVZ(DISPATCHER_PC, source.exitAddress & 0xFFFF, SHIFT_0);
|
||||
emit.MOVK(DISPATCHER_PC, source.exitAddress >> 16, SHIFT_16);
|
||||
emit.MOVZ(DISPATCHER_PC, source.exitAddress & 0xFFFF, ShiftAmount::Shift0);
|
||||
emit.MOVK(DISPATCHER_PC, source.exitAddress >> 16, ShiftAmount::Shift16);
|
||||
|
||||
if (source.call)
|
||||
emit.BL(m_jit.GetAsmRoutines()->dispatcher);
|
||||
|
||||
@@ -322,7 +322,7 @@ bool JitArm64::HandleFastmemFault(uintptr_t access_address, SContext* ctx)
|
||||
|
||||
const u32 num_insts_max = fastmem_area_length / 4 - 1;
|
||||
for (u32 i = 0; i < num_insts_max; ++i)
|
||||
emitter.HINT(HINT_NOP);
|
||||
emitter.NOP();
|
||||
|
||||
m_fault_to_handler.erase(slow_handler_iter);
|
||||
|
||||
|
||||
@@ -335,13 +335,13 @@ void JitArm64::fctiwzx(UGeckoInstruction inst)
|
||||
|
||||
if (single)
|
||||
{
|
||||
m_float_emit.FCVTS(EncodeRegToSingle(VD), EncodeRegToSingle(VB), ROUND_Z);
|
||||
m_float_emit.FCVTS(EncodeRegToSingle(VD), EncodeRegToSingle(VB), RoundingMode::Z);
|
||||
}
|
||||
else
|
||||
{
|
||||
ARM64Reg V1 = gpr.GetReg();
|
||||
|
||||
m_float_emit.FCVTS(V1, EncodeRegToDouble(VB), ROUND_Z);
|
||||
m_float_emit.FCVTS(V1, EncodeRegToDouble(VB), RoundingMode::Z);
|
||||
m_float_emit.FMOV(EncodeRegToSingle(VD), V1);
|
||||
|
||||
gpr.Unlock(V1);
|
||||
|
||||
@@ -261,7 +261,7 @@ void JitArm64::mfspr(UGeckoInstruction inst)
|
||||
m_float_emit.LDR(32, INDEX_UNSIGNED, SD, Xg,
|
||||
offsetof(CoreTiming::Globals, last_OC_factor_inverted));
|
||||
m_float_emit.FMUL(SC, SC, SD);
|
||||
m_float_emit.FCVTS(Xresult, SC, ROUND_Z);
|
||||
m_float_emit.FCVTS(Xresult, SC, RoundingMode::Z);
|
||||
|
||||
LDP(INDEX_SIGNED, XA, XB, Xg, offsetof(CoreTiming::Globals, global_timer));
|
||||
SXTW(XB, WB);
|
||||
|
||||
Reference in New Issue
Block a user