Merge pull request #6248 from JonnyH/WIP/fix-arm64-MOVI2R-values-between-2gb-and-4gb-of-pc

Fix arm64 MOVI2R for addresses between 2gb and 4gb offset from PC
This commit is contained in:
Markus Wick 2017-12-09 23:06:22 +01:00 committed by GitHub
commit aeaca502f0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -2029,7 +2029,8 @@ void ARM64XEmitter::MOVI2R(ARM64Reg Rd, u64 imm, bool optimize)
u64 aligned_pc = (u64)GetCodePtr() & ~0xFFF;
s64 aligned_offset = (s64)imm - (s64)aligned_pc;
if (upload_part.Count() > 1 && std::abs(aligned_offset) < 0xFFFFFFFFLL)
// The offset for ADR/ADRP is an s32, so make sure it can be represented in that
if (upload_part.Count() > 1 && std::abs(aligned_offset) < 0x7FFFFFFFLL)
{
// Immediate we are loading is within 4GB of our aligned range
// Most likely a address that we can load in one or two instructions