From 2ad26ab3e9d22cafcb8cb38e3f41beb32b2a6b63 Mon Sep 17 00:00:00 2001 From: Ryan Houdek Date: Mon, 7 Sep 2015 13:38:58 -0500 Subject: [PATCH] [AArch64] Fix Test&Branch to relative location instructions. Wasn't masking by the size of the offset encoding so negative values were killing the instruction Missed commiting this in my integer gatherpipe PR. Fixes crashing on AArch64. --- Source/Core/Common/Arm64Emitter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Source/Core/Common/Arm64Emitter.cpp b/Source/Core/Common/Arm64Emitter.cpp index 385cb09b96..aa01434b43 100644 --- a/Source/Core/Common/Arm64Emitter.cpp +++ b/Source/Core/Common/Arm64Emitter.cpp @@ -477,7 +477,7 @@ void ARM64XEmitter::EncodeTestBranchInst(u32 op, ARM64Reg Rt, u8 bits, const voi Rt = DecodeReg(Rt); Write32((b64Bit << 31) | (0x36 << 24) | (op << 24) | \ - (bits << 19) | (distance << 5) | Rt); + (bits << 19) | (((u32)distance << 5) & 0x7FFE0) | Rt); } void ARM64XEmitter::EncodeUnconditionalBranchInst(u32 op, const void* ptr)