mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2024-11-14 21:37:42 -07:00
slightly better code
This commit is contained in:
parent
c133814713
commit
7afa805afc
@ -126,13 +126,13 @@ void A_MSR_IMM(ARM* cpu)
|
|||||||
if (!(cpu->CurInstr & (1<<22)))
|
if (!(cpu->CurInstr & (1<<22)))
|
||||||
cpu->UpdateMode(oldpsr, cpu->CPSR);
|
cpu->UpdateMode(oldpsr, cpu->CPSR);
|
||||||
|
|
||||||
if (!(oldpsr & 0x20) && (cpu->CPSR & 0x20))
|
if (cpu->CPSR & 0x20) [[unlikely]]
|
||||||
{
|
{
|
||||||
if (cpu->Num == 0) cpu->NextInstr[1] &= 0xFFFF; // checkme: probably not the right way to handle this
|
if (cpu->Num == 0) cpu->NextInstr[1] &= 0xFFFF; // checkme: probably not the right way to handle this
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Platform::Log(Platform::LogLevel::Warn, "UNIMPLEMENTED: MSR IMM T bit change on ARM7\n");
|
Platform::Log(Platform::LogLevel::Warn, "UNIMPLEMENTED: MSR REG T bit change on ARM7\n");
|
||||||
cpu->CPSR = (cpu->CPSR & ~0x20) | (oldpsr & 0x20); // keep it from crashing the emulator at least
|
cpu->CPSR &= ~0x20; // keep it from crashing the emulator at least
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -186,13 +186,13 @@ void A_MSR_REG(ARM* cpu)
|
|||||||
if (!(cpu->CurInstr & (1<<22)))
|
if (!(cpu->CurInstr & (1<<22)))
|
||||||
cpu->UpdateMode(oldpsr, cpu->CPSR);
|
cpu->UpdateMode(oldpsr, cpu->CPSR);
|
||||||
|
|
||||||
if (!(oldpsr & 0x20) && (cpu->CPSR & 0x20))
|
if (cpu->CPSR & 0x20) [[unlikely]]
|
||||||
{
|
{
|
||||||
if (cpu->Num == 0) cpu->NextInstr[1] &= 0xFFFF; // checkme: probably not the right way to handle this
|
if (cpu->Num == 0) cpu->NextInstr[1] &= 0xFFFF; // checkme: probably not the right way to handle this
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Platform::Log(Platform::LogLevel::Warn, "UNIMPLEMENTED: MSR REG T bit change on ARM7\n");
|
Platform::Log(Platform::LogLevel::Warn, "UNIMPLEMENTED: MSR REG T bit change on ARM7\n");
|
||||||
cpu->CPSR = (cpu->CPSR & ~0x20) | (oldpsr & 0x20); // keep it from crashing the emulator at least
|
cpu->CPSR &= ~0x20; // keep it from crashing the emulator at least
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -583,16 +583,16 @@ A_IMPLEMENT_ALU_OP(RSC,)
|
|||||||
u32 res = a & b; \
|
u32 res = a & b; \
|
||||||
cpu->SetNZ(res & 0x80000000, \
|
cpu->SetNZ(res & 0x80000000, \
|
||||||
!res); \
|
!res); \
|
||||||
if (((cpu->CurInstr>>12) & 0xF) == 15) /* yes this instruction has a secret rd for some reason */ \
|
if (((cpu->CurInstr>>12) & 0xF) == 15) [[unlikely]] /* yes this instruction has a secret rd for some reason */ \
|
||||||
{ \
|
{ \
|
||||||
if (cpu->Num == 1) \
|
if (cpu->Num == 1) \
|
||||||
{ \
|
{ \
|
||||||
u32 oldpsr = cpu->CPSR; \
|
u32 oldpsr = cpu->CPSR; \
|
||||||
cpu->RestoreCPSR(); /* ARM7TDMI restores cpsr and does ___not___ flush the pipeline. */ \
|
cpu->RestoreCPSR(); /* ARM7TDMI restores cpsr and does ___not___ flush the pipeline. */ \
|
||||||
if (!(oldpsr & 0x20) && (cpu->CPSR & 0x20)) \
|
if (cpu->CPSR & 0x20) \
|
||||||
{ \
|
{ \
|
||||||
Platform::Log(Platform::LogLevel::Warn, "UNIMPLEMENTED: TST T bit change on ARM7\n"); \
|
Platform::Log(Platform::LogLevel::Warn, "UNIMPLEMENTED: TST T bit change on ARM7\n"); \
|
||||||
cpu->CPSR = (cpu->CPSR & ~0x20) | (oldpsr & 0x20); /* keep it from crashing the emulator at least */ \
|
cpu->CPSR &= ~0x20; /* keep it from crashing the emulator at least */ \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
else Platform::Log(Platform::LogLevel::Warn, "UNIMPLEMENTED: TST w/ rd == 15 on ARM9\n"); \
|
else Platform::Log(Platform::LogLevel::Warn, "UNIMPLEMENTED: TST w/ rd == 15 on ARM9\n"); \
|
||||||
@ -607,16 +607,16 @@ A_IMPLEMENT_ALU_TEST(TST,_S)
|
|||||||
u32 res = a ^ b; \
|
u32 res = a ^ b; \
|
||||||
cpu->SetNZ(res & 0x80000000, \
|
cpu->SetNZ(res & 0x80000000, \
|
||||||
!res); \
|
!res); \
|
||||||
if (((cpu->CurInstr>>12) & 0xF) == 15) /* yes this instruction has a secret rd for some reason */ \
|
if (((cpu->CurInstr>>12) & 0xF) == 15) [[unlikely]] /* yes this instruction has a secret rd for some reason */ \
|
||||||
{ \
|
{ \
|
||||||
if (cpu->Num == 1) \
|
if (cpu->Num == 1) \
|
||||||
{ \
|
{ \
|
||||||
u32 oldpsr = cpu->CPSR; \
|
u32 oldpsr = cpu->CPSR; \
|
||||||
cpu->RestoreCPSR(); /* ARM7TDMI restores cpsr and does ___not___ flush the pipeline. */ \
|
cpu->RestoreCPSR(); /* ARM7TDMI restores cpsr and does ___not___ flush the pipeline. */ \
|
||||||
if (!(oldpsr & 0x20) && (cpu->CPSR & 0x20)) \
|
if (cpu->CPSR & 0x20) \
|
||||||
{ \
|
{ \
|
||||||
Platform::Log(Platform::LogLevel::Warn, "UNIMPLEMENTED: TEQ T bit change on ARM7\n"); \
|
Platform::Log(Platform::LogLevel::Warn, "UNIMPLEMENTED: TEQ T bit change on ARM7\n"); \
|
||||||
cpu->CPSR = (cpu->CPSR & ~0x20) | (oldpsr & 0x20); /* keep it from crashing the emulator at least */ \
|
cpu->CPSR &= ~0x20; /* keep it from crashing the emulator at least */ \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
else Platform::Log(Platform::LogLevel::Warn, "UNIMPLEMENTED: TEQ w/ rd == 15 on ARM9\n"); \
|
else Platform::Log(Platform::LogLevel::Warn, "UNIMPLEMENTED: TEQ w/ rd == 15 on ARM9\n"); \
|
||||||
@ -633,16 +633,16 @@ A_IMPLEMENT_ALU_TEST(TEQ,_S)
|
|||||||
!res, \
|
!res, \
|
||||||
CarrySub(a, b), \
|
CarrySub(a, b), \
|
||||||
OverflowSub(a, b)); \
|
OverflowSub(a, b)); \
|
||||||
if (((cpu->CurInstr>>12) & 0xF) == 15) /* yes this instruction has a secret rd for some reason */ \
|
if (((cpu->CurInstr>>12) & 0xF) == 15) [[unlikely]] /* yes this instruction has a secret rd for some reason */ \
|
||||||
{ \
|
{ \
|
||||||
if (cpu->Num == 1) \
|
if (cpu->Num == 1) \
|
||||||
{ \
|
{ \
|
||||||
u32 oldpsr = cpu->CPSR; \
|
u32 oldpsr = cpu->CPSR; \
|
||||||
cpu->RestoreCPSR(); /* ARM7TDMI restores cpsr and does ___not___ flush the pipeline. */ \
|
cpu->RestoreCPSR(); /* ARM7TDMI restores cpsr and does ___not___ flush the pipeline. */ \
|
||||||
if (!(oldpsr & 0x20) && (cpu->CPSR & 0x20)) \
|
if (cpu->CPSR & 0x20) \
|
||||||
{ \
|
{ \
|
||||||
Platform::Log(Platform::LogLevel::Warn, "UNIMPLEMENTED: CMP T bit change on ARM7\n"); \
|
Platform::Log(Platform::LogLevel::Warn, "UNIMPLEMENTED: CMP T bit change on ARM7\n"); \
|
||||||
cpu->CPSR = (cpu->CPSR & ~0x20) | (oldpsr & 0x20); /* keep it from crashing the emulator at least */ \
|
cpu->CPSR &= ~0x20; /* keep it from crashing the emulator at least */ \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
else Platform::Log(Platform::LogLevel::Warn, "UNIMPLEMENTED: CMP w/ rd == 15 on ARM9\n"); \
|
else Platform::Log(Platform::LogLevel::Warn, "UNIMPLEMENTED: CMP w/ rd == 15 on ARM9\n"); \
|
||||||
@ -659,16 +659,16 @@ A_IMPLEMENT_ALU_TEST(CMP,)
|
|||||||
!res, \
|
!res, \
|
||||||
CarryAdd(a, b), \
|
CarryAdd(a, b), \
|
||||||
OverflowAdd(a, b)); \
|
OverflowAdd(a, b)); \
|
||||||
if (((cpu->CurInstr>>12) & 0xF) == 15) /* yes this instruction has a secret rd for some reason */ \
|
if (((cpu->CurInstr>>12) & 0xF) == 15) [[unlikely]] /* yes this instruction has a secret rd for some reason */ \
|
||||||
{ \
|
{ \
|
||||||
if (cpu->Num == 1) \
|
if (cpu->Num == 1) \
|
||||||
{ \
|
{ \
|
||||||
u32 oldpsr = cpu->CPSR; \
|
u32 oldpsr = cpu->CPSR; \
|
||||||
cpu->RestoreCPSR(); /* ARM7TDMI restores cpsr and does ___not___ flush the pipeline. */ \
|
cpu->RestoreCPSR(); /* ARM7TDMI restores cpsr and does ___not___ flush the pipeline. */ \
|
||||||
if (!(oldpsr & 0x20) && (cpu->CPSR & 0x20)) \
|
if (cpu->CPSR & 0x20) \
|
||||||
{ \
|
{ \
|
||||||
Platform::Log(Platform::LogLevel::Warn, "UNIMPLEMENTED: CMN T bit change on ARM7\n"); \
|
Platform::Log(Platform::LogLevel::Warn, "UNIMPLEMENTED: CMN T bit change on ARM7\n"); \
|
||||||
cpu->CPSR = (cpu->CPSR & ~0x20) | (oldpsr & 0x20); /* keep it from crashing the emulator at least */ \
|
cpu->CPSR &= ~0x20; /* keep it from crashing the emulator at least */ \
|
||||||
} \
|
} \
|
||||||
} \
|
} \
|
||||||
else Platform::Log(Platform::LogLevel::Warn, "UNIMPLEMENTED: CMN w/ rd == 15 on ARM9\n"); \
|
else Platform::Log(Platform::LogLevel::Warn, "UNIMPLEMENTED: CMN w/ rd == 15 on ARM9\n"); \
|
||||||
@ -1625,16 +1625,16 @@ void T_CMP_HIREG(ARM* cpu)
|
|||||||
!res,
|
!res,
|
||||||
CarrySub(a, b),
|
CarrySub(a, b),
|
||||||
OverflowSub(a, b));
|
OverflowSub(a, b));
|
||||||
if (rd == 15)
|
if (rd == 15) [[unlikely]]
|
||||||
{
|
{
|
||||||
if (cpu->Num == 1)
|
if (cpu->Num == 1)
|
||||||
{
|
{
|
||||||
u32 oldpsr = cpu->CPSR;
|
u32 oldpsr = cpu->CPSR;
|
||||||
cpu->RestoreCPSR(); // ARM7TDMI restores cpsr and does ___not___ flush the pipeline.
|
cpu->RestoreCPSR(); // ARM7TDMI restores cpsr and does ___not___ flush the pipeline.
|
||||||
if (!(oldpsr & 0x20) && (cpu->CPSR & 0x20))
|
if (!(cpu->CPSR & 0x20))
|
||||||
{
|
{
|
||||||
Platform::Log(Platform::LogLevel::Warn, "UNIMPLEMENTED: MSR REG T bit change on ARM7\n");
|
Platform::Log(Platform::LogLevel::Warn, "UNIMPLEMENTED: MSR REG T bit change on ARM7\n");
|
||||||
cpu->CPSR = (cpu->CPSR & ~0x20) | (oldpsr & 0x20); // keep it from crashing the emulator at least
|
cpu->CPSR |= 0x20; // keep it from crashing the emulator at least
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else Platform::Log(Platform::LogLevel::Warn, "UNIMPLEMENTED: CMP HIREG w/ rd == 15 on ARM9\n");
|
else Platform::Log(Platform::LogLevel::Warn, "UNIMPLEMENTED: CMP HIREG w/ rd == 15 on ARM9\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user