Signed Conditional Jump Instructions 

Signed conditional jump instructions are used to test signed numbers. Signed numbers use 2's complement representation.

Note that equal and not equal comparisons are the same for signed and unsigned numbers and are based on the Zero flag (ZF).

The following table shows all possible conditional jump instructions for signed number comparisons. The table also shows when a jump is taken based on the status flags.

Instruction Equivalent Description (Jump If) Condition
JG JNLE greater (not less or equal) SF = OF and ZF=0
JGE JNL greater or equal (not less) SF = OF
JL JNGE less (not greater or equal) SF <> OF
JLE JNG less than or equal (not greater) SF <> OF or ZF = 1
JE JZ equal ZF = 1
JNE JNZ not equal ZF = 0

The next table shows a set of two numbers n1, n2 and the result of executing the instruction CMP n1, n2 on the flags ZF, OF, SF.

n1 n2 ZF OF SF
56 55 0 0 0
56 -55 0 0 0
-55 -56 0 0 0
55 -75 0 1 1
55 55 1 0 0
55 56 0 0 1
-55 56 0 0 1
-56 -55 0 0 1
-57 55 0 1 0

It can observed from the above table that when n1 is greater than n2, the OF is equal to the SF. Also, it can be observed that when n1 is smaller than n2 the OF is not equal to the SF. However, it can be observed that when the two numbers are equal, the OF is also equal to the SF. Thus, the condition for checking whether n1 is greater than n2 is that the OF is equal to the SF and that the ZF=0. On the other hand, it is sufficient to check that the OF is not equal to the SF to know that n1 is smaller than n2.