Merge pull request #12347 from JosJuice/jitarm64-paired-offset
JitArm64: Use ADDI2R for psq_lXX/psq_stXX immediate offsets
This commit is contained in:
commit
c54e8d733f
|
@ -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,
|
void ARM64XEmitter::ADDI2R_internal(ARM64Reg Rd, ARM64Reg Rn, u64 imm, bool negative, bool flags,
|
||||||
ARM64Reg scratch)
|
ARM64Reg scratch)
|
||||||
{
|
{
|
||||||
|
DEBUG_ASSERT(Is64Bit(Rd) == Is64Bit(Rn));
|
||||||
|
|
||||||
|
if (!Is64Bit(Rd))
|
||||||
|
imm &= 0xFFFFFFFFULL;
|
||||||
|
|
||||||
bool has_scratch = scratch != ARM64Reg::INVALID_REG;
|
bool has_scratch = scratch != ARM64Reg::INVALID_REG;
|
||||||
u64 imm_neg = Is64Bit(Rd) ? u64(-s64(imm)) : u64(-s64(imm)) & 0xFFFFFFFFuLL;
|
u64 imm_neg = Is64Bit(Rd) ? u64(-s64(imm)) : u64(-s64(imm)) & 0xFFFFFFFFuLL;
|
||||||
bool neg_neg = negative ? false : true;
|
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
|
// Try them all first
|
||||||
if (imm <= 0xFFF)
|
if (imm <= 0xFFF)
|
||||||
{
|
{
|
||||||
|
|
|
@ -58,10 +58,8 @@ void JitArm64::psq_lXX(UGeckoInstruction inst)
|
||||||
{
|
{
|
||||||
if (indexed)
|
if (indexed)
|
||||||
ADD(addr_reg, gpr.R(inst.RA), gpr.R(inst.RB));
|
ADD(addr_reg, gpr.R(inst.RA), gpr.R(inst.RB));
|
||||||
else if (offset >= 0)
|
|
||||||
ADD(addr_reg, gpr.R(inst.RA), offset);
|
|
||||||
else
|
else
|
||||||
SUB(addr_reg, gpr.R(inst.RA), std::abs(offset));
|
ADDI2R(addr_reg, gpr.R(inst.RA), offset, addr_reg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -217,10 +215,8 @@ void JitArm64::psq_stXX(UGeckoInstruction inst)
|
||||||
{
|
{
|
||||||
if (indexed)
|
if (indexed)
|
||||||
ADD(addr_reg, gpr.R(inst.RA), gpr.R(inst.RB));
|
ADD(addr_reg, gpr.R(inst.RA), gpr.R(inst.RB));
|
||||||
else if (offset >= 0)
|
|
||||||
ADD(addr_reg, gpr.R(inst.RA), offset);
|
|
||||||
else
|
else
|
||||||
SUB(addr_reg, gpr.R(inst.RA), std::abs(offset));
|
ADDI2R(addr_reg, gpr.R(inst.RA), offset, addr_reg);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue