1

On page 3-431 of the Intel instruction set reference, two different instructions are mentioned:

7C cb  JL rel8   Jump short if less (SF ≠ OF).
7C cb  JNGE rel8 Jump short if not greater or equal (SF ≠ OF).

What is the reasoning behind having two names for the same instruction? Is there any instance where it matters whether I use JL or JNGE?

phihag
  • 278,196
  • 72
  • 453
  • 469
  • I doubt it matters as the assembler will produce the same machine code for both, therefore logically the exact same effect. Interesting quirk though – geedubb Jun 04 '14 at 15:32
  • @geedubb Well, *my* and *your* assembler produce the same result, but maybe some assembler didn't? – phihag Jun 04 '14 at 15:35
  • @HansPassant `JL` is the same as `JNGE`, both are signed. You might be thinking of `JB` and `JNAE` which are the unsigned counterparts. – Jester Jun 04 '14 at 15:37
  • 1
    @phihag that would be a broken assember then! – geedubb Jun 05 '14 at 05:56

1 Answers1

6

It's just to make code more readable in case one or the other matches your intention better. As you quoted, the machine code is the same, and ultimately that's what the processor will execute. As such, it won't know whether you used JL or JNGE. All the relations have their negated name too.

There are other duplicates that illustrate the readability point a little better, for example JE and JZ. You'd normally use JE after a comparison, and JZ otherwise. Similarly you have JB and JC.

Jester
  • 56,577
  • 4
  • 81
  • 125