From 9a5b3301b2db9a20017dd82d9cb2c9e20322ae1e Mon Sep 17 00:00:00 2001 From: Crementif <26669564+Crementif@users.noreply.github.com> Date: Sat, 5 Sep 2026 16:30:47 +0200 Subject: [PATCH] PPCRec: Fix mcrfs and fcmpo using the wrong instruction --- .../Recompiler/PPCRecompilerImlGen.cpp | 20 +++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/src/Cafe/HW/Espresso/Recompiler/PPCRecompilerImlGen.cpp b/src/Cafe/HW/Espresso/Recompiler/PPCRecompilerImlGen.cpp index d2e9df3a..ec24aa22 100644 --- a/src/Cafe/HW/Espresso/Recompiler/PPCRecompilerImlGen.cpp +++ b/src/Cafe/HW/Espresso/Recompiler/PPCRecompilerImlGen.cpp @@ -2703,8 +2703,21 @@ bool PPCRecompiler_decodePPCInstruction(ppcImlGenContext_t* ppcImlGenContext) switch (PPC_getBits(opcode, 30, 5)) { case 0: - if (PPCRecompilerImlGen_FCMPU(ppcImlGenContext, opcode) == false) + // fcmpo (32) and mcrfs (64) are X-form and share the low 5 bits with fcmpu + switch (PPC_getBits(opcode, 30, 10)) + { + case 0: + if (PPCRecompilerImlGen_FCMPU(ppcImlGenContext, opcode) == false) + unsupportedInstructionFound = true; + break; + case 32: + if (PPCRecompilerImlGen_FCMPO(ppcImlGenContext, opcode) == false) + unsupportedInstructionFound = true; + break; + default: unsupportedInstructionFound = true; + break; + } ppcImlGenContext->hasFPUInstruction = true; break; case 12: @@ -2765,11 +2778,6 @@ bool PPCRecompiler_decodePPCInstruction(ppcImlGenContext_t* ppcImlGenContext) default: switch (PPC_getBits(opcode, 30, 10)) { - case 32: - if (PPCRecompilerImlGen_FCMPO(ppcImlGenContext, opcode) == false) - unsupportedInstructionFound = true; - ppcImlGenContext->hasFPUInstruction = true; - break; case 40: if (PPCRecompilerImlGen_FNEG(ppcImlGenContext, opcode) == false) unsupportedInstructionFound = true;