Merge pull request #12566 from JosJuice/arm64-add-imm-sp

Arm64Emitter: Don't optimize ADD to MOV for SP
This commit is contained in:
Mai 2024-02-06 17:53:17 -05:00 committed by GitHub
commit a50ab40a5f
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 8 additions and 2 deletions

View File

@ -4222,9 +4222,15 @@ void ARM64XEmitter::ADDI2R_internal(ARM64Reg Rd, ARM64Reg Rn, u64 imm, bool nega
// Special path for zeroes
if (imm == 0 && !flags)
{
if (Rd != Rn)
if (Rd == Rn)
{
return;
}
else if (DecodeReg(Rd) != DecodeReg(ARM64Reg::SP) && DecodeReg(Rn) != DecodeReg(ARM64Reg::SP))
{
MOV(Rd, Rn);
return;
return;
}
}
// Regular fast paths, aarch64 immediate instructions