3 ms·
IMHO the most confusing part is that AT&T/GAS syntax inverts the comparisons, which are otherwise natural in Intel syntax: cmp eax, ebx ; eax ? ebx j
by userbinator 4y ago
IMHO the most confusing part is that AT&T/GAS syntax inverts the comparisons, which are otherwise natural in Intel syntax:
cmp eax, ebx ; eax ? ebx
jg foo ; jump if eax > ebx
Related: http://x86asm.net/articles/what-i-dislike-about-gas/ http://x86asm.net/articles/what-i-dislike-about-gas/
- mrjin 4y agoAlso the % before register names is completely unnecessary, it just another extra character to type.
- deleted 4y ago[deleted]
- rwmj 4y agoIt disambiguates labels from registers, assuming of course you allow labels to have register names. eg this is valid: mov rax,%rax rax: .ascii "hello\0" Stupid perhaps, but valid.
- jck 4y agoI wonder if it would have been more ergonomic to have the labels be % prefixed instead of registers.
- int_19h 4y agoThe above-linked article specifically points out that registers are referenced much more often than labels.
- userbinator 4y agoProbably an artifact of the original use of the assembler being to process compiler output, and causing variable names to appear. One of the x86 assemblers I remember trying out in the late 80s had a slight variant of Intel syntax in that everything that wasn't a reserved word/mnemonic was automatically assumed to be a label.
- professoretc 4y agoYep, the "nice" thing about AT&T is that, from a parsing perspective, you don't really need to know much about the target architecture to be able to determine what's an instruction vs. a register vs. a label, etc.