RSP: Add Vmulq

This commit is contained in:
zilmar 2023-09-07 11:30:15 +09:30
parent d468b863c2
commit af1c0c2b55
3 changed files with 21 additions and 1 deletions

View File

@ -242,7 +242,7 @@ void BuildInterpreterCPU(void)
RSP_Vector[0] = RSP_Vector_VMULF;
RSP_Vector[1] = RSP_Vector_VMULU;
RSP_Vector[2] = rsp_UnknownOpcode;
RSP_Vector[3] = rsp_UnknownOpcode;
RSP_Vector[3] = RSP_Vector_VMULQ;
RSP_Vector[4] = RSP_Vector_VMUDL;
RSP_Vector[5] = RSP_Vector_VMUDM;
RSP_Vector[6] = RSP_Vector_VMUDN;

View File

@ -741,6 +741,25 @@ void RSP_Vector_VMUDM(void)
RSP_Vect[RSPOpC.vd] = Result;
}
void RSP_Vector_VMULQ(void)
{
RSPVector Result;
for (uint8_t el = 0; el < 8; el++)
{
int32_t Temp = RSP_Vect[RSPOpC.vs].s16(el) * RSP_Vect[RSPOpC.vt].se(el, RSPOpC.e);
if (Temp < 0)
{
Temp += 31;
}
RSP_ACCUM[el].HW[3] = (int16_t)(Temp >> 16);
RSP_ACCUM[el].HW[2] = (int16_t)Temp;
RSP_ACCUM[el].HW[1] = 0;
Result.s16(el) = clamp16(Temp >> 1) & ~15;
}
RSP_Vect[RSPOpC.vd] = Result;
}
void RSP_Vector_VMUDN(void)
{
uint8_t el, del;

View File

@ -76,6 +76,7 @@ void RSP_COP2_VECTOR(void);
void RSP_Vector_VMULF(void);
void RSP_Vector_VMULU(void);
void RSP_Vector_VMULQ(void);
void RSP_Vector_VMUDL(void);
void RSP_Vector_VMUDM(void);
void RSP_Vector_VMUDN(void);