I'm so confused about conditional branch while I was studying x86-64.
compq %rax,%rdi
jl .L2
Which one is the correct understanding?
There's no compq
in x86-64. There's CMP which will be cmpq
when comparing 64-bit operands in AT&T syntax.
It'll be clearer when using Intel syntax, because AT&T swaps the destination and source which will be more confusing on instructions like cmp
and sub
cmp rdi, rax
jl .L2
Jcc instructions always compare the first operand with the second one. In this case it'll jump when rdi < rax