The difference between cmpl and cmp
According to my understanding
cmpl
compares unsigned.
It does both, in a way.
The difference in signed vs. unsigned is here the usage of the jump instructions.
For >
, there is ja
for unsigned and jg
for signed (jump if above and jump if greater).
For <
, there is jb
for unsigned and jl
for signed (jump if below and jump if less).
To be exact, here is the meaning of several jump commands:
For unsigned comparisons:
JB/JNAE (CF = 1) : Jump if below/not above or equal JAE/JNB (CF = 0) : Jump if above or equal/not below JBE/JNA (CF = 1 or ZF = 1) : Jump if below or equal/not above JA/JNBE (CF = 0 and ZF = 0): Jump if above/not below or equal
For signed comparisons:
JL/JNGE (SF <> OF) : Jump if less/not greater or equal JGE/JNL (SF = OF) : Jump if greater or equal/not less JLE/JNG (ZF = 1 or SF <> OF): Jump if less or equal/not greater JG/JNLE (ZF = 0 and SF = OF): Jump if greater/not less or equal
Just to add one extra detail for clarification to @glglgl's excellent answer is that the "l" in "cmpl" is an operation suffix indicating that the operation is being done on a long number (32 bit integer or 64-bit floating point).