Skip to content

movabs incorrect? #108

@mlgiraud

Description

@mlgiraud

Hi, im currently writing a jit compiler and need to load a 64 bit immediate value into a register. The only way to do this in one instruction afaik is by using the mov encoding movabs rax, imm64. This however currently emits code that should correspond to something like movabs rax, [imm64], i.e. it tries to load from the immediate address. These encodings exist, but should be generated when writing movabs rax, [imm64] imho.

The language spec in the documentation says:

movabs al, imm64
movabs ax, imm64
movabs eax, imm64
movabs imm64, al
movabs imm64, ax
movabs imm64, eax
movabs imm64, rax
movabs rax, imm64

Which should probably be

movabs al, [imm64]
movabs ax, [imm64]
movabs eax, [imm64]
movabs [imm64], al
movabs [imm64], ax
movabs [imm64], eax
movabs [imm64], rax
movabs rax, [imm64]

movabs reg64, imm64 <---- This is missing

The spec in the documentation says that mov reg64, imm64 can be used, but this results in an error (or the truncation of imm64 to a 32 bit value if you leave the type up to the compiler with as _).
I think this should be moved to movabs reg64, imm64.

EDIT: So i misinterpreted the spec, and it actually is possible to encode movabs reg64, imm64 by providing mov rax, QWORD immediate as _, but i think the syntax should be corrected to align with other assembly tools.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions