Intel Syntax: Extend special hand coded logic, to recognize special instructions...
authorDevang Patel <dpatel@apple.com>
Tue, 24 Jan 2012 21:43:36 +0000 (21:43 +0000)
committerDevang Patel <dpatel@apple.com>
Tue, 24 Jan 2012 21:43:36 +0000 (21:43 +0000)
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@148864 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/AsmParser/X86AsmParser.cpp
test/MC/X86/intel-syntax-encoding.s

index d78ac9f1c7a0f98b9f213ed860b7884597986125..82732d8542e2ac0c731de0382cd48f61baa4a9bd 100644 (file)
@@ -1168,11 +1168,21 @@ ParseInstruction(StringRef Name, SMLoc NameLoc,
        Name.startswith("rcl") || Name.startswith("rcr") ||
        Name.startswith("rol") || Name.startswith("ror")) &&
       Operands.size() == 3) {
-    X86Operand *Op1 = static_cast<X86Operand*>(Operands[1]);
-    if (Op1->isImm() && isa<MCConstantExpr>(Op1->getImm()) &&
-        cast<MCConstantExpr>(Op1->getImm())->getValue() == 1) {
-      delete Operands[1];
-      Operands.erase(Operands.begin() + 1);
+    if (getParser().getAssemblerDialect()) {
+      // Intel syntax
+      X86Operand *Op1 = static_cast<X86Operand*>(Operands[2]);
+      if (Op1->isImm() && isa<MCConstantExpr>(Op1->getImm()) &&
+         cast<MCConstantExpr>(Op1->getImm())->getValue() == 1) {
+       delete Operands[2];
+       Operands.pop_back();
+      }
+    } else {
+      X86Operand *Op1 = static_cast<X86Operand*>(Operands[1]);
+      if (Op1->isImm() && isa<MCConstantExpr>(Op1->getImm()) &&
+         cast<MCConstantExpr>(Op1->getImm())->getValue() == 1) {
+       delete Operands[1];
+       Operands.erase(Operands.begin() + 1);
+      }
     }
   }
   
index efd7b6b66691aa4cdc9123f2c6f42200bc4ef343..3e7ad355f465128a7d4e01f93b2054068db14bc1 100644 (file)
@@ -36,3 +36,6 @@ LBB0_3:
        jmp     LBB0_3
 // CHECK: encoding: [0xf2,0x0f,0x10,0x2c,0x25,0xf8,0xff,0xff,0xff]
         movsd   XMM5, QWORD PTR [-8]
+
+// CHECK: encoding: [0xd1,0xe7]
+       shl     EDI, 1