From 70e92b88509d9d695c79bc57cd6a1039d1e600cf Mon Sep 17 00:00:00 2001 From: 1e1 <1e1@users.noreply.github.com> Date: Tue, 30 Jun 2026 22:57:24 +0200 Subject: [PATCH] Espresso: fix stwcx. CR0[SO] update and make IML instructions trivially copyable - stwcx. loaded the summary-overflow source from CR0[SO] instead of XER[SO], making the subsequent CR0[SO] assignment a no-op. Other compare paths already read XER[SO] correctly. - Default the IMLReg/IMLInstruction copy constructors so IMLInstruction becomes trivially copyable, letting the IML instruction vectors relocate with memmove instead of per-element copies. --- src/Cafe/HW/Espresso/Recompiler/IML/IMLInstruction.h | 7 ++----- src/Cafe/HW/Espresso/Recompiler/PPCRecompilerImlGen.cpp | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/src/Cafe/HW/Espresso/Recompiler/IML/IMLInstruction.h b/src/Cafe/HW/Espresso/Recompiler/IML/IMLInstruction.h index 4df2a666..6f521264 100644 --- a/src/Cafe/HW/Espresso/Recompiler/IML/IMLInstruction.h +++ b/src/Cafe/HW/Espresso/Recompiler/IML/IMLInstruction.h @@ -47,7 +47,7 @@ public: //m_raw |= (uint32)regId; } - IMLReg(const IMLReg& other) : m_raw(other.m_raw) {} + IMLReg(const IMLReg& other) = default; IMLRegFormat GetBaseFormat() const { @@ -351,10 +351,7 @@ struct IMLUsedRegisters struct IMLInstruction { IMLInstruction() {} - IMLInstruction(const IMLInstruction& other) - { - memcpy(this, &other, sizeof(IMLInstruction)); - } + IMLInstruction(const IMLInstruction& other) = default; uint8 type; uint8 operation; diff --git a/src/Cafe/HW/Espresso/Recompiler/PPCRecompilerImlGen.cpp b/src/Cafe/HW/Espresso/Recompiler/PPCRecompilerImlGen.cpp index e76a53fa..ad967290 100644 --- a/src/Cafe/HW/Espresso/Recompiler/PPCRecompilerImlGen.cpp +++ b/src/Cafe/HW/Espresso/Recompiler/PPCRecompilerImlGen.cpp @@ -1545,7 +1545,7 @@ bool PPCRecompilerImlGen_STWCX(ppcImlGenContext_t* ppcImlGenContext, uint32 opco IMLReg regCrGT = _GetRegCR(ppcImlGenContext, 0, Espresso::CR_BIT_INDEX_GT); IMLReg regCrEQ = _GetRegCR(ppcImlGenContext, 0, Espresso::CR_BIT_INDEX_EQ); IMLReg regCrSO = _GetRegCR(ppcImlGenContext, 0, Espresso::CR_BIT_INDEX_SO); - IMLReg regXerSO = _GetRegCR(ppcImlGenContext, 0, Espresso::CR_BIT_INDEX_SO); + IMLReg regXerSO = PPCRecompilerImlGen_loadRegister(ppcImlGenContext, PPCREC_NAME_XER_SO); ppcImlGenContext->emitInst().make_r_s32(PPCREC_IML_OP_ASSIGN, regCrLT, 0); ppcImlGenContext->emitInst().make_r_s32(PPCREC_IML_OP_ASSIGN, regCrGT, 0); ppcImlGenContext->emitInst().make_r_r(PPCREC_IML_OP_ASSIGN, regCrSO, regXerSO);