Skip to content

$1 in asm with only one operand silently chooses some arbitrary register #13370

Closed
@kmcallister

Description

@kmcallister
asm!("movups $1, %xmm0" : : "r"(0) : "xmm0");

produces

  406519:       0f 10 c0                movups %xmm0,%xmm0

And

asm!("xor $1, %rax" :: "r"(0));

gives

<inline asm>:1:2: error: unknown use of instruction mnemonic without a size suffix
        xor %flags, %rax
        ^
LLVM ERROR: Error parsing inline asm

Possibly it indexes into the clobbers list. If I add a "rax" clobber to the latter example, I get xor %rax, %rax.

rustc 0.10-pre (68a4f7d 2014-02-24 12:42:02 -0800)
host: x86_64-unknown-linux-gnu

Metadata

Metadata

Assignees

No one assigned

    Labels

    A-codegenArea: Code generationA-inline-assemblyArea: Inline assembly (`asm!(…)`)C-bugCategory: This is a bug.requires-nightlyThis issue requires a nightly compiler in some way.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions