[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[pygame] Possible solution to embedded assembly code in transform.c
transform.c contains several i386 MMX optimized functions written in
inlined assembly code. They assembly code is formated for gcc. Visual C
can't use it, so falls back to pure C versions. Also, the inlined
sections comes in two flavors, 32bit and 64bit. This makes for ungainly
code. It would become even worse if SSE versions are added. So this is
my proposal.
Move the inlined assembly routines into their own C files for separate
compilation. Here's the remarkable part. MinGW gcc produces COFF object
files, the very same used by Visual C. Rename the extension to 'obj' and
a MinGW generated object file is usable by Visual C, at least with VC
6.0 (tested). So add Windows object files for these inlined routines to
the source distribution. Windows builds link directly to the included
object files. Other gcc builds compile the source files. Now VC builds
of Pygame can take advantage of the MMX optimized assembly code as well.
The 32bit and 64bit flavors can be separated out into their own files.
And adding SSE optimized routines will not hurt code legibility.
My original plan was to rewrite the inlined code for Nasm then add the
assembled object files for Windows and Unix for SVN. This would be fine
for 32bit code. But implementing 64bit assembly routines looks like a
hairy issue, as calling conventions change and are incompatible across
operating systems. But why use Nasm when MinGW can build the Windows
object files for me, and gcc takes care of all the C calling convention
issues.
--
Lenard Lindstrom
<len-l@xxxxxxxxx>