Is there a way to find what compiler options are selected by -xhost?
Driving the question, we wanted to test builds targeted at Broadwell, but actually built on a SandyBridge (or Nahalem) system
(assuming the latest version (v16?), but answers for earlier version couldn't hurt), linux 64bit
Similar to this (gcc) question:
Apparently, Intel doesn't want to divulge any option which might display undocumented internal setting defaults.
As the documentation says, -xhost uses the latest of the specific instruction set options which will generate code to run on the build platform, e.g. -xAVX for Sandy Bridge, -xSSE4.2 for Nehalem.
I think there is less difference between sse4.1 and 4.2 generated code than used to be the case, when sse4.1 was frequently faster on Westmere CPU. So it is more likely that xhost will be an optimum choice to run on the build platform.
I think there are cases where complex arithmetic could be vectorized more effectively with SSE3+ options than with AVX. If the opt-report doesn't make a mistake in its rating of loop speed, it should be an indication of this.
I haven't seen a case where AVX-I could show an advantage, so -xhost is likely not to be useful when building on Ivy Bridge to run on other platforms.
You can set a more recent option than the ones which are capable of running on your build platform, for example to study the opt-report and asm code, or, for example, you might build dual path code on Nehalem to run on Haswell or Nehalem. The new options may be used to build code to run on the SDE software emulator, if you can accept the poor performance.
I don't know why the documentation is so evasive about which CPU families are supported by the various architecture target options. ark.intel.com gives sufficient information about the ISA and chip technology of each production CPU family that you could figure it out.
Tim's response is on the mark. BTW, here are some articles that should help as well: