mirror of
https://github.com/hrydgard/ppsspp.git
synced 2026-12-04 03:33:44 +01:00
ARMJIT: Add floor, ceil, round. Introducing a rounding mode for VCVT.
The cvt and trunc are tested heavily. Floor, ceil, round aren't tested as much as there are very few games that use it.
This commit is contained in:
1 parent
61f5fb35bd
commit
059abc0d69
3 files changed
+25
-21
No files matched your search
@@ -1032,12 +1032,12 @@ void ARMXEmitter::VMOV(ARMReg Dest, ARMReg Src)
|
||||
}
|
||||
}
|
||||
|
||||
void ARMXEmitter::VCVT(bool to_integer, bool is_signed, ARMReg Sd, ARMReg Sm)
|
||||
void ARMXEmitter::VCVT(bool to_integer, bool is_signed, bool round_to_zero, ARMReg Sd, ARMReg Sm)
|
||||
{
|
||||
Sd = SubBase(Sd);
|
||||
Sm = SubBase(Sm);
|
||||
Write32(NO_COND | (0x1D << 23) | ((Sd & 0x1) << 22) | (0x7 << 19) | (to_integer << 18) | (is_signed << 16) \
|
||||
| ((Sd & 0x1E) << 11) | (0x2B << 6) | ((Sm & 0x1) << 5) | (Sm >> 1));
|
||||
| ((Sd & 0x1E) << 11) | (round_to_zero << 7) | (0x29 << 6) | ((Sm & 0x1) << 5) | (Sm >> 1));
|
||||
}
|
||||
|
||||
}
|
||||
+1
-1
@@ -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(bool to_integer, bool is_signed, ARMReg Sd, ARMReg Sm);
|
||||
void VCVT(bool to_integer, bool is_signed, bool round_to_zero, ARMReg Sd, ARMReg Sm);
|
||||
|
||||
void QuickCallFunction(ARMReg scratchreg, void *func);
|
||||
// Utility functions
|
||||
|
||||
@@ -177,32 +177,36 @@ void Jit::Comp_FPU2op(u32 op)
|
||||
fpr.MapDirtyIn(fd, fs);
|
||||
VNEG(fpr.R(fd), fpr.R(fs));
|
||||
break;
|
||||
case 12: //FsI(fd) = (int)floorf(F(fs)+0.5f); break; //round.w.s
|
||||
fpr.MapDirtyIn(fd, fs);
|
||||
VCVT(true, true, false, fpr.R(fd), fpr.R(fs));
|
||||
break;
|
||||
case 13: //FsI(fd) = Rto0(F(fs))); break; //trunc.w.s
|
||||
fpr.MapDirtyIn(fd, fs);
|
||||
VCVT(true, true, fpr.R(fd), fpr.R(fs));
|
||||
VCVT(true, true, true, fpr.R(fd), fpr.R(fs));
|
||||
break;
|
||||
case 14: //FsI(fd) = (int)ceilf (F(fs)); break; //ceil.w.s
|
||||
fpr.MapDirtyIn(fd, fs);
|
||||
MOVI2R(R0, 0x3F000000); // 0.5f
|
||||
VMOV(S0, R0);
|
||||
VADD(S0,fpr.R(fs),S0);
|
||||
VCVT(true, true, false, fpr.R(fd), S0);
|
||||
break;
|
||||
case 15: //FsI(fd) = (int)floorf(F(fs)); break; //floor.w.s
|
||||
fpr.MapDirtyIn(fd, fs);
|
||||
MOVI2R(R0, 0x3F000000); // 0.5f
|
||||
VMOV(S0, R0);
|
||||
VSUB(S0,fpr.R(fs),S0);
|
||||
VCVT(true, true, false, fpr.R(fd), S0);
|
||||
break;
|
||||
case 32: //F(fd) = (float)FsI(fs); break; //cvt.s.w
|
||||
fpr.MapDirtyIn(fd, fs);
|
||||
VCVT(false, false, fpr.R(fd), fpr.R(fs));
|
||||
VCVT(false, false, true, fpr.R(fd), fpr.R(fs));
|
||||
break;
|
||||
case 36: //FsI(fd) = (int) F(fs); break; //cvt.w.s
|
||||
case 36: //FsI(fd) = (int) F(fs); break; //cvt.w.s
|
||||
fpr.MapDirtyIn(fd, fs);
|
||||
VCVT(true, false, fpr.R(fd), fpr.R(fs));
|
||||
VCVT(true, false, true, fpr.R(fd), fpr.R(fs));
|
||||
break;
|
||||
/*
|
||||
case 12: //FsI(fd) = (int)floorf(F(fs)+0.5f); break; //round.w.s
|
||||
|
||||
case 13: //FsI(fd) = F(fs)>=0 ? (int)floorf(F(fs)) : (int)ceilf(F(fs)); break;//trunc.w.s
|
||||
fpr.Lock(fs, fd);
|
||||
fpr.StoreFromRegister(fd);
|
||||
CVTTSS2SI(EAX, fpr.R(fs));
|
||||
MOV(32, fpr.R(fd), R(EAX));
|
||||
fpr.UnlockAll();
|
||||
break;
|
||||
|
||||
case 14: //FsI(fd) = (int)ceilf (F(fs)); break; //ceil.w.s
|
||||
case 15: //FsI(fd) = (int)floorf(F(fs)); break; //floor.w.s
|
||||
*/
|
||||
default:
|
||||
DISABLE;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user