I'm so confused about conditional branch while I was studying x86-64.
compq %rax,%rdi
jl .L2
Which one is the correct understanding?
- if %rax < %rdi, jump to L2
- if %rax > %rdi, jump to L2
I'm so confused about conditional branch while I was studying x86-64.
compq %rax,%rdi
jl .L2
Which one is the correct understanding?
Copyright © 2021 Jogjafile Inc.
There's no
compq
in x86-64. There's CMP which will becmpq
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
andsub
Jcc instructions always compare the first operand with the second one. In this case it'll jump when rdi < rax