mirror of
https://github.com/hrydgard/ppsspp.git
synced 2025-04-02 11:01:50 -04:00
VFPU: fix rounding in VF2IN
This commit is contained in:
parent
d8294f025f
commit
76e16d49f6
4 changed files with 10 additions and 28 deletions
|
@ -885,7 +885,9 @@ namespace MIPSComp
|
||||||
}
|
}
|
||||||
|
|
||||||
void Jit::Comp_VScl(u32 op) {
|
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();
|
fpr.FlushAll();
|
||||||
CONDITIONAL_DISABLE;
|
CONDITIONAL_DISABLE;
|
||||||
if (js.HasUnknownPrefix())
|
if (js.HasUnknownPrefix())
|
||||||
|
|
|
@ -51,25 +51,6 @@
|
||||||
#define LO currentMIPS->lo
|
#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)
|
static inline void DelayBranchTo(u32 where)
|
||||||
{
|
{
|
||||||
PC += 4;
|
PC += 4;
|
||||||
|
|
|
@ -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)
|
void ApplyPrefixST(float *v, u32 data, VectorSize size)
|
||||||
{
|
{
|
||||||
// Possible optimization shortcut:
|
// Possible optimization shortcut:
|
||||||
|
@ -604,6 +598,11 @@ namespace MIPSInt
|
||||||
EatPrefixes();
|
EatPrefixes();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
inline int round_vfpu_n(float param) {
|
||||||
|
// return floorf(param);
|
||||||
|
return (int)round_ieee_754(param);
|
||||||
|
}
|
||||||
|
|
||||||
void Int_Vf2i(u32 op)
|
void Int_Vf2i(u32 op)
|
||||||
{
|
{
|
||||||
float s[4];
|
float s[4];
|
||||||
|
@ -627,7 +626,7 @@ namespace MIPSInt
|
||||||
if (sv < (int)0x80000000) sv = (int)0x80000000;
|
if (sv < (int)0x80000000) sv = (int)0x80000000;
|
||||||
switch ((op >> 21) & 0x1f)
|
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 17: d[i] = s[i]>=0 ? (int)floor(sv) : (int)ceil(sv); break; //z
|
||||||
case 18: d[i] = (int)ceil(sv); break; //u
|
case 18: d[i] = (int)ceil(sv); break; //u
|
||||||
case 19: d[i] = (int)floor(sv); break; //d
|
case 19: d[i] = (int)floor(sv); break; //d
|
||||||
|
|
2
native
2
native
|
@ -1 +1 @@
|
||||||
Subproject commit 345a67144a5d71325421da6477834d2f9c81d5f7
|
Subproject commit 411a41e948de1244a8583ac2ac7e798155657400
|
Loading…
Add table
Reference in a new issue