Quiz Entry - updated: 2026.07.14
What are the single-operand arithmetic instructions in x86-64?
They modify one operand in place: inc (+1), dec (−1), neg (two's-complement negate), and not (bitwise complement).
These are compact, common operations on a single value:
| Instruction | Effect |
|---|---|
inc D |
D ← D + 1 |
dec D |
D ← D − 1 |
neg D |
D ← −D (two's complement) |
not D |
D ← ~D (flip every bit) |
incq %rax # rax++
decl (%rbx) # (*rbx)-- on a 32-bit value in memory
negq %rcx # rcx = -rcx
notl %edx # edx = ~edx
The important gotcha: inc and dec deliberately do not set the carry flag (CF), unlike add $1 and sub $1. This was chosen so a loop can increment a counter without disturbing a carry that a surrounding multi-precision computation depends on — but it means you can't use inc/dec when you actually need the carry out.
Go deeper:
Felix Cloutier — INC — INC and the crucial CF-preservation gotcha.
Felix Cloutier — NEG — NEG two's-complement negate.