|
From: Antonio Di M. <to...@be...> - 2013-07-11 09:35:52
|
Thanks for your feedback. I've just checked for such options in GCC documentation, but I haven't found any line that reports "generic32" availability. Maybe you mean "generic", that can be used just for "mtune" parameter. Anyway, my priority is not speed, but reliability on all CPU variants I can encounter. Until two months ago, I thought that i686 was more than enough to support all available hardware where my software runs, but one day I found a PC equipped with a VIA C3 CPU, and the CMOV issue appeared (as confirmed by a Google search, many people found out that). My wish is to have a "CMOV-free" libgcc, libstdc++ and all libraries that I build with GCC. It's not mandatory that GCC also has such kind of limitation. T. > have you ever try "-mtune=generic32 -march=generic32" instead of a special arch? > > In most of my projects I found these options will generate fastest > code, even faster than "-march=core2 -mtune=core2" on my core2 laptop > computer. > > 2013/7/11, Antonio Di Monaco<to...@be...>: >> Sorry, I was trying different flags before replying with a final result. >> >> In the end, this was my final try: >> >> - Modified build script, added -march=pentium-mmx -mtune=pentium-mmx to >> BASE_CFLAGS and BASE_CXXFLAGS. >> - Modified PROCESSOR_OPTIMIZATION_TUNE_32& PROCESSOR_OPTIMIZATION_ARCH_32 >> -> pentium-mmx >> - Set up CFLAGS, CXXFLAGS and ASFLAGS with the same options before starting >> build. >> - Verified in all logs (pre and during build) that such options were >> present. >> >> Checking with objdump -d the compiled binaries, I get: >> >> libgcc_s_sjlj-1.dll -> clean >> >> $ objdump -d /mingw/bin/libstdc++-6.dll | grep cmov >> 6fc9146a: 0f 42 c1 cmovb %ecx,%eax >> >> all other DLL i need (zlib, libxml2, libexpat) are clean. >> >> OpenSSL has one cmov, but I guess is related to RandNR engine (asm part), >> that I don't use. >> >> Boost library (multithreading, release mode) is all clean. >> >> What worries me is Qt4. I modified mkspec/win32-g++/qmake.conf, in order to >> have march/mtune in QMAKE_CFLAGS. All libraries but QtGui4.dll are fine. >> >> This is what I get from QtGui4.dll: >> >> $ objdump -d /mingw/qt4/bin/QtGui4.dll | grep cmov >> 6510440f: 0f 48 f7 cmovs %edi,%esi >> 651044eb: 0f 48 f7 cmovs %edi,%esi >> 651045b0: 0f 48 f7 cmovs %edi,%esi >> 6510465b: 0f 48 f7 cmovs %edi,%esi >> 6510606f: 0f 48 f7 cmovs %edi,%esi >> 6510614b: 0f 48 f7 cmovs %edi,%esi >> 65106210: 0f 48 f7 cmovs %edi,%esi >> 651062bb: 0f 48 f7 cmovs %edi,%esi >> 65107f2f: 0f 47 cb cmova %ebx,%ecx >> 651081a2: 0f 47 c7 cmova %edi,%eax >> 651081f4: 0f 43 d3 cmovae %ebx,%edx >> 65108212: 0f 43 c3 cmovae %ebx,%eax >> 65108235: 0f 43 e8 cmovae %eax,%ebp >> 65108400: 0f 43 d5 cmovae %ebp,%edx >> 6510841e: 0f 43 c1 cmovae %ecx,%eax >> 6510843d: 0f 43 f8 cmovae %eax,%edi >> 6510852a: 0f 47 c1 cmova %ecx,%eax >> 65108565: 0f 43 d3 cmovae %ebx,%edx >> 65108583: 0f 43 c3 cmovae %ebx,%eax >> 651085a1: 0f 43 f8 cmovae %eax,%edi >> 65108675: 0f 43 c5 cmovae %ebp,%eax >> 65108699: 0f 43 d5 cmovae %ebp,%edx >> 651086b7: 0f 43 da cmovae %edx,%ebx >> 6510875e: 0f 47 d8 cmova %eax,%ebx >> 65108a7c: 0f 47 d9 cmova %ecx,%ebx >> 65108d58: 0f 47 9c 24 94 00 00 cmova 0x94(%esp),%ebx >> 651090d6: 0f 47 9c 24 94 00 00 cmova 0x94(%esp),%ebx >> 65109464: 0f 47 c6 cmova %esi,%eax >> 6510983f: 0f 47 d3 cmova %ebx,%edx >> 6581f46b: db c2 fcmovnb %st(2),%st >> 6581f5f9: da d1 fcmovbe %st(1),%st >> 6581f6c9: 0f 48 c5 cmovs %ebp,%eax >> >> >> I have no crashes (at the moment) using my test programs, but the objdump >> result scares me a bit. >> >> Anyway, this is the best result I was able to get. I don't know if it's a >> GCC bug or not. >> >> Thanks a lot, >> >> BR, >> T. >> From: "niXman" i.n...@gm... >> To: "Antonio Di Monaco" to...@be..., >> min...@li... >> Cc: >> Date: Wed, 10 Jul 2013 21:18:17 +0400 >> Subject: Re: [Mingwbuilds-users] mingw builds - different target >> >> >> >>> ping?> 2013/7/7 niXman<i.n...@gm...>> >> 2013/7/6 Antonio Di Monaco >>> Unfortunately, this doesn't work.> >>> I've hardcoded i586 both for PROCESSOR_OPTIMIZATION_TUNE_32& >>> PROCESSOR_OPTIMIZATION_ARCH_32.> >>> Set up CFLAGS / CXXFLAGS environment variables equal to "-march=i586 >>> -mtune=i586", checked for all packages build that such two> >>> options were present.> >>> But when I run my executable on the VIA C3, here it is the infamous CMOV >>> instruction:> >>> CommandLine: "C:\Documents and >>> Settings\Administrator\Desktop\output\rbg200console.exe"> >>> Symbol search path is: *** Invalid ***> >>> ****************************************************************************> >>> >>> * Symbol loading may be unreliable without a symbol search path. >>> *> >>> * Use .symfix to have the debugger choose a symbol path. >>> *> >>> * After setting your symbol path, use .reload to refresh symbol locations. >>> *> >>> ****************************************************************************> >>> >>> Executable search path is:> >>> ModLoad: 00400000 004db000 image00400000> >>> ModLoad: 7c910000 7c9c8000 ntdll.dll> >>> ModLoad: 7c800000 7c900000 C:\WINDOWS\system32\kernel32.dll> >>> ModLoad: 6cec0000 6cee3000 C:\Documents and >>> Settings\Administrator\Desktop\output\libgcc_s_sjlj-1.dll> >>> ModLoad: 77be0000 77c38000 C:\WINDOWS\system32\msvcrt.dll> >>> ModLoad: 61440000 61456000 C:\Documents and >>> Settings\Administrator\Desktop\output\libboost_system-mt.dll> >>> ModLoad: 6fc40000 6fd1c000 C:\Documents and >>> Settings\Administrator\Desktop\output\libstdc++-6.dll> >>> ModLoad: 7e390000 7e420000 C:\WINDOWS\system32\USER32.dll> >>> ModLoad: 77e40000 77e88000 C:\WINDOWS\system32\GDI32.dll> >>> ModLoad: 6a1c0000 6a48f000 C:\Documents and >>> Settings\Administrator\Desktop\output\QtCore4.dll> >>> ModLoad: 77f40000 77feb000 C:\WINDOWS\system32\ADVAPI32.dll> >>> ModLoad: 77da0000 77e32000 C:\WINDOWS\system32\RPCRT4.dll> >>> ModLoad: 77f10000 77f21000 C:\WINDOWS\system32\Secur32.dll> >>> ModLoad: 774b0000 775ed000 C:\WINDOWS\system32\ole32.dll> >>> ModLoad: 71a30000 71a47000 C:\WINDOWS\system32\WS2_32.dll> >>> ModLoad: 71a20000 71a28000 C:\WINDOWS\system32\WS2HELP.dll> >>> ModLoad: 65100000 65b1a000 C:\Documents and >>> Settings\Administrator\Desktop\output\QtGui4.dll> >>> ModLoad: 76360000 763aa000 C:\WINDOWS\system32\COMDLG32.DLL> >>> ModLoad: 77e90000 77f06000 C:\WINDOWS\system32\SHLWAPI.dll> >>> ModLoad: 5d4d0000 5d56a000 C:\WINDOWS\system32\COMCTL32.dll> >>> ModLoad: 7c9d0000 7d1ed000 C:\WINDOWS\system32\SHELL32.dll> >>> ModLoad: 76340000 7635d000 C:\WINDOWS\system32\IMM32.DLL> >>> ModLoad: 770f0000 7717b000 C:\WINDOWS\system32\OLEAUT32.dll> >>> ModLoad: 76b00000 76b2e000 C:\WINDOWS\system32\WINMM.DLL> >>> ModLoad: 72f70000 72f96000 C:\WINDOWS\system32\WINSPOOL.DRV> >>> (57c.3ac): Break instruction exception - code 80000003 (first chance)> >>> eax=00341eb4 ebx=7ffde000 ecx=00000007 edx=00000080 esi=00341f48 >>> edi=00341eb4> >>> eip=7c91120e esp=0022fb20 ebp=0022fc94 iopl=0 nv up ei pl nz na po >>> nc> >>> cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 >>> efl=00000202> >>> *** ERROR: Symbol file could not be found. Defaulted to export symbols >>> for ntdll.dll -> >>> ntdll!DbgBreakPoint:> >>> 7c91120e cc int 3> >>> 0:000> g> >>> (57c.3ac): Illegal instruction - code c000001d (first chance)> >>> First chance exceptions are reported before any exception handling.> >>> This exception may be expected and handled.> >>> eax=61440000 ebx=0022f890 ecx=00000000 edx=00000000 esi=6144a688 >>> edi=00000000> >>> eip=61442f68 esp=0022f810 ebp=614401c8 iopl=0 nv up ei pl nz na po >>> nc> >>> cs=001b ss=0023 ds=0023 es=0023 fs=003b gs=0000 >>> efl=00010202> >>> *** ERROR: Symbol file could not be found. Defaulted to export symbols >>> for C:\Documents and >>> Settings\Administrator\Desktop\output\libboost_system-mt.dll -> >>> libboost_system_mt!ZN5boost6system16generic_categoryEv+0x14f8:> >>> 61442f68 0f45d0 cmovne edx,eax> >>>> >>> Standard MinGW GCC 4.7.2 works fine.> >>> Any idea about how to remove such opcode? >>> Try to set as 'c3': >>> http://gcc.gnu.org/onlinedocs/gcc/i386-and-x86_002d64-Options.html >> --> >> Regards,> >> niXman> >> ___________________________________________________> >> Dual-target(32& 64-bit) MinGW compilers for 32 and 64-bit Windows: >>> http://sourceforge.net/projects/mingwbuilds/> >> ___________________________________________________> >> Another online IDE: http://liveworkspace.org/ >>> -- > Regards,> niXman> >>> ___________________________________________________> Dual-target(32& >>> 64-bit) MinGW compilers for 32 and 64-bit Windows: >>> http://sourceforge.net/projects/mingwbuilds/> >>> ___________________________________________________> Another online IDE: >>> http://liveworkspace.org/ >> >> >> |