VFPU: fix rounding in VF2IN

This commit is contained in:
Henrik Rydgard 2013-07-29 22:36:31 +02:00
parent d8294f025f
commit 76e16d49f6
4 changed files with 10 additions and 28 deletions

View File

@ -885,7 +885,9 @@ namespace MIPSComp
}
void Jit::Comp_VScl(u32 op) {
// Darn, still breaks Tekken 6. Bug could be elsewhere though.
// Darn, still breaks stuff. Bug could be elsewhere though.
DISABLE;
fpr.FlushAll();
CONDITIONAL_DISABLE;
if (js.HasUnknownPrefix())

View File

@ -51,25 +51,6 @@
#define LO currentMIPS->lo
inline int is_even(float d) {
float int_part;
modff(d / 2.0f, &int_part);
return 2.0f * int_part == d;
}
// Rounds *.5 to closest even number
float round_ieee_754(float d) {
float i = floorf(d);
d -= i;
if(d < 0.5f)
return i;
if(d > 0.5f)
return i + 1.0f;
if(is_even(i))
return i;
return i + 1.0f;
}
static inline void DelayBranchTo(u32 where)
{
PC += 4;

View File

@ -106,12 +106,6 @@ inline float nanclamp(float f, float lower, float upper)
}
#ifndef BLACKBERRY
double rint(double x){
return floor(x+.5);
}
#endif
void ApplyPrefixST(float *v, u32 data, VectorSize size)
{
// Possible optimization shortcut:
@ -604,6 +598,11 @@ namespace MIPSInt
EatPrefixes();
}
inline int round_vfpu_n(float param) {
// return floorf(param);
return (int)round_ieee_754(param);
}
void Int_Vf2i(u32 op)
{
float s[4];
@ -627,7 +626,7 @@ namespace MIPSInt
if (sv < (int)0x80000000) sv = (int)0x80000000;
switch ((op >> 21) & 0x1f)
{
case 16: d[i] = (int)rint(sv); break; //n
case 16: d[i] = (int)round_vfpu_n(sv); break; //n
case 17: d[i] = s[i]>=0 ? (int)floor(sv) : (int)ceil(sv); break; //z
case 18: d[i] = (int)ceil(sv); break; //u
case 19: d[i] = (int)floor(sv); break; //d

2
native

@ -1 +1 @@
Subproject commit 345a67144a5d71325421da6477834d2f9c81d5f7
Subproject commit 411a41e948de1244a8583ac2ac7e798155657400