Does Clang support Intel Assembly?

Does Clang support Intel Assembly ?

If not how hard would it be to add it to have compatibility with Visual Studio ?

I don’t know much about Intel assembly, but do you mean something like this:

@phoebe should know better about the assembly syntax support.

About VS, do you mean just syntax checking? This would probably be via some clangd support, right?

@sam-mccall should know better about clangd.

@echristo should know more about clang’s support for inline asm.

You can use -inline-asm=intel to accept Intel asm for inline asm statements and you can use -masm=intel to control the output assembly format used when outputting assembly.

@AaronNGray I guess the question is not about Intel assembly but MS flavor inline assembly, though the latter uses Intel assembly.
As shown in @rengolin 's example, you can use clang -fasm-blocks to specify it. Or you can simply use clang-cl, which supports it by default.

1 Like

Agreed with everyone here. Tagging @rnk as well since most of the support came from him :slight_smile:

There’s also .intel_syntax noprefix which you can put at the start of inline assembly to avoid messing up existing inline assembly (e.g. from a system intrinsics header).

Here’s an example in godbolt, showing some of the more interesting aspects of the support:

It’s not perfectly compatible with the Visual C++ compiler, and this is definitely a fragile feature. Clang supports this style of asm on x86_64, which MSVC notably does not.

@rnk et.al. Brilliant news, thank you very much this will make life much easier !