Converting MSVC to intel-style gcc inline assembly

Matthew Tippett matthew.tippett@sympatico.ca
Sat Mar 6 06:06:00 GMT 2004


Hello,

I have a body of code that is needed to be ported over from Windows 
to Linux.  There is a reasonable amount of MSVC inline assembly that 
needs to be ported as well.

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 
work, could probably port script a converter for compile time, but I 
would also probably have something like

#ifdef LINUX
	:
	: "g" (input)
#endif

And also define

ASM_START and ASM_END as macros to simplify a lot of the work.

It seems to be a common issue that I was wondering if anyone has 
written scripts to simplify porting.

Regards,

Matthew



More information about the Gcc mailing list