The -ax{K|W|N|B|P} options direct the compiler to find opportunities to generate separate versions of functions that take advantage of features that are specific to the specified Intel processor. If the compiler finds such an opportunity, it first checks whether generating a processor-specific version of a function is likely to result in a performance gain. If this is the case, the compiler generates both a processor-specific version of a function and a generic version of the function. The generic version will run on any IA-32 processor.
At run time, one of the versions is chosen to execute, depending on the Intel processor in use. In this way, the program can benefit from performance gains on more advanced Intel processors, while still working properly on older IA-32 processors.
The disadvantages of using -ax{K|W|N|B|P} are:
The size of the compiled binary increases because it contains processor-specific versions of some of the code, as well as a generic version of the code.
Performance is affected slightly by the run-time checks to determine which code to use.
Note
Applications that you compile to optimize themselves for specific processors
in this way will execute on any Intel IA-32 processor.
If you specify both the -x
and -ax options, the -x
option forces the generic code to execute only on processors compatible
with the processor type specified by the -x option.
Option |
Optimizes Your Code for... |
-axK |
IntelŪ PentiumŪ III and compatible Intel processors. |
-axW |
Intel Pentium 4 and compatible Intel processors. |
-axN |
Intel Pentium 4 and compatible Intel processors. This option also enables new optimizations in addition to Intel processor-specific optimizations. |
-axB |
Intel Pentium M and compatible Intel processors. This option also enables new optimizations in addition to Intel processor-specific optimizations. |
-axP |
Intel processors code-named "Prescott." This option also enables new optimizations in addition to Intel processor-specific optimizations. |
The compilation below generates a single executable that includes:
a generic version for use on any IA-32 processor
a version optimized for Intel Pentium III processors, as long as there is a performance benefit.
a version optimized for Intel Pentium 4 processors, as long as there is a performance benefit.
ifort -axKW prog.f90