Compare and Jump
A compare is a subtract that does not store its results; however, the results set the condition code register, which can then be tested by jump instructions.
cmpl | S,D | compare D - S , set condition , integer | ||
cmpq | S,D | compare D - S , set condition , pointer | ||
comisd | S,D | compare D - S , set condition , float | ||
Condition code bits:
C | Carry |
O | Overflow |
< | < 0 |
= | = 0 |
> | > 0 |
The jump instructions test the condition code:
jmp | Jump always. |
jle | Jump if D ≤ S |
je | Jump if D = S |
jne | Jump if D ≠ S |
jge | Jump if D ≥ S |
jl | Jump if D < S |
jg | Jump if D > S |