On Fri, 2006-02-03 at 19:10 -0500, Doug Currie wrote: > Friday, February 3, 2006, 5:29:52 PM, Nicolas Cannasse wrote: > > >> Ah, that's the difference... > >> > >> -g -O2 no gcc global registers -- works > >> -g -O2 with gcc global registers -- fails > >> -O3 no gcc global registers -- fails > >> -O3 with gcc global registers -- fails > > > Got it. > > Might be a bug in GCC -O3 / Mingw ? > > Yes, it could be. > > Note that > -g -O2 with gcc global registers > also fails. > > I wonder if there is something fragile in the use of the global > registers and appropriate save/restore.
http://msdn.microsoft.com/library/default.asp?url=/library/en-us/vccore98/html/_core_calling_conventions_topics.asp "The compiler generates prolog and epilog code to save and restore the ESI, EDI, EBX, and EBP registers, if they are used in the function." #if defined(__GNUC__) && defined(__i386__) # define ACC_BACKUP int_val __acc = acc; # define ACC_RESTORE acc = __acc; # define ACC_REG asm("%eax") # define PC_REG asm("%esi") # define SP_REG asm("%edi") Hmmm.. but does gcc respect this when inlining, for example? Also -03 is absurd! Don't even think about it! I find gcc -02 doesn't work sometimes, it crashes Elkhound on Linux for example. I think the right way is to use -O1, and allow the build to use extra options. Then make a benchmark -- NekoML is probably a good benchmark -- and try specific options to see what actually improves performance. Bottom line here, IMHO, is: if you want better performance go and buy a 64 bit machine. There's no point tweaking x86, its a dying architecture for the desktop. (I expect it will be used for embedded systems for quite some time though, due to manufacturing efficiency plus availability of software .. so tweaking the vm for x86 is worthwhile in the long run). -- John Skaller <skaller at users dot sf dot net> Felix, successor to C++: http://felix.sf.net -- Neko : One VM to run them all (http://nekovm.org)
