diff --git a/Source/Core/Core/PowerPC/JitArm32/Jit.h b/Source/Core/Core/PowerPC/JitArm32/Jit.h index 111ad8b787..98f6884e1c 100644 --- a/Source/Core/Core/PowerPC/JitArm32/Jit.h +++ b/Source/Core/Core/PowerPC/JitArm32/Jit.h @@ -60,6 +60,7 @@ private: FLAG_SIZE_F32 = (1 << 5), FLAG_SIZE_F64 = (1 << 6), FLAG_REVERSE = (1 << 7), + FLAG_EXTEND = (1 << 8), }; u32 m_fastmem_size; diff --git a/Source/Core/Core/PowerPC/JitArm32/JitArm_BackPatch.cpp b/Source/Core/Core/PowerPC/JitArm32/JitArm_BackPatch.cpp index f095d1c145..3351f2a8fe 100644 --- a/Source/Core/Core/PowerPC/JitArm32/JitArm_BackPatch.cpp +++ b/Source/Core/Core/PowerPC/JitArm32/JitArm_BackPatch.cpp @@ -300,6 +300,9 @@ u32 JitArm::EmitBackpatchRoutine(ARMXEmitter* emit, u32 flags, bool fastmem, boo else if (flags & BackPatchInfo::FLAG_SIZE_16) emit->REV16(RS, RS); } + + if (flags & BackPatchInfo::FLAG_EXTEND) + emit->SXTH(RS, RS); } } else @@ -590,7 +593,6 @@ void JitArm::InitBackpatch() m_backpatch_info[flags] = info; } - // 16bit - reverse { flags = @@ -612,6 +614,27 @@ void JitArm::InitBackpatch() m_backpatch_info[flags] = info; } + // 16bit - sign extend + { + flags = + BackPatchInfo::FLAG_LOAD | + BackPatchInfo::FLAG_SIZE_16 | + BackPatchInfo::FLAG_EXTEND; + EmitBackpatchRoutine(this, flags, false, false, R0); + code_end = GetWritableCodePtr(); + info.m_slowmem_size = (code_end - code_base) / 4; + + SetCodePtr(code_base); + + info.m_fastmem_trouble_inst_offset = + EmitBackpatchRoutine(this, flags, true, false, R0); + code_end = GetWritableCodePtr(); + info.m_fastmem_size = (code_end - code_base) / 4; + + SetCodePtr(code_base); + + m_backpatch_info[flags] = info; + } // 32bit - reverse { flags = diff --git a/Source/Core/Core/PowerPC/JitArm32/JitArm_LoadStore.cpp b/Source/Core/Core/PowerPC/JitArm32/JitArm_LoadStore.cpp index 1682fe5b57..8cd32c561c 100644 --- a/Source/Core/Core/PowerPC/JitArm32/JitArm_LoadStore.cpp +++ b/Source/Core/Core/PowerPC/JitArm32/JitArm_LoadStore.cpp @@ -347,13 +347,13 @@ void JitArm::SafeLoadToReg(ARMReg dest, s32 addr, s32 offsetReg, int accessSize, if (reverse) flags |= BackPatchInfo::FLAG_REVERSE; + if (signExtend) + flags |= BackPatchInfo::FLAG_EXTEND; + EmitBackpatchRoutine(this, flags, SConfig::GetInstance().m_LocalCoreStartupParameter.bFastmem, !(is_immediate && Memory::IsRAMAddress(imm_addr)), dest); - if (signExtend) // Only on 16 loads - SXTH(dest, dest); - if (update) MOV(gpr.R(addr), rA); }