Merge pull request #12458 from JosJuice/jitarm64-logic-i2r-not-nothing

JitArm64: Fix the "do nothing" cases of ANDI2R and friends
This commit is contained in:
Mai 2023-12-21 17:13:20 -05:00 committed by GitHub
commit 6c2da5229e
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
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)
{ {