diff options
| author | Scott Mansell <phiren@gmail.com> | 2016-08-29 22:57:37 +1200 |
|---|---|---|
| committer | Scott Mansell <phiren@gmail.com> | 2016-08-29 22:57:37 +1200 |
| commit | fc2b0e0f451b61bacd4b24b2a531edbaeb34292b (patch) | |
| tree | 296c2ff1c9fa39c0ee7ed1ccb035ee55f5cb3b1f /Source/Core | |
| parent | 967c371d7a8695e60cf52da22f3952f23b031359 (diff) | |
Simplify lswx loop.
Diffstat (limited to 'Source/Core')
| -rw-r--r-- | Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp | 40 |
1 files changed, 14 insertions, 26 deletions
diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp index e3e1f4fcd6..1d9f49d582 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_LoadStore.cpp @@ -501,37 +501,25 @@ void Interpreter::lhzx(UGeckoInstruction _inst) void Interpreter::lswx(UGeckoInstruction _inst) { u32 EA = Helper_Get_EA_X(_inst); - u32 n = (u8)PowerPC::ppcState.xer_stringctrl; - int r = _inst.RD; - int i = 0; // Confirmed by hardware test that the zero case doesn't zero rGPR[r] - if (n > 0) + for (u32 n = 0; n < static_cast<u8>(PowerPC::ppcState.xer_stringctrl); n++) { - rGPR[r] = 0; - while (true) - { - u32 TempValue = PowerPC::Read_U8(EA) << (24 - i); - if (PowerPC::ppcState.Exceptions & EXCEPTION_DSI) - { - PanicAlert("DSI exception in lswx."); - NOTICE_LOG(POWERPC, "DSI exception in lswx"); - return; - } - rGPR[r] |= TempValue; - - if (--n == 0) - return; + int reg = (_inst.RD + (n >> 2)) & 0x1f; + int offset = (n & 3) << 3; + if ((n & 3) == 0) + rGPR[reg] = 0; - EA++; - i += 8; - if (i == 32) - { - i = 0; - r = (r + 1) & 31; - rGPR[r] = 0; - } + u32 TempValue = PowerPC::Read_U8(EA) << (24 - offset); + if (PowerPC::ppcState.Exceptions & EXCEPTION_DSI) + { + PanicAlert("DSI exception in lswx."); + NOTICE_LOG(POWERPC, "DSI exception in lswx"); + return; } + rGPR[reg] |= TempValue; + + EA++; } } |
