title: How to check with Intel intrinsics if AVX extensions is supported by the CPU?
body: <p>I'm writing a program using Intel intrinsics. I want to use <code>_mm_permute_pd</code> intrinsic, which is only available on CPUs with AVX. For CPUs without AVX I can use <code>_mm_shuffle_pd</code> but according to the specs it is much slower than <code>_mm_permute_pd</code>. Do the header files for Intel intrinsics define constants that allow me to distinguish whether AVX is supported so that I can write sth like this:</p>
  
  <pre><code>#ifdef __IS_AVX_SUPPORTED__  // is there sth like this defined?
  // use _mm_permute_pd
  # else
  // use _mm_shuffle_pd
  #endif
  </code></pre>
  
  <p>? I have found <a href="https://software.intel.com/en-us/articles/introduction-to-intel-advanced-vector-extensions/" rel="noreferrer">this tutorial</a>, which shows how to perform a runtime check but I need to do a static, compile-time check for the current machine.</p>