summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChris Lattner <sabre@nondot.org>2010-09-15 04:33:27 +0000
committerChris Lattner <sabre@nondot.org>2010-09-15 04:33:27 +0000
commite9e16a36d9ff355dab60e4b95673bf7a0cd27e86 (patch)
tree1cdcb97e27cbeff24a389f9028beddc520a7468e
parent84f362d8912657bb21250a65331f797d5381e9a3 (diff)
downloadllvm-e9e16a36d9ff355dab60e4b95673bf7a0cd27e86.tar.gz
llvm-e9e16a36d9ff355dab60e4b95673bf7a0cd27e86.tar.bz2
llvm-e9e16a36d9ff355dab60e4b95673bf7a0cd27e86.tar.xz
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
-rw-r--r--lib/Target/X86/AsmParser/X86AsmParser.cpp10
-rw-r--r--test/MC/AsmParser/X86/x86_instructions.s11
2 files changed, 20 insertions, 1 deletions
diff --git a/lib/Target/X86/AsmParser/X86AsmParser.cpp b/lib/Target/X86/AsmParser/X86AsmParser.cpp
index 7098c58cde..4856cc9283 100644
--- a/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ b/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -813,7 +813,7 @@ ParseInstruction(StringRef Name, SMLoc NameLoc,
if (getLexer().is(AsmToken::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>".
if ((Name.startswith("shr") || Name.startswith("sar") ||
Name.startswith("shl")) &&
@@ -825,6 +825,14 @@ ParseInstruction(StringRef Name, SMLoc NameLoc,
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
// "inb <op>, %al".
diff --git a/test/MC/AsmParser/X86/x86_instructions.s b/test/MC/AsmParser/X86/x86_instructions.s
index 4faf2e55fe..3bd2a30504 100644
--- a/test/MC/AsmParser/X86/x86_instructions.s
+++ b/test/MC/AsmParser/X86/x86_instructions.s
@@ -257,3 +257,14 @@ fnstsw
fnstsw %ax
fnstsw %eax
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