This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: -masm=intel examples
- From: Andi Kleen <ak at muc dot de>
- To: dewar at gnat dot com (Robert Dewar)
- Cc: llewelly at xmission dot com, gcc at gcc dot gnu dot org, marpet at naex dot sk
- Date: Sat, 15 May 2004 21:51:36 +0200
- Subject: Re: -masm=intel examples
- References: <20040515142130.739DCF2BFB@nile.gnat.com>
dewar@gnat.com (Robert Dewar) writes:
>
> But it is a fair amount of work to implement this.
>
> In fact for teaching using GCC, it would be really nice to have
> this syntax available for ASM insertions.
Using Intel syntax in asm should already work with some restrictions.
Use something like:
asm(".intel_syntax\n"
"code in intel syntax\n"
".att_syntax");
The only problem is that when you use %NUMBER insertions then
the compiler will still use at&t style operands (e.g. % before
registers). This could be avoided by always using absolute registers
as input and output arguments. Of course this will not generate
the best code that you can get with more flexible asm.
> Are there any text books (suitable for teaching from) that use
> AT&T syntax for Intel?
I am not aware of text books, but there is plenty of online
documentation for assembly programming under linux. This often
uses AT&T syntax. http://www.linuxassembly.org may be a good start.
-Andi