implement aliases for shld/shrd, part of rdar://8418316

llvm-svn: 113937
This commit is contained in:
Chris Lattner 2010-09-15 04:37:18 +00:00
parent 4bd21710b6
commit 6b40b0def1
2 changed files with 20 additions and 0 deletions

View File

@ -834,6 +834,15 @@ ParseInstruction(StringRef Name, SMLoc NameLoc,
std::swap(Operands[1], Operands[2]);
}
// FIXME: Hack to handle recognize "sh[lr]d op,op" -> "shld $1, op,op".
if ((Name.startswith("shld") || Name.startswith("shrd")) &&
Operands.size() == 3) {
const MCExpr *One = MCConstantExpr::Create(1, getParser().getContext());
Operands.insert(Operands.begin()+1,
X86Operand::CreateImm(One, NameLoc, NameLoc));
}
// FIXME: Hack to handle recognize "in[bwl] <op>". Canonicalize it to
// "inb <op>, %al".
if ((Name == "inb" || Name == "inw" || Name == "inl") &&

View File

@ -268,3 +268,14 @@ rcl %bl
rcll 0xdeadbeef(%ebx,%ecx,8)
rcr %ecx
rcrl 0x12345678
// rdar://8418316
// CHECK: shldw $1, %bx, %bx
// CHECK: shldw $1, %bx, %bx
// CHECK: shrdw $1, %bx, %bx
// CHECK: shrdw $1, %bx, %bx
shld %bx,%bx
shld $1, %bx,%bx
shrd %bx,%bx
shrd $1, %bx,%bx