What does JL mean in at&t syntax?

3.6k views Asked by At

I'm working on a project for school and I cannot find anything on the what JL means in at&t syntax. For reference, the question is to find the value of %eax when NOP runs. Here is the code it's used in:

MOV $492,%ebx
MOV $2494,%eax
MOV $28063,%ecx
CMP %eax,%ebx
JL L1
JMP L2
L1:
IMUL %eax,%ebx
ADD %eax,%ebx
MOV %ebx,%eax
SUB %ecx,%eax
JMP L3
L2:
IMUL %eax,%ebx
SUB %eax,%ebx
MOV %ebx,%eax
ADD %ecx,%eax
L3:
NOP

Also I would appreciate what JMP does as well as how the addition/subtraction/multiplication works (ADD/SUB/IMUL). I don't want to cheat, I just want to understand what's happening. For example, do you change the first number or the second when using math? Thank you all so much for helping.

3

There are 3 answers

5
Caffeinated On BEST ANSWER

That is assemply language , JL is Jump if Less

This also works in x86 assembly language.

 CMP %eax,%ebx 
 JL L1

We compare EAX to EBX, then we'll jump to L1 depending on that comparison.

More specific - If the contents of EAX are less than the contents of EBX, jump to the label L1

See - Assembly - JG/JNLE/JL/JNGE after CMP

0
incogn1to On

jl (jump on less than, signed) wiki

0
Pedro On

In AT&T syntax, the operands are in the opposite order vs. Intel syntax. So when looking at the cmp, you should read right to left for the mnemonic to match up with the meaning.

CMP %eax,%ebx
JL L1

That code interpreted in AT&T syntax: "If the contents of EBX are less than the contents of EAX, jump to the label L1".

(An older accepted answer got this wrong.)

Assembly - JG/JNLE/JL/JNGE after CMP explains all of x86's FLAGS conditions you can branch on (or setcc or cmovcc). That Q&A uses Intel syntax, where reading cmp operands left-to-right corresponds to the semantic meaning of the conditions. (See also an HTML scrape of Intel's actual PDF manual for jcc, and further docs linked in the x86 tag wiki)