mirror of
https://github.com/melonDS-emu/melonDS.git
synced 2024-11-14 13:27:41 -07:00
multiply instructions can't write to r15
This commit is contained in:
parent
a0d71135a1
commit
3b9a9e4eb3
@ -766,7 +766,9 @@ void A_MUL(ARM* cpu)
|
||||
|
||||
u32 res = rm * rs;
|
||||
|
||||
if (((cpu->CurInstr >> 16) & 0xF) != 15) // check arm7
|
||||
cpu->R[(cpu->CurInstr >> 16) & 0xF] = res;
|
||||
|
||||
if (cpu->CurInstr & (1<<20))
|
||||
{
|
||||
cpu->SetNZ(res & 0x80000000,
|
||||
@ -796,7 +798,9 @@ void A_MLA(ARM* cpu)
|
||||
|
||||
u32 res = (rm * rs) + rn;
|
||||
|
||||
if (((cpu->CurInstr >> 16) & 0xF) != 15) // check arm7
|
||||
cpu->R[(cpu->CurInstr >> 16) & 0xF] = res;
|
||||
|
||||
if (cpu->CurInstr & (1<<20))
|
||||
{
|
||||
cpu->SetNZ(res & 0x80000000,
|
||||
@ -825,8 +829,11 @@ void A_UMULL(ARM* cpu)
|
||||
|
||||
u64 res = (u64)rm * (u64)rs;
|
||||
|
||||
if (((cpu->CurInstr >> 12) & 0xF) != 15)
|
||||
cpu->R[(cpu->CurInstr >> 12) & 0xF] = (u32)res;
|
||||
if (((cpu->CurInstr >> 16) & 0xF) != 15)
|
||||
cpu->R[(cpu->CurInstr >> 16) & 0xF] = (u32)(res >> 32ULL);
|
||||
|
||||
if (cpu->CurInstr & (1<<20))
|
||||
{
|
||||
cpu->SetNZ((u32)(res >> 63ULL),
|
||||
@ -858,8 +865,11 @@ void A_UMLAL(ARM* cpu)
|
||||
u64 rd = (u64)cpu->R[(cpu->CurInstr >> 12) & 0xF] | ((u64)cpu->R[(cpu->CurInstr >> 16) & 0xF] << 32ULL);
|
||||
res += rd;
|
||||
|
||||
if (((cpu->CurInstr >> 12) & 0xF) != 15)
|
||||
cpu->R[(cpu->CurInstr >> 12) & 0xF] = (u32)res;
|
||||
if (((cpu->CurInstr >> 16) & 0xF) != 15)
|
||||
cpu->R[(cpu->CurInstr >> 16) & 0xF] = (u32)(res >> 32ULL);
|
||||
|
||||
if (cpu->CurInstr & (1<<20))
|
||||
{
|
||||
cpu->SetNZ((u32)(res >> 63ULL),
|
||||
@ -888,8 +898,11 @@ void A_SMULL(ARM* cpu)
|
||||
|
||||
s64 res = (s64)(s32)rm * (s64)(s32)rs;
|
||||
|
||||
if (((cpu->CurInstr >> 12) & 0xF) != 15)
|
||||
cpu->R[(cpu->CurInstr >> 12) & 0xF] = (u32)res;
|
||||
if (((cpu->CurInstr >> 16) & 0xF) != 15)
|
||||
cpu->R[(cpu->CurInstr >> 16) & 0xF] = (u32)(res >> 32ULL);
|
||||
|
||||
if (cpu->CurInstr & (1<<20))
|
||||
{
|
||||
cpu->SetNZ((u32)(res >> 63ULL),
|
||||
@ -921,8 +934,11 @@ void A_SMLAL(ARM* cpu)
|
||||
s64 rd = (s64)((u64)cpu->R[(cpu->CurInstr >> 12) & 0xF] | ((u64)cpu->R[(cpu->CurInstr >> 16) & 0xF] << 32ULL));
|
||||
res += rd;
|
||||
|
||||
if (((cpu->CurInstr >> 12) & 0xF) != 15)
|
||||
cpu->R[(cpu->CurInstr >> 12) & 0xF] = (u32)res;
|
||||
if (((cpu->CurInstr >> 16) & 0xF) != 15)
|
||||
cpu->R[(cpu->CurInstr >> 16) & 0xF] = (u32)(res >> 32ULL);
|
||||
|
||||
if (cpu->CurInstr & (1<<20))
|
||||
{
|
||||
cpu->SetNZ((u32)(res >> 63ULL),
|
||||
@ -960,7 +976,9 @@ void A_SMLAxy(ARM* cpu)
|
||||
u32 res_mul = ((s16)rm * (s16)rs);
|
||||
u32 res = res_mul + rn;
|
||||
|
||||
if (((cpu->CurInstr >> 16) & 0xF) != 15)
|
||||
cpu->R[(cpu->CurInstr >> 16) & 0xF] = res;
|
||||
|
||||
if (OverflowAdd(res_mul, rn))
|
||||
cpu->CPSR |= 0x08000000;
|
||||
|
||||
@ -981,6 +999,7 @@ void A_SMLAWy(ARM* cpu)
|
||||
u32 res_mul = ((s64)(s32)rm * (s16)rs) >> 16;
|
||||
u32 res = res_mul + rn;
|
||||
|
||||
if (((cpu->CurInstr >> 16) & 0xF) != 15)
|
||||
cpu->R[(cpu->CurInstr >> 16) & 0xF] = res;
|
||||
if (OverflowAdd(res_mul, rn))
|
||||
cpu->CPSR |= 0x08000000;
|
||||
@ -1002,6 +1021,7 @@ void A_SMULxy(ARM* cpu)
|
||||
|
||||
u32 res = ((s16)rm * (s16)rs);
|
||||
|
||||
if (((cpu->CurInstr >> 16) & 0xF) != 15)
|
||||
cpu->R[(cpu->CurInstr >> 16) & 0xF] = res;
|
||||
cpu->AddCycles_C(); // TODO: interlock??
|
||||
}
|
||||
@ -1018,6 +1038,7 @@ void A_SMULWy(ARM* cpu)
|
||||
|
||||
u32 res = ((s64)(s32)rm * (s16)rs) >> 16;
|
||||
|
||||
if (((cpu->CurInstr >> 16) & 0xF) != 15)
|
||||
cpu->R[(cpu->CurInstr >> 16) & 0xF] = res;
|
||||
cpu->AddCycles_C(); // TODO: interlock??
|
||||
}
|
||||
@ -1039,7 +1060,10 @@ void A_SMLALxy(ARM* cpu)
|
||||
s64 rd = (s64)((u64)cpu->R[(cpu->CurInstr >> 12) & 0xF] | ((u64)cpu->R[(cpu->CurInstr >> 16) & 0xF] << 32ULL));
|
||||
res += rd;
|
||||
|
||||
if (((cpu->CurInstr >> 12) & 0xF) != 15)
|
||||
cpu->R[(cpu->CurInstr >> 12) & 0xF] = (u32)res;
|
||||
|
||||
if (((cpu->CurInstr >> 16) & 0xF) != 15)
|
||||
cpu->R[(cpu->CurInstr >> 16) & 0xF] = (u32)(res >> 32ULL);
|
||||
|
||||
cpu->AddCycles_CI(1); // TODO: interlock??
|
||||
|
Loading…
Reference in New Issue
Block a user