From b47056b6fdcbbafcf2dc2da1c252104be4dcca93 Mon Sep 17 00:00:00 2001 From: Sintendo <3380580+Sintendo@users.noreply.github.com> Date: Tue, 10 Nov 2026 16:54:33 +0100 Subject: [PATCH 1/2] Jit64: mfspr - Sign-extend slice_length `slice_length` is defined as an int, but was being zero-extended to 64 bits on x64. We should match what we do for ARM64 and sign-extend, as discussed in PR #14944. --- Source/Core/Core/PowerPC/Jit64/Jit_SystemRegisters.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_SystemRegisters.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_SystemRegisters.cpp index 70eb2e4027..71abc50b7d 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit_SystemRegisters.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit_SystemRegisters.cpp @@ -333,7 +333,7 @@ void Jit64::mfspr(UGeckoInstruction inst) CVTSI2SS(XMM0, PPCSTATE(downcount)); MULSS(XMM0, MDisp(rcx, offsetof(CoreTiming::Globals, last_OC_factor_inverted))); CVTSS2SI(rdx, R(XMM0)); // RDX is downcount scaled by the overclocking factor - MOV(32, rax, MDisp(rcx, offsetof(CoreTiming::Globals, slice_length))); + MOVSX(64, 32, rax, MDisp(rcx, offsetof(CoreTiming::Globals, slice_length))); SUB(64, rax, rdx); // cycles since the last CoreTiming::Advance() event is (slicelength - // Scaled_downcount) ADD(64, rax, MDisp(rcx, offsetof(CoreTiming::Globals, global_timer))); From ad3598389ebc6ef2d93915b656c0c3478104ac77 Mon Sep 17 00:00:00 2001 From: Sintendo <3380580+Sintendo@users.noreply.github.com> Date: Tue, 10 Nov 2026 17:06:46 +0100 Subject: [PATCH 2/2] Jit64: mfspr - Fix comment formatting --- .../Core/Core/PowerPC/Jit64/Jit_SystemRegisters.cpp | 12 ++++-------- 1 file changed, 4 insertions(+), 8 deletions(-) diff --git a/Source/Core/Core/PowerPC/Jit64/Jit_SystemRegisters.cpp b/Source/Core/Core/PowerPC/Jit64/Jit_SystemRegisters.cpp index 71abc50b7d..b6baf2fb51 100644 --- a/Source/Core/Core/PowerPC/Jit64/Jit_SystemRegisters.cpp +++ b/Source/Core/Core/PowerPC/Jit64/Jit_SystemRegisters.cpp @@ -339,14 +339,10 @@ void Jit64::mfspr(UGeckoInstruction inst) ADD(64, rax, MDisp(rcx, offsetof(CoreTiming::Globals, global_timer))); SUB(64, rax, MDisp(rcx, offsetof(CoreTiming::Globals, fake_TB_start_ticks))); // It might seem convenient to correct the timer for the block position here for even more - // accurate - // timing, but as of currently, this can break games. If we end up reading a time *after* the - // time - // at which an interrupt was supposed to occur, e.g. because we're 100 cycles into a block with - // only - // 50 downcount remaining, some games don't function correctly, such as Karaoke Party - // Revolution, - // which won't get past the loading screen. + // accurate timing, but as of currently, this can break games. If we end up reading a time + // *after* the time at which an interrupt was supposed to occur, e.g. because we're 100 cycles + // into a block with only 50 downcount remaining, some games don't function correctly, such as + // Karaoke Party Revolution, which won't get past the loading screen. // if (js.downcountAmount) // ADD(64, rax, Imm32(js.downcountAmount));