MC/X86: Tweak imul recognition, previous hack only applies for the imul form
authorDaniel Dunbar <daniel@zuster.org>
Tue, 24 Aug 2010 19:37:56 +0000 (19:37 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Tue, 24 Aug 2010 19:37:56 +0000 (19:37 +0000)
taking immediates.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@111950 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/AsmParser/X86AsmParser.cpp
test/MC/AsmParser/X86/x86_instructions.s

index 3f10b8e2f58f6266a88e0f1e08ca86841a818207..b4542a03aa98ce6a1183e9ce8ce29091544d161f 100644 (file)
@@ -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(),
index eed69e07d371deab1abe5a5ac3118029639d0cba..5d7fff9bbca47c3eb0dddd422069772a65ba4438 100644 (file)
@@ -161,3 +161,6 @@ movaps %xmm3, (%esi, 2)
 
 // CHECK: imull $12, %eax, %eax
 imul $12, %eax
+
+// CHECK: imull %ecx, %eax
+imull %ecx, %eax