Skip to content

Commit 1eb310f

Browse files
[Soft-Floats] - Fixes a VU underflow flag edge case.
In some cases, a Zero value could have it's underflow flag skipped, this is fixed.
1 parent 11e913d commit 1eb310f

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

pcsx2/VUflags.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,21 +49,28 @@ static __ri u32 VU_MAC_UPDATE( s32 shift, VURegs* VU, float f)
4949

5050
static __ri u32 VU_MAC_UPDATE(s32 shift, VURegs* VU, PS2Float f)
5151
{
52+
bool isUnderflow = false;
53+
5254
u32 v = f.raw;
5355

5456
if (v & PS2Float::SIGNMASK)
5557
VU->macflag |= 0x0010 << shift;
5658
else
5759
VU->macflag &= ~(0x0010 << shift);
60+
61+
if (f.uf)
62+
{
63+
isUnderflow = true;
64+
VU->macflag = (VU->macflag & ~(0x1000 << shift)) | (0x0101 << shift);
65+
}
5866

5967
if (f.IsZero())
6068
{
6169
VU->macflag = (VU->macflag & ~(0x1100 << shift)) | (0x0001 << shift);
6270
return v;
6371
}
64-
else if (f.uf) { VU->macflag = (VU->macflag & ~(0x1000 << shift)) | (0x0101 << shift); }
6572
else if (f.of) { VU->macflag = (VU->macflag & ~(0x0101 << shift)) | (0x1000 << shift); }
66-
else { VU->macflag = (VU->macflag & ~(0x1101 << shift)); }
73+
else if (!isUnderflow) { VU->macflag = (VU->macflag & ~(0x1101 << shift)); }
6774

6875
return v;
6976
}

0 commit comments

Comments
 (0)