Skip to content

"--emit asm" uses different syntax than asm! on x86 #121592

Open
@RalfJung

Description

@RalfJung

Rust inline assembly expects to be written like this:

    crate::arch::asm!(
        "movntps [{mem_addr}], {a}",
        mem_addr = in(reg) mem_addr,
        a = in(xmm_reg) a,
    );

However, when dumping the output assembly via --emit asm, it looks like this:

	movntps	%xmm0, (%rdi)

Operand order is swapped, and it's using (%name) instead of [name]. I guess one is AT&T syntax and one is Intel syntax.

Would be good if Rust could be consistent with its own inline asm syntax. :)

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-contributor-roadblockArea: Makes things more difficult for new or seasoned contributors to RustA-inline-assemblyArea: Inline assembly (`asm!(…)`)C-enhancementCategory: An issue proposing an enhancement or a PR with one.T-compilerRelevant to the compiler team, which will review and decide on the PR/issue.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions