From 91cfddfbb7ecb483d21f15cb50370e3e1fbd4b18 Mon Sep 17 00:00:00 2001 From: Shokunin <30949000+tetrisgm@users.noreply.github.com> Date: Wed, 21 Oct 2026 11:15:49 -0700 Subject: [PATCH] Keep production PGXP ALU helpers out of generated instruction bodies --- runtime/src/pgxp.cpp | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/runtime/src/pgxp.cpp b/runtime/src/pgxp.cpp index e3c1d7c7..33ed86e7 100644 --- a/runtime/src/pgxp.cpp +++ b/runtime/src/pgxp.cpp @@ -1182,7 +1182,18 @@ static int alu_scalar(uint32_t instr, uint32_t result, uint32_t s1, uint32_t s2, static void alu_halves(uint32_t instr, uint32_t result, uint32_t s1, uint32_t s2); -extern "C" void psx_pgxp_alu(struct CPUState *cpu, uint32_t instr, +/* Keep the memory-only fast path out of each generated instruction body. + * GCC LTO otherwise partially inlines/specializes it across the large title, + * increasing the hot code footprint instead of reducing instruction work. */ +extern "C" +#if defined(PSX_NO_DEBUG_TOOLS) && defined(__GNUC__) && !defined(__clang__) +__attribute__((noinline, noclone)) +#elif defined(PSX_NO_DEBUG_TOOLS) && defined(__clang__) +__attribute__((noinline)) +#elif defined(PSX_NO_DEBUG_TOOLS) && defined(_MSC_VER) +__declspec(noinline) +#endif +void psx_pgxp_alu(struct CPUState *cpu, uint32_t instr, uint32_t result, uint32_t s1, uint32_t s2) { (void)cpu; if (!g_pgxp_active) return;