Integer Arithmetic Instructions
These instructions operate on registers or memory. S,D represent source and destination.
| addl | S,D | D + S → D | ||
| subl | S,D | D - S → D | ||
| imull | S,D | D * S → D | ||
| ldiv | S,D | D / S → D | ||
| cmpl | S,D | compare D - S , set condition | ||
| andl | S,D | D ∧ S → D | ||
| orl | S,D | D ∨ S → D | ||
| notl | D | ¬ D → D | ||
| negl | D | - D → D | ||
Note that arithmetic can be done directly on memory:
i := i + 1 can be one instruction:
addl $1,-32(%rbp)