From: Peter R. <pe...@ly...> - 2011-08-26 10:20:12
|
Den 2011-08-26 11:36 skrev max reason: > > I've been writing a 3D simulation/graphics/game engine for a while now, > and the assembly language work is "getting out of hand". The problem is, > I have a common set of C/C++ code for linux and windoze versions with > #ifdef LINUX and #ifdef WINDOZE as necessary. I develop and build the > linux version of my engine with CodeBlocks and gnu tools, and build the > windoze version of my engine with VisualStudio professional. > > So far I have two assembly language files. One contains MASM-syntax > and the other contains "gas" (or whatever that ATT syntax is called) > to compile on linux. Because keeping them in sync is a real hassle, > what I did was to put the linux syntax for every line as the first > comment on each line (following ;; to make it explicit). This makes > makes sure I have one-for-one correspondence between linux and windoze > assembly instructions. Then I wrote a small C program that extracts > the linux assembly language file from the combo file that assembles > correctly with MASM. > > The only thing holding me back from making 64-bit linux and windoze > versions of my application are these two assembly language files. > The time has come to rectify this, especially since some of my > most crucial routines will benefit greatly from the more recent > double-width (256-bit) SIMD/AVX instructions that operate on the > 256-bit wide YMM registers (and twice as many of them at that). > > However, I dread having FOUR versions of each assembly language file. > Clearly I cannot avoid having separate 32-bit and 64-bit versions, > but this brings me to the question for this forum. > > Is there any way mingw tools (or another toolset I don't know about) > will let me assemble 32-bit and 64-bit gas/linux assembly language > files to create an object file that VisualStudio will correctly link > into a VisualStudio project? If the answer is different for 32-bit > and 64-bit mode, please say so. > > I suppose my other alternative is to abandon VisualStudio, develop > with CodeBlocks on windoze as well as linux, in which case presumably > I would not need the MASM syntax files any more. Please confirm this > is true for 32-bit and 64-bit mode (especially if my preferred option > in the previous paragraph doesn't work for some reason). > > My only other question is... are the linux assemblers able to process > all the latest SIMD instructions (in bulldozer CPUs for instance)? > > Please mention anything I need to know to make this work. > > Thanks in advance for the information. Have you had a look at if giving the .intel_syntax directive to gas can make you drop the AT&T syntax? But that path forward may not be available for 64-bit? However, 3 is better than 4... http://sourceware.org/binutils/docs-2.21/as/i386_002dSyntax.html Cheers, Peter |