Skip to content

Commit

Permalink
Merge pull request #4205 from degasus/arm
Browse files Browse the repository at this point in the history
JitArm64: Cleanup + small fix.
  • Loading branch information
degasus committed Sep 12, 2016
2 parents 66cd11c + a0dcebb commit bdcee1c
Show file tree
Hide file tree
Showing 9 changed files with 98 additions and 99 deletions.
38 changes: 19 additions & 19 deletions Source/Core/Core/PowerPC/JitArm64/Jit.cpp
Expand Up @@ -95,7 +95,7 @@ void JitArm64::FallBackToInterpreter(UGeckoInstruction inst)

Interpreter::Instruction instr = GetInterpreterOp(inst);
MOVI2R(W0, inst.hex);
MOVI2R(X30, (u64)instr);
MOVP2R(X30, instr);
BLR(X30);

if (js.op->opinfo->flags & FL_ENDBLOCK)
Expand Down Expand Up @@ -129,7 +129,7 @@ void JitArm64::HLEFunction(UGeckoInstruction inst)

MOVI2R(W0, js.compilerPC);
MOVI2R(W1, inst.hex);
MOVI2R(X30, (u64)&HLE::Execute);
MOVP2R(X30, &HLE::Execute);
BLR(X30);

ARM64Reg WA = gpr.GetReg();
Expand All @@ -153,7 +153,7 @@ void JitArm64::Cleanup()
if (jo.optimizeGatherPipe && js.fifoBytesThisBlock > 0)
{
gpr.Lock(W0);
MOVI2R(X0, (u64)&GPFifo::FastCheckGatherPipe);
MOVP2R(X0, &GPFifo::FastCheckGatherPipe);
BLR(X0);
gpr.Unlock(W0);
}
Expand Down Expand Up @@ -227,9 +227,9 @@ void JitArm64::WriteExceptionExit(u32 destination, bool only_external)
STR(INDEX_UNSIGNED, DISPATCHER_PC, PPC_REG, PPCSTATE_OFF(pc));
STR(INDEX_UNSIGNED, DISPATCHER_PC, PPC_REG, PPCSTATE_OFF(npc));
if (only_external)
MOVI2R(X30, (u64)&PowerPC::CheckExternalExceptions);
MOVP2R(X30, &PowerPC::CheckExternalExceptions);
else
MOVI2R(X30, (u64)&PowerPC::CheckExceptions);
MOVP2R(X30, &PowerPC::CheckExceptions);
BLR(X30);
LDR(INDEX_UNSIGNED, DISPATCHER_PC, PPC_REG, PPCSTATE_OFF(npc));

Expand All @@ -254,9 +254,9 @@ void JitArm64::WriteExceptionExit(ARM64Reg dest, bool only_external)
STR(INDEX_UNSIGNED, dest, PPC_REG, PPCSTATE_OFF(pc));
STR(INDEX_UNSIGNED, dest, PPC_REG, PPCSTATE_OFF(npc));
if (only_external)
MOVI2R(EncodeRegTo64(dest), (u64)&PowerPC::CheckExternalExceptions);
MOVP2R(EncodeRegTo64(dest), &PowerPC::CheckExternalExceptions);
else
MOVI2R(EncodeRegTo64(dest), (u64)&PowerPC::CheckExceptions);
MOVP2R(EncodeRegTo64(dest), &PowerPC::CheckExceptions);
BLR(EncodeRegTo64(dest));
LDR(INDEX_UNSIGNED, dest, PPC_REG, PPCSTATE_OFF(npc));

Expand Down Expand Up @@ -307,13 +307,13 @@ void JitArm64::BeginTimeProfile(JitBlock* b)
{
EmitResetCycleCounters();
EmitGetCycles(X1);
MOVI2R(X0, (u64)&b->ticStart);
MOVP2R(X0, &b->ticStart);
STR(INDEX_UNSIGNED, X1, X0, 0);
}
else
{
MOVI2R(X1, (u64)QueryPerformanceCounter);
MOVI2R(X0, (u64)&b->ticStart);
MOVP2R(X1, &QueryPerformanceCounter);
MOVP2R(X0, &b->ticStart);
BLR(X1);
}
}
Expand All @@ -323,15 +323,15 @@ void JitArm64::EndTimeProfile(JitBlock* b)
if (m_supports_cycle_counter)
{
EmitGetCycles(X2);
MOVI2R(X0, (u64)&b->ticStart);
MOVP2R(X0, &b->ticStart);
}
else
{
MOVI2R(X1, (u64)QueryPerformanceCounter);
MOVI2R(X0, (u64)&b->ticStop);
MOVP2R(X1, &QueryPerformanceCounter);
MOVP2R(X0, &b->ticStop);
BLR(X1);

MOVI2R(X0, (u64)&b->ticStart);
MOVP2R(X0, &b->ticStart);
LDR(INDEX_UNSIGNED, X2, X0, 8); // Stop
}

Expand Down Expand Up @@ -434,7 +434,7 @@ const u8* JitArm64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer* code_buf, JitB
ARM64Reg WB = gpr.GetReg();
ARM64Reg XA = EncodeRegTo64(WA);
ARM64Reg XB = EncodeRegTo64(WB);
MOVI2R(XA, (u64)&b->runCount);
MOVP2R(XA, &b->runCount);
LDR(INDEX_UNSIGNED, XB, XA, 0);
ADD(XB, XB, 1);
STR(INDEX_UNSIGNED, XB, XA, 0);
Expand All @@ -457,7 +457,7 @@ const u8* JitArm64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer* code_buf, JitB
MOVI2R(DISPATCHER_PC, js.blockStart);
STR(INDEX_UNSIGNED, DISPATCHER_PC, PPC_REG, PPCSTATE_OFF(pc));
MOVI2R(W0, (u32)JitInterface::ExceptionType::EXCEPTIONS_PAIRED_QUANTIZE);
MOVI2R(X1, (u64)&JitInterface::CompileExceptionCheck);
MOVP2R(X1, &JitInterface::CompileExceptionCheck);
BLR(X1);
B(dispatcher);
SwitchToNearCode();
Expand Down Expand Up @@ -508,7 +508,7 @@ const u8* JitArm64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer* code_buf, JitB
FixupBranch exit = B();
SetJumpTarget(Exception);
ABI_PushRegisters(regs_in_use);
MOVI2R(X30, (u64)&GPFifo::FastCheckGatherPipe);
MOVP2R(X30, &GPFifo::FastCheckGatherPipe);
BLR(X30);
ABI_PopRegisters(regs_in_use);

Expand All @@ -517,7 +517,7 @@ const u8* JitArm64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer* code_buf, JitB
TBZ(W30, 3, done_here); // EXCEPTION_EXTERNAL_INT
LDR(INDEX_UNSIGNED, W30, PPC_REG, PPCSTATE_OFF(msr));
TBZ(W30, 11, done_here);
MOVI2R(X30, (u64)&ProcessorInterface::m_InterruptCause);
MOVP2R(X30, &ProcessorInterface::m_InterruptCause);
LDR(INDEX_UNSIGNED, W30, X30, 0);
TST(W30, 23, 2);
B(CC_EQ, done_here);
Expand Down Expand Up @@ -548,7 +548,7 @@ const u8* JitArm64::DoJit(u32 em_address, PPCAnalyst::CodeBuffer* code_buf, JitB
SetJumpTarget(Exception);
LDR(INDEX_UNSIGNED, WA, PPC_REG, PPCSTATE_OFF(msr));
TBZ(WA, 11, done_here);
MOVI2R(XA, (u64)&ProcessorInterface::m_InterruptCause);
MOVP2R(XA, &ProcessorInterface::m_InterruptCause);
LDR(INDEX_UNSIGNED, WA, XA, 0);
TST(WA, 23, 2);
B(CC_EQ, done_here);
Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/PowerPC/JitArm64/JitArm64Cache.cpp
Expand Up @@ -18,7 +18,7 @@ void JitArm64BlockCache::WriteLinkBlock(const JitBlock::LinkData& source, const
s64 distance = ((s64)dest->normalEntry - (s64)location) >> 2;
if (distance >= -0x40000 && distance <= 0x3FFFF)
{
emit.B(CC_LE, dest->normalEntry);
emit.B(CC_PL, dest->normalEntry);
}

// Use the checked entry if either downcount is smaller zero,
Expand Down
28 changes: 14 additions & 14 deletions Source/Core/Core/PowerPC/JitArm64/JitArm64_BackPatch.cpp
Expand Up @@ -181,33 +181,33 @@ void JitArm64::EmitBackpatchRoutine(u32 flags, bool fastmem, bool do_farcode, AR
{
m_float_emit.FCVT(32, 64, D0, RS);
m_float_emit.UMOV(32, W0, Q0, 0);
MOVI2R(X30, (u64)&PowerPC::Write_U32);
MOVP2R(X30, &PowerPC::Write_U32);
BLR(X30);
}
else if (flags & BackPatchInfo::FLAG_SIZE_F32I)
{
m_float_emit.UMOV(32, W0, RS, 0);
MOVI2R(X30, (u64)&PowerPC::Write_U32);
MOVP2R(X30, &PowerPC::Write_U32);
BLR(X30);
}
else if (flags & BackPatchInfo::FLAG_SIZE_F32X2)
{
m_float_emit.FCVTN(32, D0, RS);
m_float_emit.UMOV(64, X0, D0, 0);
ORR(X0, SP, X0, ArithOption(X0, ST_ROR, 32));
MOVI2R(X30, (u64)PowerPC::Write_U64);
MOVP2R(X30, &PowerPC::Write_U64);
BLR(X30);
}
else if (flags & BackPatchInfo::FLAG_SIZE_F32X2I)
{
m_float_emit.UMOV(64, X0, RS, 0);
ORR(X0, SP, X0, ArithOption(X0, ST_ROR, 32));
MOVI2R(X30, (u64)PowerPC::Write_U64);
MOVP2R(X30, &PowerPC::Write_U64);
BLR(X30);
}
else
{
MOVI2R(X30, (u64)&PowerPC::Write_U64);
MOVP2R(X30, &PowerPC::Write_U64);
m_float_emit.UMOV(64, X0, RS, 0);
BLR(X30);
}
Expand All @@ -216,13 +216,13 @@ void JitArm64::EmitBackpatchRoutine(u32 flags, bool fastmem, bool do_farcode, AR
{
if (flags & BackPatchInfo::FLAG_SIZE_F32)
{
MOVI2R(X30, (u64)&PowerPC::Read_U32);
MOVP2R(X30, &PowerPC::Read_U32);
BLR(X30);
m_float_emit.INS(32, RS, 0, X0);
}
else
{
MOVI2R(X30, (u64)&PowerPC::Read_F64);
MOVP2R(X30, &PowerPC::Read_F64);
BLR(X30);
m_float_emit.INS(64, RS, 0, X0);
}
Expand All @@ -232,27 +232,27 @@ void JitArm64::EmitBackpatchRoutine(u32 flags, bool fastmem, bool do_farcode, AR
MOV(W0, RS);

if (flags & BackPatchInfo::FLAG_SIZE_32)
MOVI2R(X30, (u64)&PowerPC::Write_U32);
MOVP2R(X30, &PowerPC::Write_U32);
else if (flags & BackPatchInfo::FLAG_SIZE_16)
MOVI2R(X30, (u64)&PowerPC::Write_U16);
MOVP2R(X30, &PowerPC::Write_U16);
else
MOVI2R(X30, (u64)&PowerPC::Write_U8);
MOVP2R(X30, &PowerPC::Write_U8);

BLR(X30);
}
else if (flags & BackPatchInfo::FLAG_ZERO_256)
{
MOVI2R(X30, (u64)&PowerPC::ClearCacheLine);
MOVP2R(X30, &PowerPC::ClearCacheLine);
BLR(X30);
}
else
{
if (flags & BackPatchInfo::FLAG_SIZE_32)
MOVI2R(X30, (u64)&PowerPC::Read_U32);
MOVP2R(X30, &PowerPC::Read_U32);
else if (flags & BackPatchInfo::FLAG_SIZE_16)
MOVI2R(X30, (u64)&PowerPC::Read_U16);
MOVP2R(X30, &PowerPC::Read_U16);
else if (flags & BackPatchInfo::FLAG_SIZE_8)
MOVI2R(X30, (u64)&PowerPC::Read_U8);
MOVP2R(X30, &PowerPC::Read_U8);

BLR(X30);

Expand Down
2 changes: 1 addition & 1 deletion Source/Core/Core/PowerPC/JitArm64/JitArm64_Branch.cpp
Expand Up @@ -103,7 +103,7 @@ void JitArm64::bx(UGeckoInstruction inst)
ARM64Reg WA = gpr.GetReg();
ARM64Reg XA = EncodeRegTo64(WA);

MOVI2R(XA, (u64)&CoreTiming::Idle);
MOVP2R(XA, &CoreTiming::Idle);
BLR(XA);
gpr.Unlock(WA);

Expand Down
9 changes: 4 additions & 5 deletions Source/Core/Core/PowerPC/JitArm64/JitArm64_LoadStore.cpp
Expand Up @@ -448,7 +448,7 @@ void JitArm64::lXX(UGeckoInstruction inst)

ARM64Reg WA = gpr.GetReg();
ARM64Reg XA = EncodeRegTo64(WA);
MOVI2R(XA, (u64)&CoreTiming::Idle);
MOVP2R(XA, &CoreTiming::Idle);
BLR(XA);
gpr.Unlock(WA);

Expand Down Expand Up @@ -666,8 +666,7 @@ void JitArm64::stmw(UGeckoInstruction inst)
MOVI2R(WA, (u32)(s32)(s16)inst.SIMM_16);
}

u8* base = UReg_MSR(MSR).DR ? Memory::logical_base : Memory::physical_base;
MOVK(XA, ((u64)base >> 32) & 0xFFFF, SHIFT_32);
ADD(XA, XA, MEM_REG);

for (int i = inst.RD; i < 32; i++)
{
Expand Down Expand Up @@ -701,7 +700,7 @@ void JitArm64::dcbx(UGeckoInstruction inst)
AND(value, addr, 32 - 10, 28 - 10); // upper three bits and last 10 bit are masked for the bitset
// of cachelines, 0x1ffffc00
LSR(value, value, 5 + 5); // >> 5 for cache line size, >> 5 for width of bitset
MOVI2R(EncodeRegTo64(WA), (u64)jit->GetBlockCache()->GetBlockBitSet());
MOVP2R(EncodeRegTo64(WA), jit->GetBlockCache()->GetBlockBitSet());
LDR(value, EncodeRegTo64(WA), ArithOption(EncodeRegTo64(value), true));

LSR(addr, addr, 5); // mask sizeof cacheline, & 0x1f is the position within the bitset
Expand All @@ -722,7 +721,7 @@ void JitArm64::dcbx(UGeckoInstruction inst)
LSL(W0, addr, 5);
MOVI2R(X1, 32);
MOVI2R(X2, 0);
MOVI2R(X3, (u64)(void*)JitInterface::InvalidateICache);
MOVP2R(X3, &JitInterface::InvalidateICache);
BLR(X3);

m_float_emit.ABI_PopRegisters(fprs_to_push, X30);
Expand Down
Expand Up @@ -82,7 +82,7 @@ void JitArm64::psq_l(UGeckoInstruction inst)
UBFM(type_reg, scale_reg, 16, 18); // Type
UBFM(scale_reg, scale_reg, 24, 29); // Scale

MOVI2R(X30, (u64)&pairedLoadQuantized[inst.W * 8]);
MOVP2R(X30, &pairedLoadQuantized[inst.W * 8]);
LDR(X30, X30, ArithOption(EncodeRegTo64(type_reg), true));
BLR(X30);

Expand Down Expand Up @@ -193,7 +193,7 @@ void JitArm64::psq_st(UGeckoInstruction inst)
SwitchToFarCode();
SetJumpTarget(fail);
// Slow
MOVI2R(X30, (u64)&pairedStoreQuantized[16 + inst.W * 8]);
MOVP2R(X30, &pairedStoreQuantized[16 + inst.W * 8]);
LDR(EncodeRegTo64(type_reg), X30, ArithOption(EncodeRegTo64(type_reg), true));

ABI_PushRegisters(gprs_in_use);
Expand All @@ -206,7 +206,7 @@ void JitArm64::psq_st(UGeckoInstruction inst)
SetJumpTarget(pass);

// Fast
MOVI2R(X30, (u64)&pairedStoreQuantized[inst.W * 8]);
MOVP2R(X30, &pairedStoreQuantized[inst.W * 8]);
LDR(EncodeRegTo64(type_reg), X30, ArithOption(EncodeRegTo64(type_reg), true));
BLR(EncodeRegTo64(type_reg));

Expand Down
Expand Up @@ -616,7 +616,7 @@ void JitArm64::mtcrf(UGeckoInstruction inst)
ARM64Reg XA = EncodeRegTo64(WA);
ARM64Reg WB = gpr.GetReg();
ARM64Reg XB = EncodeRegTo64(WB);
MOVI2R(XB, (u64)m_crTable);
MOVP2R(XB, m_crTable);
for (int i = 0; i < 8; ++i)
{
if ((crm & (0x80 >> i)) != 0)
Expand Down

0 comments on commit bdcee1c

Please sign in to comment.