[clang] [llvm] [AsmPrinter,X86] Hard code AT&T syntax input for module-level inline assembly for MSVC triples (PR #85668)

Nico Weber via llvm-commits llvm-commits at lists.llvm.org
Thu Mar 21 04:40:47 PDT 2024


nico wrote:

Looks like we could fix code on our end and this here isn't needed. But maybe the current behavior isn't 100% ideal.

Here's what I think the situation currently is (please correct me if I'm wrong):
* With clang-cl, you get intel assembly output by default with `/FA`. That's good.
* With clang, you get AT&T assembly output by default with `-S`, and intel assembly output with -masm=intel. That's good.
* With clang, the syntax for `asm()` is AT&T by default, and intel with -masm=intel. That's good.
* With clang-cl, `__asm { ... }` blocks always use Intel syntax. That's good.
* With clang-cl, the syntax for `asm()` is intel by default, and there's no way to change this. (This is now consistent between module-level assembly and function-local assembly. It's good that they're consistent, that's better than before.)

The last point seems suboptimal to me. cl.exe doesn't support `asm()`, only `__asm {}`. So users that use `asm()` with clang-cl probably want to share that code with other platforms where they use `asm()` too.

Ideally, clang-cl could use intel asm output by default, intel asm input for `__asm {}` blocks, but at&t style asm input for `asm()`. And ideally it could also offer a flag to opt in to intel style asm input for `asm()`. (And the pragma mentioned in https://reviews.llvm.org/D113707 might be nice too.)

Does that sound right?

(I'm not saying you have to do any of this! Just want to check if we agree on this assessment of the state of the world.)

https://github.com/llvm/llvm-project/pull/85668


More information about the llvm-commits mailing list