mirror of
https://github.com/c64scene-ar/llvm-6502.git
synced 2025-08-07 12:28:24 +00:00
gas accepts xchg <mem>, <reg> as a synonym for xchg <reg>, <mem>.
Add this to the mc assembler, fixing PR8061 git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113346 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
@@ -753,6 +753,7 @@ ParseInstruction(StringRef Name, SMLoc NameLoc,
|
|||||||
PatchedName = "vpclmulqdq";
|
PatchedName = "vpclmulqdq";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
Operands.push_back(X86Operand::CreateToken(PatchedName, NameLoc));
|
Operands.push_back(X86Operand::CreateToken(PatchedName, NameLoc));
|
||||||
|
|
||||||
if (ExtraImmOp)
|
if (ExtraImmOp)
|
||||||
@@ -827,6 +828,16 @@ ParseInstruction(StringRef Name, SMLoc NameLoc,
|
|||||||
delete Operands[0];
|
delete Operands[0];
|
||||||
Operands[0] = X86Operand::CreateToken("sldtw", NameLoc);
|
Operands[0] = X86Operand::CreateToken("sldtw", NameLoc);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// The assembler accepts "xchgX <reg>, <mem>" and "xchgX <mem>, <reg>" as
|
||||||
|
// synonyms. Our tables only have the "<reg>, <mem>" form, so if we see the
|
||||||
|
// other operand order, swap them.
|
||||||
|
if (Name == "xchgb" || Name == "xchgw" || Name == "xchgl" || Name == "xchgq")
|
||||||
|
if (Operands.size() == 3 &&
|
||||||
|
static_cast<X86Operand*>(Operands[1])->isMem() &&
|
||||||
|
static_cast<X86Operand*>(Operands[2])->isReg()) {
|
||||||
|
std::swap(Operands[1], Operands[2]);
|
||||||
|
}
|
||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
@@ -168,3 +168,8 @@ L1:
|
|||||||
// CHECK: jrcxz L1
|
// CHECK: jrcxz L1
|
||||||
// CHECK: encoding: [0xe3,A]
|
// CHECK: encoding: [0xe3,A]
|
||||||
|
|
||||||
|
// PR8061
|
||||||
|
xchgl 368(%rax),%ecx
|
||||||
|
// CHECK: xchgl %ecx, 368(%rax)
|
||||||
|
xchgl %ecx, 368(%rax)
|
||||||
|
// CHECK: xchgl %ecx, 368(%rax)
|
||||||
|
Reference in New Issue
Block a user