nop

No operation

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

8086 and later

CFPFAFZFSFDFOF –––––––
  • Changes no flag

Forms

  • nop
Undocumented 1 row

Left out of the processor's manual, but the processor and this emulator run them.

Operands

r/m
A general-purpose register or memory location matching the operation’s size, for example rax or qword [rbp-8]. The byte registers ah, bh, ch and dh cannot be used with a REX prefix, including when the memory address uses r8–r15.
imm
An immediate value encoded in the instruction, written as a number, character or label. Its encoded width and any sign extension depend on the instruction; arithmetic immediates may be sign-extended, while shift counts are used without sign extension.
reg
A general-purpose register matching the operation’s size, for example al, ax, eax or rax. The byte registers ah, bh, ch and dh cannot be used with a REX prefix, which is required by spl, bpl, sil, dil and r8–r15.

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