Question

Can I get a single executable file, by using ICC(Intel C++ Compiler), that contains multiple versions of the compiled code for different architectures with different SSE1-4/AVX (but only x86_64, without x86_32) from different manufacturers AMD / Intel and the automatic choice in run-time required for the current processor architecture?

Was it helpful?

Solution

Yes you can.

Just as you specify -xARCH (like -xAVX, -xHost) you can specify -axARCH to compile for two architectures

Example:

icc -xHost -axSSE2 ...

Will compile a default executable for the host architecture and optional code for SSE2 in case it's used on an older processor. Sadly only one additional architecture may be used. At runtime the most advanced code will be used.

In my icc 12.0.2 the valid options are: SSE2, SSE3, SSE4.1, SSE4.2, AVX, Host (-xHost only)

Modern AMD machines support SSE3 in all modern CPUs. SSE2 is by the way the standard lowest common denominator and is the default option if no -x option is specified. You can not make icc generate AMD 3DNow! code.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top