JitArm64: Add special zero case to ADDI2R

This normally doesn't reduce the instruction count, but is nonetheless
useful on CPUs that can do 0-cycle moves.
This commit is contained in:
JosJuice 2023-12-01 21:26:22 +01:00
parent 25ffb0dbfc
commit 67791d227c
1 changed files with 11 additions and 1 deletions

View File

@ -4125,6 +4125,8 @@ void ARM64XEmitter::AddImmediate(ARM64Reg Rd, ARM64Reg Rn, u64 imm, bool shift,
void ARM64XEmitter::ADDI2R_internal(ARM64Reg Rd, ARM64Reg Rn, u64 imm, bool negative, bool flags,
ARM64Reg scratch)
{
DEBUG_ASSERT(Is64Bit(Rd) == Is64Bit(Rn));
if (!Is64Bit(Rd))
imm &= 0xFFFFFFFFULL;
@ -4132,7 +4134,15 @@ void ARM64XEmitter::ADDI2R_internal(ARM64Reg Rd, ARM64Reg Rn, u64 imm, bool nega
u64 imm_neg = Is64Bit(Rd) ? u64(-s64(imm)) : u64(-s64(imm)) & 0xFFFFFFFFuLL;
bool neg_neg = negative ? false : true;
// Fast paths, aarch64 immediate instructions
// Special path for zeroes
if (imm == 0 && !flags)
{
if (Rd != Rn)
MOV(Rd, Rn);
return;
}
// Regular fast paths, aarch64 immediate instructions
// Try them all first
if (imm <= 0xFFF)
{