MC/X86: Add temporary hack to match shrl $1,%eax correctly, to support testing
authorDaniel Dunbar <daniel@zuster.org>
Sat, 13 Mar 2010 00:47:29 +0000 (00:47 +0000)
committerDaniel Dunbar <daniel@zuster.org>
Sat, 13 Mar 2010 00:47:29 +0000 (00:47 +0000)
other functionality on 403.gcc compiled at -O0.

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

lib/Target/X86/AsmParser/X86AsmParser.cpp
test/MC/AsmParser/X86/x86_32-new-encoder.s

index 84d7bb7a6f3c3065c8cd6234663e470ee1628863..dde86fbbe4403a347b0d08f6cd3829c40609ed3a 100644 (file)
@@ -542,6 +542,15 @@ ParseInstruction(const StringRef &Name, SMLoc NameLoc,
     }
   }
 
+  // FIXME: Hack to handle recognizing s{hr,ar,hl}? $1.
+  if ((Name.startswith("shr") || Name.startswith("sar") ||
+       Name.startswith("shl")) &&
+      Operands.size() == 3 &&
+      static_cast<X86Operand*>(Operands[1])->isImm() &&
+      isa<MCConstantExpr>(static_cast<X86Operand*>(Operands[1])->getImm()) &&
+      cast<MCConstantExpr>(static_cast<X86Operand*>(Operands[1])->getImm())->getValue() == 1)
+    Operands.erase(Operands.begin() + 1);
+
   return false;
 }
 
index d4e3be4bd28fea9de4a379bcc477a0ecbb60d289..c00007fd168b761bd70de14944c9586ebb284756 100644 (file)
@@ -47,3 +47,6 @@ rdtscp
 
 // CHECK: addw %ax, %ax                # encoding: [0x66,0x01,0xc0]
         addw %ax, %ax
+
+// CHECK: shrl %eax                    # encoding: [0xd1,0xe8]
+        shrl $1, %eax