This is an archive of the discontinued LLVM Phabricator instance.

add .intel_syntax noprefix print to llvm
ClosedPublic

Authored by m_zuckerman on Jul 15 2015, 8:55 AM.

Details

Summary

This for printing .intel_syntax noprefix.
In clang there is two type of print asm by at&t and intel_syntax.
clang support the intel_syntax without the print directive .
Now clang print to asm file directive

Diff Detail

Repository
rL LLVM

Event Timeline

m_zuckerman retitled this revision from to add .intel_syntax noprefix print to llvm .
m_zuckerman updated this object.
m_zuckerman changed the visibility from "Public (No Login Required)" to "All Users".
compnerd edited edge metadata.Jul 15 2015, 10:16 AM

The directive is "intel_syntax", not "intel_syntax noprefix". noprefix is an optional argument.

The intel and AT&T formats aren't clang specific. Both of them are pretty common x86 conventions. Intel is the one that intel defined, and AT&T is the one that GNU uses. The former is the standard, the latter is needed for compatibility with GCC, and so clang needs both. I think that the commit message is somewhat misleading.

lib/MC/MCAsmStreamer.cpp
485 ↗(On Diff #29786)

Can you add a FIXME here indicating that we currently emit unprefix'ed registers, and that this should be controllable? The intel_syntax directive has 1 optional argument which may have a value of prefix or noprefix indicating whether registers have the % prefix or not.

lib/MC/MCStreamer.cpp
469 ↗(On Diff #29786)

Missing space between ) and {. Perhaps you should clang-format the diff?

lib/Target/X86/X86AsmPrinter.cpp
67 ↗(On Diff #29786)

Can't the EmitSyntaxDirective invocation be hoisted? Why emit the intel_syntax directive after each function header?

test/MC/X86/intel-syntax-print.ll
1 ↗(On Diff #29786)

How about a negative test case? Something along the lines of:

; RUN: llc -x86-asm-syntax=gnu %s | FileCheck -check-prefix CHECK-GNU %s

; CHECK-GNU-NOT: .intel_syntax

2 ↗(On Diff #29786)

A newline before this line would be nice.

7 ↗(On Diff #29786)

I think you could further simplify the test case:

define i32 @test() {
entry:
  ret i32 0
}

You are just interested in the syntax header being present.

m_zuckerman edited edge metadata.
m_zuckerman changed the visibility from "All Users" to "Public (No Login Required)".
m_zuckerman marked 3 inline comments as done.
compnerd accepted this revision.Jul 20 2015, 4:00 PM
compnerd edited edge metadata.

Merge the two tests into a single file. You can have multiple RUN commands in a single file. You can also pass -check-prefix parameters to check to ensure that the checks don't get mixed up. Looks good otherwise.

This revision is now accepted and ready to land.Jul 20 2015, 4:00 PM
This revision was automatically updated to reflect the committed changes.