From b4e12ad5c9fc9d5dcb4b599ba944a1a5330acdde Mon Sep 17 00:00:00 2001 From: LinesPrower Date: Sun, 27 Sep 2009 14:19:38 +0000 Subject: [PATCH] Some improvements of FP and DMA git-svn-id: https://dolphin-emu.googlecode.com/svn/trunk@4334 8ced0084-cf51-0410-be5f-012b33b47a6e --- .../Interpreter/Interpreter_FloatingPoint.cpp | 26 +++++++++---------- .../Interpreter/Interpreter_LoadStore.cpp | 11 ++++---- .../Interpreter/Interpreter_Paired.cpp | 12 +-------- .../Interpreter_SystemRegisters.cpp | 5 ++++ 4 files changed, 23 insertions(+), 31 deletions(-) diff --git a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp index a7a44c1c6b..b9e006ab85 100644 --- a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp +++ b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_FloatingPoint.cpp @@ -105,7 +105,6 @@ void fcmpu(UGeckoInstruction _inst) } // Apply current rounding mode -// need to investigate this instruction. void fctiwx(UGeckoInstruction _inst) { const double b = rPS0(_inst.FB); @@ -133,7 +132,7 @@ void fctiwx(UGeckoInstruction _inst) { double t = b + 0.5; i = (s32)t; - if (t - i < 0) i--; + if (t - i < 0 || (t - i == 0 && b > 0)) i--; break; } case 1: // zero @@ -161,19 +160,15 @@ void fctiwx(UGeckoInstruction _inst) FPSCR.FR = fabs(di) > fabs(b); } } - - //FPRF undefined - - riPS0(_inst.FD) = (u64)value; // zero extend - if (_inst.Rc) + // based on HW tests + // FPRF is not affected + riPS0(_inst.FD) = 0xfff8000000000000ull | value; + if (value == 0 && ( (*(u64*)&b) & DOUBLE_SIGN )) + riPS0(_inst.FD) |= 0x100000000ull; + if (_inst.Rc) Helper_UpdateCR1(rPS0(_inst.FD)); } -/* -In the float -> int direction, floating point input values larger than the largest -representable int result in 0x80000000 (a very negative number) rather than the -largest representable int on PowerPC. */ - // Always round toward zero void fctiwzx(UGeckoInstruction _inst) { @@ -209,8 +204,11 @@ void fctiwzx(UGeckoInstruction _inst) } value = (u32)i; } - - riPS0(_inst.FD) = (u64)value; + // based on HW tests + // FPRF is not affected + riPS0(_inst.FD) = 0xfff8000000000000ull | value; + if (value == 0 && ( (*(u64*)&b) & DOUBLE_SIGN )) + riPS0(_inst.FD) |= 0x100000000ull; if (_inst.Rc) Helper_UpdateCR1(rPS0(_inst.FD)); } diff --git a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp index 10d9cc7b00..999c5e3582 100644 --- a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp +++ b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_LoadStore.cpp @@ -315,19 +315,18 @@ void dcbtst(UGeckoInstruction _inst) _assert_msg_(POWERPC,0,"dcbtst - Not implemented"); } -// __________________________________________________________________________________________________ -// dcbz -// TODO(ector) check docs void dcbz(UGeckoInstruction _inst) { // !!! after the dcbz follows a dcbf... dont clear the memory in this case !!! // 0x81330c2c - u32 NextOpcode = Memory::Read_U32(PC+4); + // LinesPrower: why? does it break something? + // according to docs dcbz->dcbf should clear the memory immediately! + // However, dcbz->dcbi won't clear anything, but that's completely senseless + /* u32 NextOpcode = Memory::Read_U32(PC+4); if (NextOpcode == 0x7C0400AC) { return; - } - + }*/ // HACK but works... we think Memory::Memset(Helper_Get_EA_X(_inst) & (~31), 0, 32); } diff --git a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Paired.cpp b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Paired.cpp index ce035f48ee..b172aae979 100644 --- a/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Paired.cpp +++ b/Source/Core/Core/Src/PowerPC/Interpreter/Interpreter_Paired.cpp @@ -473,18 +473,8 @@ void ps_cmpo1(UGeckoInstruction _inst) // TODO(ector) check docs void dcbz_l(UGeckoInstruction _inst) { - // This is supposed to allocate a cache line in the locked cache. Not entirely sure how - // this is visible to the rest of the world. For now, we ignore it. - /* - addr_t ea = Helper_Get_EA(_inst); - - u32 blockStart = ea & (~(CACHEBLOCKSIZE-1)); - u32 blockEnd = blockStart + CACHEBLOCKSIZE; - //FAKE: clear memory instead of clearing the cache block - for (int i=blockStart; i