Suppose that there are two 4-bit registers, RAX and RBX. As we all know, add and cmp instructions set the eflags register.

Toggle the slider below to see what register values produce what flags.

Register RAX

0 (0000)

Register RBX

0 (0000)

add rax rbx

0 (0000)

cmp rax rbx

  • Overflow flag: 0
  • Carry flag: 0
  • Zero flag: 1
  • Sign flag: 0

Signed jumps

  • Jump if less (jl/jnge): false
  • Jump if less or equal (jle/jng): true
  • Jump if greater (jg/jnle): false
  • Jump if greater or equal (jge/jnl): true

Unsigned jumps

  • Jump if below / jump carry (jb/jnae/jc): false
  • Jump if below or equal (jbe/jna): true

Misc Jumps

  • Jump if overflow (jo): false
  • Jump if sign (js): false
  • Jump if equal/zero (je/jz): true
  • Jump if parity even (jp/jpe): true

Note: not all the flags are shown, only the ones affected by add/cmp instructions

More on this topic:

  1. Notes on carry vs overflow flags
  2. SO post on jumps after cmp