mirror of
https://github.com/RPCS3/llvm-mirror.git
synced 2024-11-24 11:42:57 +01:00
gas accepts xchg <mem>, <reg> as a synonym for xchg <reg>, <mem>.
Add this to the mc assembler, fixing PR8061 llvm-svn: 113346
This commit is contained in:
parent
e223d51276
commit
7435beb421
@ -753,6 +753,7 @@ ParseInstruction(StringRef Name, SMLoc NameLoc,
|
||||
PatchedName = "vpclmulqdq";
|
||||
}
|
||||
}
|
||||
|
||||
Operands.push_back(X86Operand::CreateToken(PatchedName, NameLoc));
|
||||
|
||||
if (ExtraImmOp)
|
||||
@ -827,6 +828,16 @@ ParseInstruction(StringRef Name, SMLoc NameLoc,
|
||||
delete Operands[0];
|
||||
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;
|
||||
}
|
||||
|
@ -168,3 +168,8 @@ L1:
|
||||
// CHECK: jrcxz L1
|
||||
// CHECK: encoding: [0xe3,A]
|
||||
|
||||
// PR8061
|
||||
xchgl 368(%rax),%ecx
|
||||
// CHECK: xchgl %ecx, 368(%rax)
|
||||
xchgl %ecx, 368(%rax)
|
||||
// CHECK: xchgl %ecx, 368(%rax)
|
||||
|
Loading…
Reference in New Issue
Block a user