This is the mail archive of the gcc@gcc.gnu.org mailing list for the GCC project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: Converting MSVC to intel-style gcc inline assembly


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


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]