OSDN Git Service

It's a fix for Bug 35741 - can't use comments after x86 prefixes.
authorAndrew V. Tischenko <andrew.v.tischenko@gmail.com>
Tue, 26 Dec 2017 18:29:52 +0000 (18:29 +0000)
committerAndrew V. Tischenko <andrew.v.tischenko@gmail.com>
Tue, 26 Dec 2017 18:29:52 +0000 (18:29 +0000)
Differential Revision: https://reviews.llvm.org/D41579

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

lib/Target/X86/AsmParser/X86AsmParser.cpp
test/MC/X86/x86-64.s

index 87c6534..f1ce430 100644 (file)
@@ -2377,10 +2377,11 @@ bool X86AsmParser::ParseInstruction(ParseInstructionInfo &Info, StringRef Name,
     Flags |= Prefix;
     Name = Parser.getTok().getString();
     Parser.Lex(); // eat the prefix
-    // Hack: we could have something like
+    // Hack: we could have something like "rep # some comment" or
     //    "lock; cmpxchg16b $1" or "lock\0A\09incl" or "lock/incl"
     while (Name.startswith(";") || Name.startswith("\n") ||
-           Name.startswith("\t") || Name.startswith("/")) {
+           Name.startswith("#") || Name.startswith("\t") ||
+           Name.startswith("/")) {
       Name = Parser.getTok().getString();
       Parser.Lex(); // go to next prefix or instr
     }
index b1e89cd..23846d9 100644 (file)
 // CHECK: shll $2, %eax
         sall $2, %eax
 
+// CHECK: rep movsb
+rep     # comment
+movsb
+
 // CHECK: rep
 // CHECK: insb
         rep;insb