fix rdar://8431880 - rcl/rcr with no shift amount not recognized

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@113936 91177308-0d34-0410-b5e6-96231b3b80d8
This commit is contained in:
Chris Lattner 2010-09-15 04:33:27 +00:00
parent 84f362d891
commit e9e16a36d9
2 changed files with 20 additions and 1 deletions

View File

@ -813,7 +813,7 @@ ParseInstruction(StringRef Name, SMLoc NameLoc,
if (getLexer().is(AsmToken::EndOfStatement)) if (getLexer().is(AsmToken::EndOfStatement))
Parser.Lex(); // Consume the EndOfStatement Parser.Lex(); // Consume the EndOfStatement
// FIXME: Hack to handle recognize s{hr,ar,hl} <op>, $1. Canonicalize to // FIXME: Hack to handle recognize s{hr,ar,hl} $1, <op>. Canonicalize to
// "shift <op>". // "shift <op>".
if ((Name.startswith("shr") || Name.startswith("sar") || if ((Name.startswith("shr") || Name.startswith("sar") ||
Name.startswith("shl")) && Name.startswith("shl")) &&
@ -825,6 +825,14 @@ ParseInstruction(StringRef Name, SMLoc NameLoc,
Operands.erase(Operands.begin() + 1); Operands.erase(Operands.begin() + 1);
} }
} }
// FIXME: Hack to handle recognize "rc[lr] <op>" -> "rcl $1, <op>".
if ((Name.startswith("rcl") || Name.startswith("rcr")) &&
Operands.size() == 2) {
const MCExpr *One = MCConstantExpr::Create(1, getParser().getContext());
Operands.push_back(X86Operand::CreateImm(One, NameLoc, NameLoc));
std::swap(Operands[1], Operands[2]);
}
// FIXME: Hack to handle recognize "in[bwl] <op>". Canonicalize it to // FIXME: Hack to handle recognize "in[bwl] <op>". Canonicalize it to
// "inb <op>, %al". // "inb <op>, %al".

View File

@ -257,3 +257,14 @@ fnstsw
fnstsw %ax fnstsw %ax
fnstsw %eax fnstsw %eax
fnstsw %al fnstsw %al
// rdar://8431880
// CHECK: rclb $1, %bl
// CHECK: rcll $1, 3735928559(%ebx,%ecx,8)
// CHECK: rcrl $1, %ecx
// CHECK: rcrl $1, 305419896
rcl %bl
rcll 0xdeadbeef(%ebx,%ecx,8)
rcr %ecx
rcrl 0x12345678