When the -ax{i|M|K|W} option is used, your compiled application includes processor-specific extensions. When the compiled application is run, it detects the extensions supported by the processor:
If the processor supports the specialized extensions, the extensions are executed.
If the processor does not support the specialized extensions, the extensions are not executed, and a more generic version of the code is executed instead.
Applications compiled with -ax{i|M|K|W} have increased code size, but increased performance over standard optimized code.
Note
Applications that you compile with this option will execute on any Intel
32-bit processor. Such compilations are, however, subject to any exclusive
specialized code restrictions you impose during compilation with the -x option.
To Optimize for... | Use this option |
---|---|
Intel |
-axi |
Pentium processors with MMX(TM) technology instructions | -axM |
Pentium III processor with the Streaming SIMD Extensions, implies i and M instructions | -axK |
Pentium 4 processor with the Streaming SIMD Extensions 2, implies i, M, and K instructions | -axW |
The -ax{i|M|K|W} option directs the compiler to find opportunities to generate separate versions of functions that use instructions supported on the specified processors. If the compiler finds such an opportunity, it first checks whether generating a processor-specific version of a function results 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 that function that will run on any IA-32 architecture processor.
At run time, one of the two versions is chosen to execute depending on the processor the program is currently running on. In this way, the program can get large performance gains on more advanced processors, while still working properly on older processors.
The disadvantages of using -ax{i|M|K|W} are:
The size of the compiled binary increases because it contains both a processor-specific version and a generic version of the code.
The runtime checks to determine which code to run slightly affect performance.