title: What is the proper architecture-specific options (-m) for Sandy Bridge based Pentium?
body: <p>I'm trying to figure out how to set <code>-march</code> option properly to see how much performance difference between the option enabled and disabled can occur on my PC with gcc 4.7.2.  </p>
  
  <p>Before trying compiling, I tried to find what is the best <code>-march</code> option for my PC. My PC has Pentium G850, whose architecture is Sandy Bridge. So I referred to <a href="http://gcc.gnu.org/onlinedocs/gcc-4.7.2/gcc/i386-and-x86_002d64-Options.html#i386-and-x86_002d64-Options" rel="noreferrer">the gcc 4.7.2 manual</a> and found that <code>-march=corei7-avx</code> seems the best.<br>
  However, I remembered that Sandy Bridge based Pentium lacks AVX and AES-NI instruction set support, which is <a href="http://ark.intel.com/products/53491/intel-pentium-processor-g850-3m-cache-2_90-ghz" rel="noreferrer">true for Pentium G850</a>. So <code>-march=corei7-avx</code> is not a proper option.</p>
  
  <p>I come up with some potential options:</p>
  
  <ol>
  <li><code>-march=corei7-avx -mno-avx -mno-aes</code></li>
  <li><code>-march=corei7 -mtune=corei7-avx</code></li>
  <li><code>-march=native</code></li>
  </ol>
  
  <p>The first option looks reasonable considering information I have, but I'm anxious that there may be missing feature other than AVX and AES-NI. The second option looks safe, but it could miss some minor features on Sandy Bridge because of <code>-march=corei7</code>. The third option will take care of all of my concerns, but I've heard this option sometimes misdetects features of CPU so I would like to know how to manually do that.<br>
  I've googled and searched StackOverflow and SuperUser, but I can't find any clear solutions...<br>
  What options should be set?</p>