Re: AT&T or Intel syntax ?
- From: Gil Hamilton <spamtrap@xxxxxxxxxx>
- Date: Mon, 18 Jun 2007 20:38:42 +0200 (CEST)
"T.M. Sommers" <tms@xxxxxx> wrote in
news:467051a6$0$17989$470ef3ce@xxxxxxxxxxx:
Gil Hamilton wrote:
Regardless of your view of this fundamentally religious question, I
maintain that the application of "AT&T syntax" to the Intel
instruction set was and is brain-damaged.
Consider this code in Intel format and then the equivalent code in
AT&T:
cmp eax, ebx # Intel
jl somelabel
cmpl %ebx, %eax # AT&T
jl somelabel
The Intel format is easily parsed by a human reader as "compare eax
to ebx and jump to somelabel if eax is less than ebx". The same code
in AT&T syntax OTOH must be interpreted as "compare ebx to eax and
jump to somelabel if *eax* is less than *ebx*". That is, you the
reader must remember to transpose the operands in your head. While
one can obviously learn to do this eventually, it's still a bad idea;
it essentially breaks the mnemonic value of the "jl" instruction (and
others like it).
You have picked just about the only case in which AT&T syntax
suffers in comparison to Intel's. It could have been fixed by
adjusting the condition codes, but that probably would have been
too confusing.
Yes, that would have made it even worse.
IMO, the original imposition of "AT&T syntax" on the Intel platform
was simply arrogance on the part of the gnu folks who thought at the
time that the Intel 8086/286/386/etc. was a junky piece of crap
compared to other more "elegant" architectures of the time like the
Motorola 68000 family. ("And, see, we can make it look almost like a
real machine if we redesign their stupid assembly language for
them.")
While the GNU people certainly did disdain the Intel chips, it
was not necessarily arrogance that led to the decision. Unix did
exist on Intel chips already, such as Xenix, Microport, Coherent,
etc. What syntax did their assemblers use?
A very good point. I used to work on some of these but I really don't
remember. I know that the version of SCO Xenix I worked on had a version
of masm on it that I used for a lot of work -- and obviously it used the
Intel syntax -- but I don't recall whether the C compiler used that (or
whether it even provided an intermediate assembly output).
GH
.
- References:
- AT&T or Intel syntax ?
- From: psr
- Re: AT&T or Intel syntax ?
- From: Frank Kotler
- Re: AT&T or Intel syntax ?
- From: Zeljko Vrba
- Re: AT&T or Intel syntax ?
- From: Gil Hamilton
- Re: AT&T or Intel syntax ?
- From: T.M. Sommers
- AT&T or Intel syntax ?
- Prev by Date: Re: AT&T or Intel syntax ?
- Next by Date: Re: AT&T or Intel syntax ?
- Previous by thread: Re: AT&T or Intel syntax ?
- Next by thread: Re: AT&T or Intel syntax ?
- Index(es):
Relevant Pages
|