Index: lib/Target/X86/AsmParser/X86AsmParser.cpp =================================================================== --- lib/Target/X86/AsmParser/X86AsmParser.cpp +++ lib/Target/X86/AsmParser/X86AsmParser.cpp @@ -1383,6 +1383,7 @@ if (ParseIntelDotOperator(SM, End)) return true; break; + case AsmToken::At: case AsmToken::String: case AsmToken::Identifier: { SMLoc IdentLoc = Tok.getLoc(); @@ -1390,7 +1391,7 @@ UpdateLocLex = false; // Register unsigned Reg; - if (Tok.isNot(AsmToken::String) && !ParseRegister(Reg, IdentLoc, End)) { + if (Tok.is(AsmToken::Identifier) && !ParseRegister(Reg, IdentLoc, End)) { if (SM.onRegister(Reg, ErrMsg)) return Error(Tok.getLoc(), ErrMsg); break; @@ -1428,6 +1429,9 @@ break; } // MS InlineAsm identifier + // Call parseIdentifier() to combine @ with the identifier behind it. + if (TK == AsmToken::At && Parser.parseIdentifier(Identifier)) + return Error(IdentLoc, "expected identifier"); if (ParseIntelInlineAsmIdentifier(Val, Identifier, Info, false, End)) return true; else if (SM.onIdentifierExpr(Val, Identifier, Info, true, ErrMsg)) Index: test/MC/COFF/tricky-names.ll =================================================================== --- test/MC/COFF/tricky-names.ll +++ test/MC/COFF/tricky-names.ll @@ -1,8 +1,11 @@ ; Check how tricky symbols are printed in the asm output. ; RUN: llc -mtriple=i686-pc-win32 %s -o - | FileCheck %s --check-prefix=ASM +; RUN: llc -mtriple=i686-pc-win32 %s -x86-asm-syntax=intel -o - | FileCheck %s --check-prefix=ASM -; Check that we can roundtrip these names through our assembler. +; Check that we can roundtrip these names through our assembler, +; in both at&t and intel syntax. ; RUN: llc -mtriple=i686-pc-win32 %s -o - | llvm-mc -triple i686-pc-win32 -filetype=obj | llvm-readobj -t | FileCheck %s --check-prefix=READOBJ +; RUN: llc -mtriple=i686-pc-win32 -x86-asm-syntax=intel %s -o - | llvm-mc -triple i686-pc-win32 -filetype=obj | llvm-readobj -t | FileCheck %s --check-prefix=READOBJ @"\01??__E_Generic_object@?$_Error_objects@H@std@@YAXXZ" = global i32 0