CPU/PGXP: sub rd, rs, 0 => move rd, rs

This commit is contained in:
Stenzek 2024-05-17 21:13:12 +10:00
parent bbac7a60a0
commit 5672b0da95
No known key found for this signature in database

View file

@ -975,6 +975,13 @@ void CPU::PGXP::CPU_SUB(u32 instr, u32 rsVal, u32 rtVal)
Validate(&g_state.pgxp_gpr[rs(instr)], rsVal); Validate(&g_state.pgxp_gpr[rs(instr)], rsVal);
Validate(&g_state.pgxp_gpr[rt(instr)], rtVal); Validate(&g_state.pgxp_gpr[rt(instr)], rtVal);
PGXP_value ret;
if (rtVal == 0)
{
ret = g_state.pgxp_gpr[rs(instr)];
}
else
{
// iCB: Only require one valid input // iCB: Only require one valid input
if (((g_state.pgxp_gpr[rt(instr)].flags & VALID_XY) != VALID_XY) != if (((g_state.pgxp_gpr[rt(instr)].flags & VALID_XY) != VALID_XY) !=
((g_state.pgxp_gpr[rs(instr)].flags & VALID_XY) != VALID_XY)) ((g_state.pgxp_gpr[rs(instr)].flags & VALID_XY) != VALID_XY))
@ -983,8 +990,7 @@ void CPU::PGXP::CPU_SUB(u32 instr, u32 rsVal, u32 rtVal)
MakeValid(&g_state.pgxp_gpr[rt(instr)], rtVal); MakeValid(&g_state.pgxp_gpr[rt(instr)], rtVal);
} }
PGXP_value ret = g_state.pgxp_gpr[rs(instr)]; ret = g_state.pgxp_gpr[rs(instr)];
ret.x = (float)f16Unsign(ret.x); ret.x = (float)f16Unsign(ret.x);
ret.x -= (float)f16Unsign(g_state.pgxp_gpr[rt(instr)].x); ret.x -= (float)f16Unsign(g_state.pgxp_gpr[rt(instr)].x);
@ -1000,6 +1006,7 @@ void CPU::PGXP::CPU_SUB(u32 instr, u32 rsVal, u32 rtVal)
ret.flags &= (g_state.pgxp_gpr[rt(instr)].flags & VALID_XY) | ~VALID_XY; ret.flags &= (g_state.pgxp_gpr[rt(instr)].flags & VALID_XY) | ~VALID_XY;
ret.value = rsVal - rtVal; ret.value = rsVal - rtVal;
}
if (!(ret.flags & VALID_Z) && (g_state.pgxp_gpr[rt(instr)].flags & VALID_Z)) if (!(ret.flags & VALID_Z) && (g_state.pgxp_gpr[rt(instr)].flags & VALID_Z))
{ {