Index: include/llvm/MC/MCStreamer.h =================================================================== --- include/llvm/MC/MCStreamer.h +++ include/llvm/MC/MCStreamer.h @@ -682,6 +682,7 @@ virtual void EmitWinEHHandler(const MCSymbol *Sym, bool Unwind, bool Except); virtual void EmitWinEHHandlerData(); + virtual void EmitSyntaxDirective(); /// \brief Emit the given \p Instruction into the current section. virtual void EmitInstruction(const MCInst &Inst, const MCSubtargetInfo &STI); Index: lib/MC/MCAsmStreamer.cpp =================================================================== --- lib/MC/MCAsmStreamer.cpp +++ lib/MC/MCAsmStreamer.cpp @@ -78,6 +78,7 @@ } EmitCommentsAndEOL(); } + virtual void EmitSyntaxDirective(); void EmitCommentsAndEOL(); /// isVerboseAsm - Return true if this streamer supports verbose assembly at @@ -479,6 +480,10 @@ OS << ',' << DescValue; EmitEOL(); } +void MCAsmStreamer::EmitSyntaxDirective(){ + if (MAI->getAssemblerDialect() == 1) + OS << "\t.intel_syntax noprefix\n"; +} void MCAsmStreamer::BeginCOFFSymbolDef(const MCSymbol *Symbol) { OS << "\t.def\t "; Index: lib/MC/MCStreamer.cpp =================================================================== --- lib/MC/MCStreamer.cpp +++ lib/MC/MCStreamer.cpp @@ -466,7 +466,7 @@ if (CurrentWinFrameInfo->ChainedParent) report_fatal_error("Chained unwind areas can't have handlers!"); } - +void MCStreamer::EmitSyntaxDirective(){} void MCStreamer::EmitWinCFIPushReg(unsigned Register) { EnsureValidWinFrameInfo(); Index: lib/Target/X86/X86AsmPrinter.cpp =================================================================== --- lib/Target/X86/X86AsmPrinter.cpp +++ lib/Target/X86/X86AsmPrinter.cpp @@ -60,9 +60,11 @@ : COFF::IMAGE_SYM_CLASS_EXTERNAL); OutStreamer->EmitCOFFSymbolType(COFF::IMAGE_SYM_DTYPE_FUNCTION << COFF::SCT_COMPLEX_TYPE_SHIFT); + OutStreamer->EmitSyntaxDirective(); OutStreamer->EndCOFFSymbolDef(); } - + else + OutStreamer->EmitSyntaxDirective(); // Emit the rest of the function body. EmitFunctionBody(); Index: test/MC/X86/intel-syntax-print.ll =================================================================== --- test/MC/X86/intel-syntax-print.ll +++ test/MC/X86/intel-syntax-print.ll @@ -0,0 +1,8 @@ +; RUN: llc -x86-asm-syntax=intel < %s | FileCheck %s +; CHECK: .intel_syntax noprefix +define i32 @test(i32 %a) { +entry: +; CHECK-LABEL: test: + %tmp3 = mul i32 %a, 31 + ret i32 %tmp3 +}