Merge pull request #12347 from JosJuice/jitarm64-paired-offset

JitArm64: Use ADDI2R for psq_lXX/psq_stXX immediate offsets
This commit is contained in:
Mai 2023-12-01 20:15:06 -05:00 committed by GitHub
commit c54e8d733f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 16 additions and 7 deletions

View File

@ -4125,11 +4125,24 @@ 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;
bool has_scratch = scratch != ARM64Reg::INVALID_REG;
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)
{

View File

@ -58,10 +58,8 @@ void JitArm64::psq_lXX(UGeckoInstruction inst)
{
if (indexed)
ADD(addr_reg, gpr.R(inst.RA), gpr.R(inst.RB));
else if (offset >= 0)
ADD(addr_reg, gpr.R(inst.RA), offset);
else
SUB(addr_reg, gpr.R(inst.RA), std::abs(offset));
ADDI2R(addr_reg, gpr.R(inst.RA), offset, addr_reg);
}
else
{
@ -217,10 +215,8 @@ void JitArm64::psq_stXX(UGeckoInstruction inst)
{
if (indexed)
ADD(addr_reg, gpr.R(inst.RA), gpr.R(inst.RB));
else if (offset >= 0)
ADD(addr_reg, gpr.R(inst.RA), offset);
else
SUB(addr_reg, gpr.R(inst.RA), std::abs(offset));
ADDI2R(addr_reg, gpr.R(inst.RA), offset, addr_reg);
}
else
{