Fix signed/unsigned stores

This commit is contained in:
Mullin 2015-02-13 14:15:00 +01:00
parent db690a1862
commit 39aa2432a6
1 changed files with 100 additions and 4 deletions

View File

@ -399,7 +399,6 @@ void JitArmAsmRoutineManager::GenerateCommon()
POP(5, R0, R1, R2, R3, _PC); POP(5, R0, R1, R2, R3, _PC);
} }
const u8* storePairedU8 = GetCodePtr(); const u8* storePairedU8 = GetCodePtr();
const u8* storePairedS8 = GetCodePtr();
{ {
// R10 is the addr // R10 is the addr
// R11 is the scale // R11 is the scale
@ -424,8 +423,32 @@ void JitArmAsmRoutineManager::GenerateCommon()
POP(5, R0, R1, R2, R3, _PC); POP(5, R0, R1, R2, R3, _PC);
} }
const u8* storePairedS8 = GetCodePtr();
{
// R10 is the addr
// R11 is the scale
// R12 is scratch
// S0, S1 is the values
PUSH(5, R0, R1, R2, R3, _LR);
MOVI2R(R12, (u32)&m_quantizeTableS);
ADD(R12, R12, R11);
VLDR(S2, R12, 0);
VMUL(S0, S0, S2);
VMUL(S1, S1, S2);
VCVT(S0, S0, TO_INT | ROUND_TO_ZERO | IS_SIGNED);
VCVT(S1, S1, TO_INT | ROUND_TO_ZERO | IS_SIGNED);
VMOV(R0, S0);
VMOV(R1, S1);
MOV(R2, R10);
MOVI2R(R12, (u32)&WriteDual8);
BL(R12);
POP(5, R0, R1, R2, R3, _PC);
}
const u8* storePairedU16 = GetCodePtr(); const u8* storePairedU16 = GetCodePtr();
const u8* storePairedS16 = GetCodePtr();
{ {
PUSH(5, R0, R1, R2, R3, _LR); PUSH(5, R0, R1, R2, R3, _LR);
@ -446,6 +469,27 @@ void JitArmAsmRoutineManager::GenerateCommon()
POP(5, R0, R1, R2, R3, _PC); POP(5, R0, R1, R2, R3, _PC);
} }
const u8* storePairedS16 = GetCodePtr();
{
PUSH(5, R0, R1, R2, R3, _LR);
MOVI2R(R12, (u32)&m_quantizeTableS);
ADD(R12, R12, R11);
VLDR(S2, R12, 0);
VMUL(S0, S0, S2);
VMUL(S1, S1, S2);
VCVT(S0, S0, TO_INT | ROUND_TO_ZERO | IS_SIGNED);
VCVT(S1, S1, TO_INT | ROUND_TO_ZERO | IS_SIGNED);
VMOV(R0, S0);
VMOV(R1, S1);
MOV(R2, R10);
MOVI2R(R12, (u32)&WriteDual16);
BL(R12);
POP(5, R0, R1, R2, R3, _PC);
}
const u8* storeSingleIllegal = GetCodePtr(); const u8* storeSingleIllegal = GetCodePtr();
BKPT(0x27); BKPT(0x27);
const u8* storeSingleFloat = GetCodePtr(); const u8* storeSingleFloat = GetCodePtr();
@ -471,7 +515,6 @@ void JitArmAsmRoutineManager::GenerateCommon()
POP(5, R0, R1, R2, R3, _PC); POP(5, R0, R1, R2, R3, _PC);
} }
const u8* storeSingleU8 = GetCodePtr(); // Used by MKWii const u8* storeSingleU8 = GetCodePtr(); // Used by MKWii
const u8* storeSingleS8 = GetCodePtr();
{ {
MOVI2R(R12, (u32)&m_quantizeTableS); MOVI2R(R12, (u32)&m_quantizeTableS);
ADD(R12, R12, R11); ADD(R12, R12, R11);
@ -497,8 +540,33 @@ void JitArmAsmRoutineManager::GenerateCommon()
BL(R10); BL(R10);
POP(5, R0, R1, R2, R3, _PC); POP(5, R0, R1, R2, R3, _PC);
} }
const u8* storeSingleS8 = GetCodePtr();
{
MOVI2R(R12, (u32)&m_quantizeTableS);
ADD(R12, R12, R11);
VLDR(S2, R12, 0);
VMUL(S0, S0, S2);
TST(R10, arghmask);
FixupBranch argh = B_CC(CC_NEQ);
BIC(R10, R10, mask);
ADD(R10, R10, R8);
VCVT(S0, S0, TO_INT | ROUND_TO_ZERO | IS_SIGNED);
VMOV(R12, S0);
STRB(R12, R10);
MOV(_PC, _LR);
SetJumpTarget(argh);
PUSH(5, R0, R1, R2, R3, _LR);
VMOV(R0, S0);
MOV(R1, R10);
MOVI2R(R10, (u32)&Memory::Write_U8);
BL(R10);
POP(5, R0, R1, R2, R3, _PC);
}
const u8* storeSingleU16 = GetCodePtr(); // Used by MKWii const u8* storeSingleU16 = GetCodePtr(); // Used by MKWii
const u8* storeSingleS16 = GetCodePtr();
{ {
MOVI2R(R12, (u32)&m_quantizeTableS); MOVI2R(R12, (u32)&m_quantizeTableS);
ADD(R12, R12, R11); ADD(R12, R12, R11);
@ -526,6 +594,34 @@ void JitArmAsmRoutineManager::GenerateCommon()
POP(5, R0, R1, R2, R3, _PC); POP(5, R0, R1, R2, R3, _PC);
} }
const u8* storeSingleS16 = GetCodePtr();
{
MOVI2R(R12, (u32)&m_quantizeTableS);
ADD(R12, R12, R11);
VLDR(S2, R12, 0);
VMUL(S0, S0, S2);
TST(R10, arghmask);
FixupBranch argh = B_CC(CC_NEQ);
BIC(R10, R10, mask);
ADD(R10, R10, R8);
VCVT(S0, S0, TO_INT | ROUND_TO_ZERO | IS_SIGNED);
VMOV(R12, S0);
REV16(R12, R12);
STRH(R12, R10);
MOV(_PC, _LR);
SetJumpTarget(argh);
PUSH(5, R0, R1, R2, R3, _LR);
VMOV(R0, S0);
MOV(R1, R10);
MOVI2R(R10, (u32)&Memory::Write_U16);
BL(R10);
POP(5, R0, R1, R2, R3, _PC);
}
pairedStoreQuantized = reinterpret_cast<const u8**>(const_cast<u8*>(AlignCode16())); pairedStoreQuantized = reinterpret_cast<const u8**>(const_cast<u8*>(AlignCode16()));
ReserveCodeSpace(16 * sizeof(u8*)); ReserveCodeSpace(16 * sizeof(u8*));