Re: Feature Request: Add Intel/NASM Syntax Option for Inline Assembly

Xi Ruoyao via Gcc-help <[email protected]> Tue, 16 Dec 2025 09:33:57 +0800
Newsgroups gmane.comp.gcc.help
Message-ID <[email protected]>
On Mon, 2025-12-15 at 17:42 -0500, Tadeo The rocket builder via Gcc-help wrote:
> Hello GCC Team,
> 
> The inline assembly keyword (__asm__) currently uses AT&T syntax. However,
> many developers (including myself) are more familiar with Intel/NASM
> syntax, especially when developing operating systems and low-level code.
> 
> Would it be possible to add support for Intel syntax in inline assembly?

Use -masm=intel to compile your code.

    asm("add %0, %1":"+r"(x):"m"(y));

With -masm=intel this is compiled to something like

    add eax, DWORD PTR 4[rsp]

-- 
Xi Ruoyao <[email protected]>