PPU interpreter (precise): SAT bit implemented (#2736)

This commit is contained in:
Wilfried Rabouin 2017-04-30 20:05:50 +02:00 committed by Ivan
parent f40dcbfa30
commit 7ab210432e
4 changed files with 1027 additions and 69 deletions

View File

@ -8,3 +8,9 @@ enum FPSCR_RN
FPSCR_RN_PINF = 2,
FPSCR_RN_MINF = 3,
};
// Get the exponent of a float
inline int fexpf(float x)
{
return ((u32&)x >> 23) & 0xFF;
}

File diff suppressed because it is too large Load Diff

View File

@ -10,15 +10,9 @@ struct ppu_interpreter
static bool MTVSCR(ppu_thread&, ppu_opcode_t);
static bool VADDCUW(ppu_thread&, ppu_opcode_t);
static bool VADDFP(ppu_thread&, ppu_opcode_t);
static bool VADDSBS(ppu_thread&, ppu_opcode_t);
static bool VADDSHS(ppu_thread&, ppu_opcode_t);
static bool VADDSWS(ppu_thread&, ppu_opcode_t);
static bool VADDUBM(ppu_thread&, ppu_opcode_t);
static bool VADDUBS(ppu_thread&, ppu_opcode_t);
static bool VADDUHM(ppu_thread&, ppu_opcode_t);
static bool VADDUHS(ppu_thread&, ppu_opcode_t);
static bool VADDUWM(ppu_thread&, ppu_opcode_t);
static bool VADDUWS(ppu_thread&, ppu_opcode_t);
static bool VAND(ppu_thread&, ppu_opcode_t);
static bool VANDC(ppu_thread&, ppu_opcode_t);
static bool VAVGSB(ppu_thread&, ppu_opcode_t);
@ -42,8 +36,6 @@ struct ppu_interpreter
static bool VCMPGTUB(ppu_thread&, ppu_opcode_t);
static bool VCMPGTUH(ppu_thread&, ppu_opcode_t);
static bool VCMPGTUW(ppu_thread&, ppu_opcode_t);
static bool VCTSXS(ppu_thread&, ppu_opcode_t);
static bool VCTUXS(ppu_thread&, ppu_opcode_t);
static bool VEXPTEFP(ppu_thread&, ppu_opcode_t);
static bool VLOGEFP(ppu_thread&, ppu_opcode_t);
static bool VMADDFP(ppu_thread&, ppu_opcode_t);
@ -54,8 +46,6 @@ struct ppu_interpreter
static bool VMAXUB(ppu_thread&, ppu_opcode_t);
static bool VMAXUH(ppu_thread&, ppu_opcode_t);
static bool VMAXUW(ppu_thread&, ppu_opcode_t);
static bool VMHADDSHS(ppu_thread&, ppu_opcode_t);
static bool VMHRADDSHS(ppu_thread&, ppu_opcode_t);
static bool VMINFP(ppu_thread&, ppu_opcode_t);
static bool VMINSB(ppu_thread&, ppu_opcode_t);
static bool VMINSH(ppu_thread&, ppu_opcode_t);
@ -72,10 +62,8 @@ struct ppu_interpreter
static bool VMRGLW(ppu_thread&, ppu_opcode_t);
static bool VMSUMMBM(ppu_thread&, ppu_opcode_t);
static bool VMSUMSHM(ppu_thread&, ppu_opcode_t);
static bool VMSUMSHS(ppu_thread&, ppu_opcode_t);
static bool VMSUMUBM(ppu_thread&, ppu_opcode_t);
static bool VMSUMUHM(ppu_thread&, ppu_opcode_t);
static bool VMSUMUHS(ppu_thread&, ppu_opcode_t);
static bool VMULESB(ppu_thread&, ppu_opcode_t);
static bool VMULESH(ppu_thread&, ppu_opcode_t);
static bool VMULEUB(ppu_thread&, ppu_opcode_t);
@ -89,14 +77,8 @@ struct ppu_interpreter
static bool VOR(ppu_thread&, ppu_opcode_t);
static bool VPERM(ppu_thread&, ppu_opcode_t);
static bool VPKPX(ppu_thread&, ppu_opcode_t);
static bool VPKSHSS(ppu_thread&, ppu_opcode_t);
static bool VPKSHUS(ppu_thread&, ppu_opcode_t);
static bool VPKSWSS(ppu_thread&, ppu_opcode_t);
static bool VPKSWUS(ppu_thread&, ppu_opcode_t);
static bool VPKUHUM(ppu_thread&, ppu_opcode_t);
static bool VPKUHUS(ppu_thread&, ppu_opcode_t);
static bool VPKUWUM(ppu_thread&, ppu_opcode_t);
static bool VPKUWUS(ppu_thread&, ppu_opcode_t);
static bool VREFP(ppu_thread&, ppu_opcode_t);
static bool VRFIM(ppu_thread&, ppu_opcode_t);
static bool VRFIN(ppu_thread&, ppu_opcode_t);
@ -129,20 +111,9 @@ struct ppu_interpreter
static bool VSRW(ppu_thread&, ppu_opcode_t);
static bool VSUBCUW(ppu_thread&, ppu_opcode_t);
static bool VSUBFP(ppu_thread&, ppu_opcode_t);
static bool VSUBSBS(ppu_thread&, ppu_opcode_t);
static bool VSUBSHS(ppu_thread&, ppu_opcode_t);
static bool VSUBSWS(ppu_thread&, ppu_opcode_t);
static bool VSUBUBM(ppu_thread&, ppu_opcode_t);
static bool VSUBUBS(ppu_thread&, ppu_opcode_t);
static bool VSUBUHM(ppu_thread&, ppu_opcode_t);
static bool VSUBUHS(ppu_thread&, ppu_opcode_t);
static bool VSUBUWM(ppu_thread&, ppu_opcode_t);
static bool VSUBUWS(ppu_thread&, ppu_opcode_t);
static bool VSUMSWS(ppu_thread&, ppu_opcode_t);
static bool VSUM2SWS(ppu_thread&, ppu_opcode_t);
static bool VSUM4SBS(ppu_thread&, ppu_opcode_t);
static bool VSUM4SHS(ppu_thread&, ppu_opcode_t);
static bool VSUM4UBS(ppu_thread&, ppu_opcode_t);
static bool VUPKHPX(ppu_thread&, ppu_opcode_t);
static bool VUPKHSB(ppu_thread&, ppu_opcode_t);
static bool VUPKHSH(ppu_thread&, ppu_opcode_t);
@ -391,10 +362,66 @@ struct ppu_interpreter
struct ppu_interpreter_precise final : ppu_interpreter
{
// TODO
static bool VPKSHSS(ppu_thread&, ppu_opcode_t);
static bool VPKSHUS(ppu_thread&, ppu_opcode_t);
static bool VPKSWSS(ppu_thread&, ppu_opcode_t);
static bool VPKSWUS(ppu_thread&, ppu_opcode_t);
static bool VPKUHUS(ppu_thread&, ppu_opcode_t);
static bool VPKUWUS(ppu_thread&, ppu_opcode_t);
static bool VADDSBS(ppu_thread&, ppu_opcode_t);
static bool VADDSHS(ppu_thread&, ppu_opcode_t);
static bool VADDSWS(ppu_thread&, ppu_opcode_t);
static bool VADDUBS(ppu_thread&, ppu_opcode_t);
static bool VADDUHS(ppu_thread&, ppu_opcode_t);
static bool VADDUWS(ppu_thread&, ppu_opcode_t);
static bool VSUBSBS(ppu_thread&, ppu_opcode_t);
static bool VSUBSHS(ppu_thread&, ppu_opcode_t);
static bool VSUBSWS(ppu_thread&, ppu_opcode_t);
static bool VSUBUBS(ppu_thread&, ppu_opcode_t);
static bool VSUBUHS(ppu_thread&, ppu_opcode_t);
static bool VSUBUWS(ppu_thread&, ppu_opcode_t);
static bool VMHADDSHS(ppu_thread&, ppu_opcode_t);
static bool VMHRADDSHS(ppu_thread&, ppu_opcode_t);
static bool VMSUMSHS(ppu_thread&, ppu_opcode_t);
static bool VMSUMUHS(ppu_thread&, ppu_opcode_t);
static bool VSUMSWS(ppu_thread&, ppu_opcode_t);
static bool VSUM2SWS(ppu_thread&, ppu_opcode_t);
static bool VSUM4SBS(ppu_thread&, ppu_opcode_t);
static bool VSUM4SHS(ppu_thread&, ppu_opcode_t);
static bool VSUM4UBS(ppu_thread&, ppu_opcode_t);
static bool VCTSXS(ppu_thread&, ppu_opcode_t);
static bool VCTUXS(ppu_thread&, ppu_opcode_t);
};
struct ppu_interpreter_fast final : ppu_interpreter
{
// TODO
static bool VPKSHSS(ppu_thread&, ppu_opcode_t);
static bool VPKSHUS(ppu_thread&, ppu_opcode_t);
static bool VPKSWSS(ppu_thread&, ppu_opcode_t);
static bool VPKSWUS(ppu_thread&, ppu_opcode_t);
static bool VPKUHUS(ppu_thread&, ppu_opcode_t);
static bool VPKUWUS(ppu_thread&, ppu_opcode_t);
static bool VADDSBS(ppu_thread&, ppu_opcode_t);
static bool VADDSHS(ppu_thread&, ppu_opcode_t);
static bool VADDSWS(ppu_thread&, ppu_opcode_t);
static bool VADDUBS(ppu_thread&, ppu_opcode_t);
static bool VADDUHS(ppu_thread&, ppu_opcode_t);
static bool VADDUWS(ppu_thread&, ppu_opcode_t);
static bool VSUBSBS(ppu_thread&, ppu_opcode_t);
static bool VSUBSHS(ppu_thread&, ppu_opcode_t);
static bool VSUBSWS(ppu_thread&, ppu_opcode_t);
static bool VSUBUBS(ppu_thread&, ppu_opcode_t);
static bool VSUBUHS(ppu_thread&, ppu_opcode_t);
static bool VSUBUWS(ppu_thread&, ppu_opcode_t);
static bool VMHADDSHS(ppu_thread&, ppu_opcode_t);
static bool VMHRADDSHS(ppu_thread&, ppu_opcode_t);
static bool VMSUMSHS(ppu_thread&, ppu_opcode_t);
static bool VMSUMUHS(ppu_thread&, ppu_opcode_t);
static bool VSUMSWS(ppu_thread&, ppu_opcode_t);
static bool VSUM2SWS(ppu_thread&, ppu_opcode_t);
static bool VSUM4SBS(ppu_thread&, ppu_opcode_t);
static bool VSUM4SHS(ppu_thread&, ppu_opcode_t);
static bool VSUM4UBS(ppu_thread&, ppu_opcode_t);
static bool VCTSXS(ppu_thread&, ppu_opcode_t);
static bool VCTUXS(ppu_thread&, ppu_opcode_t);
};

View File

@ -1380,11 +1380,6 @@ inline bool issnan(float x)
return std::isnan(x) && ((s32&)x) << 9 > 0;
}
inline int fexpf(float x)
{
return ((u32&)x >> 23) & 0xFF;
}
inline bool isextended(float x)
{
return fexpf(x) == 255;