movbe
Move Big-Endian
Moves data swapping bytes (Big Endian load/store).
Pseudocode Operation
if (dest is register) {
dest ← byte_reverse(src);
} else {
[dest] ← byte_reverse(src);
}
Example
Encoding
Operands
-
dest
General-purpose register -
src
Memory operand
Related
More in MOVBE
Reference
Instruction Forms
| Opcode | Instruction | Op/En | 64/32-bit Mode | CPUID | Description |
|---|---|---|---|---|---|
| 0F 38 F0 /r | MOVBE | RM | V/V | Reverse byte order in m16 and move to r16. MOVBE r16, m16 | |
| 0F 38 F0 /r | MOVBE | RM | V/V | Reverse byte order in m32 and move to r32. MOVBE r32, m32 | |
| REX.W + 0F 38 F0 /r | MOVBE | RM | V/N.E. | Reverse byte order in m64 and move to r64. MOVBE r64, m64 | |
| 0F 38 F1 /r | MOVBE | MR | V/V | Reverse byte order in r16 and move to m16. MOVBE m16, r16 | |
| 0F 38 F1 /r | MOVBE | MR | V/V | Reverse byte order in r32 and move to m32. MOVBE m32, r32 | |
| REX.W + 0F 38 F1 /r | MOVBE | MR | V/N.E. | Reverse byte order in r64 and move to m64. MOVBE m64, r64 |
Description
Performs a byte swap operation on the data copied from the second operand (source operand) and store the result in the first operand (destination operand). The source operand can be a general-purpose register, or memory location; the destination register can be a general-purpose register, or a memory location; however, both operands can not be registers, and only one operand can be a memory location. Both operands must be the same size, which can be a word, a doubleword or quadword. The MOVBE instruction is provided for swapping the bytes on a read from memory or on a write to memory; thus providing support for converting little-endian values to big-endian format and vice versa. In 64-bit mode, the instruction's default operation size is 32 bits. Use of the REX.R prefix permits access to additional registers (R8-R15). Use of the REX.W prefix promotes operation to 64 bits. See the summary chart at the beginning of this section for encoding data and limits.
Operation
TEMP := SRC IF ( OperandSize = 16) THEN DEST[7:0] := TEMP[15:8]; DEST[15:8] := TEMP[7:0]; ELES IF ( OperandSize = 32) DEST[7:0] := TEMP[31:24]; DEST[15:8] := TEMP[23:16]; DEST[23:16] := TEMP[15:8]; DEST[31:23] := TEMP[7:0]; ELSE IF ( OperandSize = 64) DEST[7:0] := TEMP[63:56]; DEST[15:8] := TEMP[55:48]; DEST[23:16] := TEMP[47:40]; DEST[31:24] := TEMP[39:32]; DEST[39:32] := TEMP[31:24]; DEST[47:40] := TEMP[23:16]; DEST[55:48] := TEMP[15:8]; DEST[63:56] := TEMP[7:0]; FI;