aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Dunbar <daniel@zuster.org>2010-08-24 19:37:56 +0000
committerDaniel Dunbar <daniel@zuster.org>2010-08-24 19:37:56 +0000
commitfba88d49e3fbb68bb84c295a9639fe94f9a8c6aa (patch)
tree8e72bc8cb9a5c5c8c172bcd24833b1f2878a0bea
parente422d1b16238ad4d9d7ef3b074715e795ab3ddc0 (diff)
downloadexternal_llvm-fba88d49e3fbb68bb84c295a9639fe94f9a8c6aa.zip
external_llvm-fba88d49e3fbb68bb84c295a9639fe94f9a8c6aa.tar.gz
external_llvm-fba88d49e3fbb68bb84c295a9639fe94f9a8c6aa.tar.bz2
MC/X86: Tweak imul recognition, previous hack only applies for the imul form
taking immediates. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111950 91177308-0d34-0410-b5e6-96231b3b80d8
-rw-r--r--lib/Target/X86/AsmParser/X86AsmParser.cpp4
-rw-r--r--test/MC/AsmParser/X86/x86_instructions.s3
2 files changed, 6 insertions, 1 deletions
diff --git a/lib/Target/X86/AsmParser/X86AsmParser.cpp b/lib/Target/X86/AsmParser/X86AsmParser.cpp
index 3f10b8e..b4542a0 100644
--- a/lib/Target/X86/AsmParser/X86AsmParser.cpp
+++ b/lib/Target/X86/AsmParser/X86AsmParser.cpp
@@ -826,8 +826,10 @@ ParseInstruction(StringRef Name, SMLoc NameLoc,
Operands.erase(Operands.begin() + 2);
}
- // FIXME: Hack to handle "imul A, B" which is an alias for "imul A, B, B".
+ // FIXME: Hack to handle "imul <imm>, B" which is an alias for "imul <imm>, B,
+ // B".
if (Name.startswith("imul") && Operands.size() == 3 &&
+ static_cast<X86Operand*>(Operands[1])->isImm() &&
static_cast<X86Operand*>(Operands.back())->isReg()) {
X86Operand *Op = static_cast<X86Operand*>(Operands.back());
Operands.push_back(X86Operand::CreateReg(Op->getReg(), Op->getStartLoc(),
diff --git a/test/MC/AsmParser/X86/x86_instructions.s b/test/MC/AsmParser/X86/x86_instructions.s
index eed69e0..5d7fff9 100644
--- a/test/MC/AsmParser/X86/x86_instructions.s
+++ b/test/MC/AsmParser/X86/x86_instructions.s
@@ -161,3 +161,6 @@ movaps %xmm3, (%esi, 2)
// CHECK: imull $12, %eax, %eax
imul $12, %eax
+
+// CHECK: imull %ecx, %eax
+imull %ecx, %eax