Index: llvm/trunk/include/llvm/MC/MCStreamer.h =================================================================== --- llvm/trunk/include/llvm/MC/MCStreamer.h +++ llvm/trunk/include/llvm/MC/MCStreamer.h @@ -682,6 +682,8 @@ 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: llvm/trunk/lib/MC/MCAsmStreamer.cpp =================================================================== --- llvm/trunk/lib/MC/MCAsmStreamer.cpp +++ llvm/trunk/lib/MC/MCAsmStreamer.cpp @@ -78,6 +78,9 @@ } EmitCommentsAndEOL(); } + + virtual void EmitSyntaxDirective(); + void EmitCommentsAndEOL(); /// isVerboseAsm - Return true if this streamer supports verbose assembly at @@ -480,6 +483,14 @@ EmitEOL(); } +void MCAsmStreamer::EmitSyntaxDirective() { + if (MAI->getAssemblerDialect() == 1) + OS << "\t.intel_syntax noprefix\n"; + // FIXME: Currently emit unprefix'ed registers. + // The intel_syntax directive has one optional argument + // with may have a value of prefix or noprefix. +} + void MCAsmStreamer::BeginCOFFSymbolDef(const MCSymbol *Symbol) { OS << "\t.def\t "; Symbol->print(OS, MAI); Index: llvm/trunk/lib/MC/MCStreamer.cpp =================================================================== --- llvm/trunk/lib/MC/MCStreamer.cpp +++ llvm/trunk/lib/MC/MCStreamer.cpp @@ -467,6 +467,8 @@ report_fatal_error("Chained unwind areas can't have handlers!"); } +void MCStreamer::EmitSyntaxDirective() {} + void MCStreamer::EmitWinCFIPushReg(unsigned Register) { EnsureValidWinFrameInfo(); Index: llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp =================================================================== --- llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp +++ llvm/trunk/lib/Target/X86/X86AsmPrinter.cpp @@ -535,6 +535,7 @@ S, MCConstantExpr::create(int64_t(1), MMI->getContext())); } } + OutStreamer->EmitSyntaxDirective(); } static void Index: llvm/trunk/test/MC/X86/intel-syntax-print.ll =================================================================== --- llvm/trunk/test/MC/X86/intel-syntax-print.ll +++ llvm/trunk/test/MC/X86/intel-syntax-print.ll @@ -0,0 +1,9 @@ +; RUN: llc -x86-asm-syntax=intel < %s | FileCheck %s -check-prefix=INTEL +; RUN: llc -x86-asm-syntax=att < %s | FileCheck %s -check-prefix=ATT + +; INTEL: .intel_syntax noprefix +; ATT-NOT: .intel_syntax noprefix +define i32 @test() { +entry: + ret i32 0 +}