JS
will jump if the sign flag is set (by an earlier instruction). CMP will always modify the flags by performing a subtraction, in this case %cl - %al
.
(This is AT&T syntax, so cmp %cl, %al
is the same as Intel syntax cmp al, cl
)
Because of the operand-size of the instructions, the sign will be bit 7 of the expression %cl-%al
(which is thrown away; EFLAGS is updated just like sub
, but not al
.)
If al == 0
, then the temporary value will be cl
exactly and the sign will be the sign of the register cl
. Thus a jump is taken if cl
is negative.
Here's a reference for all the conditional jumps.