forked from OSchip/llvm-project
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
7a23aa081a
commit
8caea68a4f
|
@ -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