Merge pull request #8133 from Sintendo/mov64imm32

x64Emitter: Emit shorter MOVs for 32-bit immediates
This commit is contained in:
Tilka 2020-01-06 13:12:56 +01:00 committed by GitHub
commit 6e18dfb600
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 3 deletions

View file

@ -1591,8 +1591,9 @@ void XEmitter::XOR(int bits, const OpArg& a1, const OpArg& a2)
}
void XEmitter::MOV(int bits, const OpArg& a1, const OpArg& a2)
{
if (bits == 64 && a1.IsSimpleReg() && a2.scale == SCALE_IMM64 &&
a2.offset == static_cast<u32>(a2.offset))
if (bits == 64 && a1.IsSimpleReg() &&
((a2.scale == SCALE_IMM64 && a2.offset == static_cast<u32>(a2.offset)) ||
(a2.scale == SCALE_IMM32 && static_cast<s32>(a2.offset) >= 0)))
{
WriteNormalOp(32, NormalOp::MOV, a1, a2.AsImm32());
return;