Here is some assembly code in Intel syntax:
// Jump to done if rsi >= rax.
cmp rsi, rax
jae done
This makes sense to my brain: you jump if rsi is "above or equal to" rax,
matching the order of arguments in the cmp
instruction. Compare this to the
GNU syntax:
// Jump to done if rsi >= rax.
cmp %rax, %rsi
jae done
This hurts my brain every time. It doesn't help that when I come to this fresh
after awhile not writing assembly code I go to look up the semantics of cmp
and jae
in the Intel manual and find that it's all stated in terms of "first"
and "second" operand, which doesn't match what I'm seeing on the screen in
front of me.
End complaining. My questions:
Is there some other way to express
cmp
orjae
to the GNU assembler so that the order of operands tocmp
matches the logical comparison referred to byjae
?Assuming the answer to (1) is no, does anybody have a good way for me to look at this so that I can remember how it works next time? Anything better than "GNU does it backwards"?
Note that I'm not asking how to use Intel syntax with the GNU assembler; I'm aware that's possible. I'm working in an existing GNU syntax codebase, and am asking for some mnemonic or other way to help me keep this straight in my head.