Improve VCMP instruction with option for E.

Add comment to le JIT about how the VCMP crashes on ARM11, with commented code.
This commit is contained in:
Sacha 2013-03-01 15:41:45 +10:00
parent 6d3c89e354
commit 26ebdb4f11
3 changed files with 20 additions and 11 deletions

View File

@ -713,7 +713,7 @@ void ARMXEmitter::VSTR(ARMReg Src, ARMReg Base, u16 offset)
| ((Src & 0xF) << 12) | (11 << 8) | (offset >> 2));
}
}
void ARMXEmitter::VCMP(ARMReg Vd, ARMReg Vm)
void ARMXEmitter::VCMP(ARMReg Vd, ARMReg Vm, bool E)
{
_assert_msg_(DYNA_REC, Vd < Q0, "Passed invalid Vd to VCMP");
bool single_reg = Vd < D0;
@ -724,15 +724,15 @@ void ARMXEmitter::VCMP(ARMReg Vd, ARMReg Vm)
if (single_reg)
{
Write32(NO_COND | (0x1D << 23) | ((Vd & 0x1) << 22) | (0x34 << 16) | ((Vd & 0x1E) << 11) \
| (0x2B << 6) | ((Vm & 0x1) << 5) | (Vm >> 1));
| (E << 7) | (0x29 << 6) | ((Vm & 0x1) << 5) | (Vm >> 1));
}
else
{
Write32(NO_COND | (0x1D << 23) | ((Vd & 0x10) << 18) | (0x34 << 16) | ((Vd & 0xF) << 12) \
| (0x2F << 6) | ((Vm & 0x10) << 1) | (Vm & 0xF));
| (E << 7) | (0x2C << 6) | ((Vm & 0x10) << 1) | (Vm & 0xF));
}
}
void ARMXEmitter::VCMP(ARMReg Vd)
void ARMXEmitter::VCMP(ARMReg Vd, bool E)
{
_assert_msg_(DYNA_REC, Vd < Q0, "Passed invalid Vd to VCMP");
bool single_reg = Vd < D0;
@ -742,12 +742,12 @@ void ARMXEmitter::VCMP(ARMReg Vd)
if (single_reg)
{
Write32(NO_COND | (0x1D << 23) | ((Vd & 0x1) << 22) | (0x35 << 16) | ((Vd & 0x1E) << 11) \
| (0x2B << 6));
| (E << 7) | (0x29 << 6));
}
else
{
Write32(NO_COND | (0x1D << 23) | ((Vd & 0x10) << 18) | (0x35 << 16) | ((Vd & 0xF) << 12) \
| (0x2F << 6));
| (E << 7) | (0x2C << 6));
}
}
void ARMXEmitter::VDIV(ARMReg Vd, ARMReg Vn, ARMReg Vm)
@ -1032,7 +1032,7 @@ void ARMXEmitter::VMOV(ARMReg Dest, ARMReg Src)
}
}
void ARMXEmitter::VCVT(ARMReg Sd, ARMReg Sm, bool to_integer, bool is_signed, bool round_to_zero = false)
void ARMXEmitter::VCVT(ARMReg Sd, ARMReg Sm, bool to_integer, bool is_signed, bool round_to_zero)
{
bool op = to_integer ? round_to_zero : is_signed;
bool op2 = to_integer ? is_signed : 0;

View File

@ -501,9 +501,9 @@ public:
// VFP Only
void VLDR(ARMReg Dest, ARMReg Base, u16 offset);
void VSTR(ARMReg Src, ARMReg Base, u16 offset);
void VCMP(ARMReg Vd, ARMReg Vm);
void VCMP(ARMReg Vd, ARMReg Vm, bool E);
// Compares against zero
void VCMP(ARMReg Vd);
void VCMP(ARMReg Vd, bool E);
void VDIV(ARMReg Vd, ARMReg Vn, ARMReg Vm);
void VSQRT(ARMReg Vd, ARMReg Vm);
@ -515,7 +515,7 @@ public:
void VMUL(ARMReg Vd, ARMReg Vn, ARMReg Vm);
void VMOV(ARMReg Dest, ARMReg Src, bool high);
void VMOV(ARMReg Dest, ARMReg Src);
void VCVT(ARMReg Sd, ARMReg Sm, bool to_integer, bool is_signed, bool round_to_zero);
void VCVT(ARMReg Sd, ARMReg Sm, bool to_integer, bool is_signed, bool round_to_zero = false);
void QuickCallFunction(ARMReg scratchreg, void *func);
// Utility functions

View File

@ -138,7 +138,16 @@ void Jit::Comp_FPUComp(u32 op) {
case 6: //ole
case 14: //le
// CompFPComp(fs, ft, CMPLESS);
// This VCMP crashes on ARM11 with an exception.
/*
fpr.MapInIn(fpr.R(fs), fpr.R(ft));
VCMP(fpr.R(fs), fpr.R(ft));
MOVI2R(R0, (u32)&currentMIPS->fpcond);
SetCC(CC_LT);
// TODO: Should set R0 to 0 or 1
VSTR(fpr.R(fs), R0, 0);
SetCC(CC_AL);
*/
break;
case 7: //ule