The following table details the effects of the -O0, -O1, -O2, -O3, and -fast options. The table first describes the characteristics shared by both IA-32 and Itanium® architectures and then explicitly describes the specifics (if any) of the -On options’ behavior on each architecture.
Option | Effect |
---|---|
-O0 | Disables optimizations. |
-O1 | Optimizes to favor code size and code locality. Disables loop unrolling.
May improve performance for applications with very large code size, any
branches, and execution time not dominated by code within loops. In most
cases, -O2 is recommended over -O1.
IA-32 systems: Disables intrinsics inlining to reduce code size. Itanium-based systems: Disables software pipelining and global code scheduling. |
-O2, -O | ON by default. Optimizes for code speed. This is the generally recommended
optimization level. Itanium-based systems: Enables software pipelining. |
-O3 | Enables -O2 optimizations and more aggressive
optimizations such as loop and memory access transformations. The -O3 optimizations may slow down code in some cases compared
to -O2 optimizations. Recommended for applications
that have loops that heavily use floating-point calculations and process
large data sets. IA-32 systems: In conjunction with -ax{K|W|N|B|P} and -x{K|W|N|B|P} options, this option causes the compiler to perform more aggressive data dependency analysis than for -O2. This may result in longer compilation times. |
-fast | The -fast option enhances execution speed across
the entire program by including the following options that can improve
run-time performance:
prompt>icpc -fast -xW source_file.cpp The options set by -fast may change from release to release. |