SPU Fixes 3.2

This commit is contained in:
Nekotekina 2013-12-02 22:49:06 +04:00
parent 38fabf7cd2
commit 73c2628ef4
4 changed files with 73 additions and 10 deletions

View File

@ -390,8 +390,8 @@ private:
//(SSE) RSQRTPS - Compute Reciprocals of Square Roots of Packed Single-Precision Floating-Point Values //(SSE) RSQRTPS - Compute Reciprocals of Square Roots of Packed Single-Precision Floating-Point Values
//rt = approximate(1/sqrt(abs(ra))) //rt = approximate(1/sqrt(abs(ra)))
//abs(ra) === ra & FloatAbsMask //abs(ra) === ra & FloatAbsMask
const __m128 FloatAbsMask = {0x7fffffff, 0x7fffffff, 0x7fffffff, 0x7fffffff}; const __m128i FloatAbsMask = {0x7fffffff, 0x7fffffff, 0x7fffffff, 0x7fffffff};
CPU.GPR[rt]._m128 = _mm_rsqrt_ps(_mm_and_ps(CPU.GPR[ra]._m128, FloatAbsMask)); CPU.GPR[rt]._m128 = _mm_rsqrt_ps(_mm_and_ps(CPU.GPR[ra]._m128, (__m128&)FloatAbsMask));
} }
void LQX(u32 rt, u32 ra, u32 rb) void LQX(u32 rt, u32 ra, u32 rb)
{ {
@ -869,14 +869,14 @@ private:
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
if (temp._u64[i] & DoubleFracMask) if (temp._u64[i] & DoubleFracMask)
if (temp._u64[i] & DoubleSignMask & DoubleExpMask == DoubleSignMask) if ((temp._u64[i] & (DoubleSignMask & DoubleExpMask)) == DoubleSignMask)
CPU.GPR[rt]._u64[i] = 0xffffffffffffffff; CPU.GPR[rt]._u64[i] = 0xffffffffffffffff;
} }
if (i7 & 2) //Positive Denorm Check (+, exp is zero, frac is non-zero) if (i7 & 2) //Positive Denorm Check (+, exp is zero, frac is non-zero)
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
if (temp._u64[i] & DoubleFracMask) if (temp._u64[i] & DoubleFracMask)
if (temp._u64[i] & DoubleSignMask & DoubleExpMask == 0) if ((temp._u64[i] & (DoubleSignMask & DoubleExpMask)) == 0)
CPU.GPR[rt]._u64[i] = 0xffffffffffffffff; CPU.GPR[rt]._u64[i] = 0xffffffffffffffff;
} }
if (i7 & 4) //Negative Zero Check (-, exp is zero, frac is zero) if (i7 & 4) //Negative Zero Check (-, exp is zero, frac is zero)
@ -894,7 +894,7 @@ private:
if (i7 & 16) //Negative Infinity Check (-, exp is 0x7ff, frac is zero) if (i7 & 16) //Negative Infinity Check (-, exp is 0x7ff, frac is zero)
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
if (temp._u64[i] == DoubleSignMask & DoubleExpMask) if (temp._u64[i] == (DoubleSignMask & DoubleExpMask))
CPU.GPR[rt]._u64[i] = 0xffffffffffffffff; CPU.GPR[rt]._u64[i] = 0xffffffffffffffff;
} }
if (i7 & 32) //Positive Infinity Check (+, exp is 0x7ff, frac is zero) if (i7 & 32) //Positive Infinity Check (+, exp is 0x7ff, frac is zero)
@ -907,7 +907,7 @@ private:
for (int i = 0; i < 2; i++) for (int i = 0; i < 2; i++)
{ {
if (temp._u64[i] & DoubleFracMask) if (temp._u64[i] & DoubleFracMask)
if (temp._u64[i] & DoubleExpMask == DoubleExpMask) if ((temp._u64[i] & DoubleExpMask) == DoubleExpMask)
CPU.GPR[rt]._u64[i] = 0xffffffffffffffff; CPU.GPR[rt]._u64[i] = 0xffffffffffffffff;
} }
} }

View File

@ -233,13 +233,13 @@ union SPU_SPR_hdr
{ {
u128 _u128; u128 _u128;
s128 _i128; s128 _i128;
u32 _u32[4];
SPU_SPR_hdr() {} SPU_SPR_hdr() {}
wxString ToString() const wxString ToString() const
{ {
return wxString::Format("%16%16", _u128.hi, _u128.lo); return wxString::Format("%08x%08x%08x%08x", _u32[3], _u32[2], _u32[1], _u32[0]);
} }
void Reset() void Reset()
@ -356,6 +356,34 @@ public:
{ {
switch(ch) switch(ch)
{ {
case SPU_RdEventStat: //Read event status with mask applied
case SPU_WrEventMask: //Write event mask
case SPU_WrEventAck: //Write end of event processing
case SPU_RdSigNotify1: //Signal notification 1
case SPU_RdSigNotify2: //Signal notification 2
case SPU_WrDec: //Write decrementer count
case SPU_RdDec: //Read decrementer count
case SPU_RdEventMask: //Read event mask
case SPU_RdMachStat: //Read SPU run status
case SPU_WrSRR0: //Write SPU machine state save/restore register 0 (SRR0)
case SPU_RdSRR0: //Read SPU machine state save/restore register 0 (SRR0)
case MFC_WrMSSyncReq: //Write multisource synchronization request
case MFC_RdTagMask: //Read tag mask
case MFC_LSA: //Write local memory address command parameter
case MFC_EAH: //Write high order DMA effective address command parameter
case MFC_EAL: //Write low order DMA effective address command parameter
case MFC_Size: //Write DMA transfer size command parameter
case MFC_TagID: //Write tag identifier command parameter
case MFC_Cmd: //Write and enqueue DMA command with associated class ID
case MFC_WrTagMask: //Write tag mask
case MFC_WrTagUpdate: //Write request for conditional or unconditional tag status update
case MFC_RdTagStat: //Read tag status with mask applied
case MFC_RdListStallStat: //Read DMA list stall-and-notify status
case MFC_WrListStallAck: //Write DMA list stall-and-notify acknowledge
case MFC_RdAtomicStat: //Read completion status of last completed immediate MFC atomic update command
ConLog.Error("%s error: unimplemented channel (%s).", __FUNCTION__, spu_ch_name[ch]);
break;
case SPU_WrOutMbox: case SPU_WrOutMbox:
return SPU.Out_MBox.GetFreeCount(); return SPU.Out_MBox.GetFreeCount();
@ -379,6 +407,23 @@ public:
switch(ch) switch(ch)
{ {
case SPU_WrEventMask: //Write event mask
case SPU_WrEventAck: //Write end of event processing
case SPU_WrDec: //Write decrementer count
case SPU_WrSRR0: //Write SPU machine state save/restore register 0 (SRR0)
case MFC_WrMSSyncReq: //Write multisource synchronization request
case MFC_LSA: //Write local memory address command parameter
case MFC_EAH: //Write high order DMA effective address command parameter
case MFC_EAL: //Write low order DMA effective address command parameter
case MFC_Size: //Write DMA transfer size command parameter
case MFC_TagID: //Write tag identifier command parameter
case MFC_Cmd: //Write and enqueue DMA command with associated class ID
case MFC_WrTagMask: //Write tag mask
case MFC_WrTagUpdate: //Write request for conditional or unconditional tag status update
case MFC_WrListStallAck: //Write DMA list stall-and-notify acknowledge
ConLog.Error("%s error: unimplemented channel (%s).", __FUNCTION__, spu_ch_name[ch]);
break;
case SPU_WrOutIntrMbox: case SPU_WrOutIntrMbox:
ConLog.Warning("SPU_WrOutIntrMbox = 0x%x", v); ConLog.Warning("SPU_WrOutIntrMbox = 0x%x", v);
@ -410,6 +455,20 @@ public:
switch(ch) switch(ch)
{ {
case SPU_RdEventStat: //Read event status with mask applied
case SPU_RdSigNotify1: //Signal notification 1
case SPU_RdSigNotify2: //Signal notification 2
case SPU_RdDec: //Read decrementer count
case SPU_RdEventMask: //Read event mask
case SPU_RdMachStat: //Read SPU run status
case SPU_RdSRR0: //Read SPU machine state save/restore register 0 (SRR0)
case MFC_RdTagMask: //Read tag mask
case MFC_RdTagStat: //Read tag status with mask applied
case MFC_RdListStallStat: //Read DMA list stall-and-notify status
case MFC_RdAtomicStat: //Read completion status of last completed immediate MFC atomic update command
ConLog.Error("%s error: unimplemented channel (%s).", __FUNCTION__, spu_ch_name[ch]);
break;
case SPU_RdInMbox: case SPU_RdInMbox:
if(!SPU.In_MBox.Pop(v)) v = 0; if(!SPU.In_MBox.Pop(v)) v = 0;
ConLog.Warning("%s: SPU_RdInMbox(0x%x).", __FUNCTION__, v); ConLog.Warning("%s: SPU_RdInMbox(0x%x).", __FUNCTION__, v);

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations"> <ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32"> <ProjectConfiguration Include="Debug|Win32">
@ -322,6 +322,7 @@
<ClInclude Include="Emu\Cell\PPUOpcodes.h" /> <ClInclude Include="Emu\Cell\PPUOpcodes.h" />
<ClInclude Include="Emu\Cell\PPUProgramCompiler.h" /> <ClInclude Include="Emu\Cell\PPUProgramCompiler.h" />
<ClInclude Include="Emu\Cell\PPUThread.h" /> <ClInclude Include="Emu\Cell\PPUThread.h" />
<ClInclude Include="Emu\Cell\RawSPUThread.h" />
<ClInclude Include="Emu\Cell\SPUDecoder.h" /> <ClInclude Include="Emu\Cell\SPUDecoder.h" />
<ClInclude Include="Emu\Cell\SPUDisAsm.h" /> <ClInclude Include="Emu\Cell\SPUDisAsm.h" />
<ClInclude Include="Emu\Cell\SPUInterpreter.h" /> <ClInclude Include="Emu\Cell\SPUInterpreter.h" />

View File

@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?> <?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> <Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup> <ItemGroup>
<Filter Include="Emu"> <Filter Include="Emu">
@ -510,5 +510,8 @@
<ClInclude Include="..\Utilities\BEType.h"> <ClInclude Include="..\Utilities\BEType.h">
<Filter>Utilities</Filter> <Filter>Utilities</Filter>
</ClInclude> </ClInclude>
<ClInclude Include="Emu\Cell\RawSPUThread.h">
<Filter>Include</Filter>
</ClInclude>
</ItemGroup> </ItemGroup>
</Project> </Project>