Optimal GCC compile flags for 2nd gen i7

Optimal GCC compile flags for 2nd gen i7

Hello - Can anyone suggest optimal GCC compile flags (march, tune, sse, etc) for 2nd gen i7?

I read GCC 4.6 adds support for -march=corei7, but I am using GCC 4.4 and 4.5. Also, I am cross compilng on a pentium4 host so -march=native may not be ideal.

Any suggestions would be appreciated.


3 posts / 0 new
Last post
For more complete information about compiler optimizations, see our Optimization Notice.

The Pentium4 native options are probably OK, if you want a 32-bit build. If you are able to get auto-vectorization at -O3, -march=pentium4 -mtune=barcelona will favor performance on CoreI7 while still running on Pentium4. Adding -msse4should help certain applications (e.g. complex data types), but won't run on Pentium4.
The -march=corei7 option of gcc 4.6 (replacing the pentium4 and barcelona options)is intended for the original Core I7 (still OK for I7-2). With gcc 4.5 on I7-2,you can use -mavx in place of -msse4and sometimes get an advantage. I expect 4.6 would get more out of -mavx.I've never tried -mavx for 32-bit compilation.

Recent gcc versions support -flto (link time optimization) which is said to work well with suitable applications.

Leave a Comment

Please sign in to add a comment. Not a member? Join today