Converting MSVC to intel-style gcc inline assembly
Matthew Tippett
matthew.tippett@sympatico.ca
Sat Mar 6 15:31:00 GMT 2004
Thanks, that makes a perl script just that little bit more possible.
I can't force others to move from MSVC assembly, but I should be
able to get people to have/maintain comments like ;; clobber-eax.
If that is necessary. Variable names can be tweaked slightly as
well in_varname and out_varname can provide input on to which
variables are input and output.
Thanks a lot!
Regards,
Matthew
Andi Kleen wrote:
> 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
>
>
More information about the Gcc
mailing list