Choosing the right -march target architecture

Tim Prince n8tm@aol.com
Mon Aug 31 13:09:00 GMT 2015



On 8/31/2015 7:29 AM, Mason wrote:
> I think -fomit-frame-pointer also helps sometimes?
> (It might already be enabled for -O{2,3,s} on amd64?)
>
> I also wanted to specify -march because I think it may allow gcc to
> use SSE2. (Although SSE2 may be enabled by default on amd64?)
>
> https://gcc.gnu.org/onlinedocs/gcc-4.8.4/gcc/i386-and-x86-64-Options.html
>
> I've tried -march=core2 but I'm not sure older AMD chips support the same
> extensions (SSSE3 for example).
>
> So maybe -march=core2 -mno-ssse3 ?
>
> But after reading the documentation more closely, it appears there is
> an option addressing my use-case: -mtune=generic (and in fact, it looks
> like Ubuntu's gcc was compiled with --with-tune=generic so this should
> be the default, IIUC).
>
Some of the docs say mtune=generic is default.  march= implying sse2
also is a default for AMD64, and all  CPUs of the last decade support
SSE3 (but not SSSE3, which is a relatively unimportant option anyway). 
Are you forgetting that mtune doesn't pick instruction set, so without
march= you will get only the default (SSE2 for 64-bit mode)? sse3 is
quite important for complex arithmetic, which you didn't indicate is
relevant, so why all the fuss?
omit-frame-pointer seems an unlikely general option for 64-bit mode.

-- 
Tim Prince



More information about the Gcc-help mailing list