diff options
| author | JosJuice <josjuice@gmail.com> | 2024-08-31 17:24:55 +0200 |
|---|---|---|
| committer | JosJuice <josjuice@gmail.com> | 2024-08-31 17:24:55 +0200 |
| commit | ff75cc80aadb6e5a00c569d4e09650141c082606 (patch) | |
| tree | 84395ec7dfe7ca3c2edfeb9e78fab16f555454fa /Source | |
| parent | 38b189e13d775a85461c05be8a035bc623e3878c (diff) | |
Interpreter: Fix subfic carry calculation
This was accidentally using the instruction's output instead of the
instruction's input when the input and output registers were the same.
Diffstat (limited to 'Source')
| -rw-r--r-- | Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp index d5bd50720b..f1fef874fd 100644 --- a/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp +++ b/Source/Core/Core/PowerPC/Interpreter/Interpreter_Integer.cpp @@ -141,10 +141,10 @@ void Interpreter::oris(Interpreter& interpreter, UGeckoInstruction inst) void Interpreter::subfic(Interpreter& interpreter, UGeckoInstruction inst) { auto& ppc_state = interpreter.m_ppc_state; + const s32 a = s32(ppc_state.gpr[inst.RA]); const s32 immediate = inst.SIMM_16; - ppc_state.gpr[inst.RD] = u32(immediate - s32(ppc_state.gpr[inst.RA])); - ppc_state.SetCarry((ppc_state.gpr[inst.RA] == 0) || - (Helper_Carry(0 - ppc_state.gpr[inst.RA], u32(immediate)))); + ppc_state.gpr[inst.RD] = u32(immediate - a); + ppc_state.SetCarry((a == 0) || (Helper_Carry(0 - u32(a), u32(immediate)))); } void Interpreter::twi(Interpreter& interpreter, UGeckoInstruction inst) |
