JitArm64: Fix the "do nothing" cases of ANDI2R and friends

So somehow I forgot that AArch64 uses three-operand encoding...

Fixes a regression from 6303416201 which manifested in various ways,
such as incorrect rendering of the Wind Waker title screen.
This commit is contained in:
JosJuice 2023-12-21 20:51:32 +01:00
parent 51a44aa5d2
commit d8c78f2a92
1 changed files with 10 additions and 7 deletions

View File

@ -4051,14 +4051,15 @@ void ARM64XEmitter::ANDI2R(ARM64Reg Rd, ARM64Reg Rn, u64 imm, ARM64Reg scratch)
imm = (imm << 32) | (imm & 0xFFFFFFFF); imm = (imm << 32) | (imm & 0xFFFFFFFF);
} }
if ((~imm) == 0) if (imm == 0)
{
// Do nothing
}
else if (imm == 0)
{ {
MOVZ(Rd, 0); MOVZ(Rd, 0);
} }
else if ((~imm) == 0)
{
if (Rd != Rn)
MOV(Rd, Rn);
}
else if (const auto result = LogicalImm(imm, GPRSize::B64)) else if (const auto result = LogicalImm(imm, GPRSize::B64))
{ {
AND(Rd, Rn, result); AND(Rd, Rn, result);
@ -4090,7 +4091,8 @@ void ARM64XEmitter::ORRI2R(ARM64Reg Rd, ARM64Reg Rn, u64 imm, ARM64Reg scratch)
if (imm == 0) if (imm == 0)
{ {
// Do nothing if (Rd != Rn)
MOV(Rd, Rn);
} }
else if ((~imm) == 0) else if ((~imm) == 0)
{ {
@ -4127,7 +4129,8 @@ void ARM64XEmitter::EORI2R(ARM64Reg Rd, ARM64Reg Rn, u64 imm, ARM64Reg scratch)
if (imm == 0) if (imm == 0)
{ {
// Do nothing if (Rd != Rn)
MOV(Rd, Rn);
} }
else if ((~imm) == 0) else if ((~imm) == 0)
{ {