Selecting one of the following will take you directly to that section:
-O0 disables all optimizations. This optimization level is the default. Using -O0 results in a faster compilation and build time, but produces slower code than the other optimization levels. Code size and stack usage are significantly higher at -O0 than at other optimization levels. The generated code closely correlates to the source code, but significantly more code is generated, including dead code.
-O1 enables the core optimizations in the compiler. This optimization level provides a good debug experience with better code quality than -O0. Also the stack usage is improved over -O0. Arm recommends this option for a good debug experience.
The differences when using -O1, as compared to -O0 are:
-O2 is a higher optimization for performance compared to -O1. It adds few new optimizations, and changes the heuristics for optimizations compared to -O1. This is the first optimization level at which the compiler might generate vector instructions. It also degrades the debug experience, and might result in an increased code size compared to -O1.
The differences when using -O2 as compared to -O1 are:
-O3 is a higher optimization for performance compared to -O2. This optimization level enables optimizations that require significant compile-time analysis and resources, and changes the heuristics for optimizations compared to -O2. -O3 instructs the compiler to optimize for the performance of generated code and disregard the size of the generated code, which might result in an increased code size. It also degrades the debug experience compared to -O2.
The differences when using -O3 as compared to -O2 are:
-mcpu=native causes the compiler to auto-detect the CPU of the build computer. At present, this feature is only supported on GNU/Linux, and not all architectures are recognized. If the auto-detect is unsuccessful the option has no effect.
Disregard strict standards compliance. -Ofast enables all -O3 optimizations. It also enables optimizations that are not valid for all standard-compliant programs. It turns on -ffast-math and the Fortran-specific -fno-protect-parens and -fstack-arrays.
Allow aggressive, lossy floating-point optimizations.
Enable handling of OpenMP directives "#pragma omp" in C/C++ and
"!$omp" in Fortran. When -fopenmp is specified, the compiler
generates parallel code according to the OpenMP Application
Program Interface v4.0
Enable handling of OpenMP's SIMD directives with "#pragma omp" in C/C++ and "!$omp" in Fortran. Other OpenMP directives are ignored.
Generate code for 32-bit or 64-bit ABI.
Generate instructions for Intel's Ivy Bridge CPU. In contrast to -mtune=cpu-type, which merely tunes the generated code for the specified cpu-type, -march=cpu-type allows clang to generate code that may not run at all on processors other than the one indicated. Specifying -march=cpu-type implies -mtune=cpu-type.
Intel Ivy Bridge CPU with 64-bit extensions, MMX, SSE, SSE2, SSE3, SSSE3, SSE4.1, SSE4.2, POPCNT, AVX, AES, PCLMUL, FSGSBASE, RDRND and F16C instruction set support.
Enable all instruction subsets supported by the local machine. In contrast to -mtune=cpu-type, which merely tunes the generated code for the specified cpu-type, -march=cpu-type allows clang to generate code that may not run at all on processors other than the one indicated. Specifying -march=cpu-type implies -mtune=cpu-type.
specifies signed char characters. The compiler treats "plain" char declarations as signed char.
Disable range checking on results of simplification of constant expressions during compilation. For example, GNU Fortran will give an error at compile time when simplifying "a = 1. / 0". With this option, no error will be given and "a" will be assigned the value "+Infinity". If an expression evaluates to a value outside of the relevant range of ["-HUGE()":"HUGE()"], then the expression will be replaced by "-Inf" or "+Inf" as appropriate. Similarly, "DATA i/Z'FFFFFFFF'/" will result in an integer overflow on most systems, but with -fno-range-check the value will "wrap around" and "i" will be initialized to -1 instead.
Specify the layout used by the source file is free form.
-mcmodel=
enable language support for
Assume free-format source.
Invoke the ARM C compiler
Invoke the ARM C++ compiler
Invoke the ARM Fortran compiler