nop

No operation

Performs no operation, and execution continues with the next instruction.

8086 and later

CFPFAFZFSFDFOF –––––––
  • Leaves every flag unchanged

Forms

  • nop
Undocumented 1 row

Intel’s manual does not list these forms, but the processor runs them.

Operands

r/m
A general-purpose register or memory location matching the operation’s size, for example rax or qword [rbp-8].
imm
An immediate value: a constant written in the instruction as a number, a character or a label, for example 10, 0x1f, 'a' or msg. Open a row to see the size it has in each form, such as imm8 or imm32.
reg
A general-purpose register matching the operation’s size, for example al, ax, eax or rax.

The one-byte form is 90h, which 16- and 32-bit code also gets from xchg ax, ax or xchg eax, eax. In 64-bit mode 90h is always a true no-op, and NASM assembles xchg eax, eax as a real exchange that clears the upper half of rax, so that is not a NOP there. The longer nop r/m forms do nothing either; they pad code to an alignment in a single instruction.

global _start

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

        nop rax

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