This is the mail archive of the
gcc@gcc.gnu.org
mailing list for the GCC project.
Re: Converting MSVC to intel-style gcc inline assembly
- From: Andi Kleen <ak at muc dot de>
- To: Matthew Tippett <matthew dot tippett at sympatico dot ca>
- Cc: gcc at gcc dot gnu dot org
- Date: Thu, 11 Mar 2004 17:15:49 +0100
- Subject: Re: Converting MSVC to intel-style gcc inline assembly
- References: <40496A64.4030905@sympatico.ca>
Matthew Tippett <matthew.tippett@sympatico.ca> writes:
> Now, although i can handle coverting the body of code over, the
> parameter passing is going to cause some problems. Since the gcc
> supports intel style assembly, it simplifies it down to
>
> __asm { --> __asm__ (
> eax --> %%eax
>
> And so on, (which can be scripted), is there any easy way of
> automating the conversion from the inline variable use to the
> parameter syntax %1, %2, %3 that gcc requires. With a little bit of
Newer gcc supports named arguments:
asm("movl %[arg1],..." :: [arg1] "r" (argument1));
This may be easier to port and is in general less error prone. Also
note that gcc inline assembly has some unique quirks, like it's not
possible to clobber %ebp or the PIC register in -fPIC code. You just
get silently wrong code, but no error message in older gccs.
-Andi