# `movbe`

[x86-64 Documentation](https://asm-editor.specy.app/documentation/x86.md) › [Instructions](https://asm-editor.specy.app/documentation/x86/instruction.md)

Web page: https://asm-editor.specy.app/documentation/x86/instruction/movbe

**Move data after swapping bytes**

Category: Data movement

Moves data between a register and memory, reversing the byte order as it is copied.

Atom, and Haswell and later

[Intel's reference: MOVBE](https://intel.github.io/SDM/instruction/MOVBE.html)

## Flags

| Flag | Effect |
| --- | --- |
| CF | not changed |
| PF | not changed |
| AF | not changed |
| ZF | not changed |
| SF | not changed |
| DF | not changed |
| OF | not changed |

## Forms

- `movbe reg, mem` (16, 32, 64)
  - `movbe reg16, mem16`
  - `movbe reg32, mem32`
  - `movbe reg64, mem64`
- `movbe mem, reg` (16, 32, 64)
  - `movbe mem16, reg16`
  - `movbe mem32, reg32`
  - `movbe mem64, reg64`

## Operands

- `reg`: A general-purpose register matching the operation’s size, for example `al`, `ax`, `eax` or `rax`.
- `mem`: A memory location addressed with square brackets, for example `[rbx+8]` or `[label]`.

## Example

```x86
global _start

section .data
value: dq 7

section .text
_start:
        mov rax, 12
        mov rbx, 5
        mov rcx, 3
        mov rsi, 9

        movbe rax, [value]

        mov rax, 60         ; syscall 60: exit
        xor rdi, rdi
        syscall
```
