From addbc8cad8dec3fec0db2e3ac663db0a3bad8c1f Mon Sep 17 00:00:00 2001 From: Tony Wasserka Date: Mon, 23 Feb 2026 23:44:08 +0100 Subject: [PATCH] Arm64Emitter: Disable 32-bit constant optimization when NOP-padding is requested Code caching requires this even for simple libraries like libdl.so (as observed in the 32-bit build of Super Meat Boy). --- FEXCore/Source/Interface/Core/ArchHelpers/Arm64Emitter.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/FEXCore/Source/Interface/Core/ArchHelpers/Arm64Emitter.cpp b/FEXCore/Source/Interface/Core/ArchHelpers/Arm64Emitter.cpp index ce3d1a9f7..d93dba482 100644 --- a/FEXCore/Source/Interface/Core/ArchHelpers/Arm64Emitter.cpp +++ b/FEXCore/Source/Interface/Core/ArchHelpers/Arm64Emitter.cpp @@ -448,8 +448,10 @@ void Arm64Emitter::LoadConstant(ARMEmitter::Size s, ARMEmitter::Register Reg, ui return; } - if ((Constant >> 32) == 0) { + if ((Constant >> 32) == 0 && !NOPPad) { // If the upper 32-bits is all zero, we can now switch to a 32-bit move. + // NOTE: The NOP padding code does not appropriately adjust to this yet, + // so we skip this optimization in that case s = ARMEmitter::Size::i32Bit; Is64Bit = false; Segments = std::min(Segments, 2);