You copied the Doc URL to your clipboard.

Generating NEON instructions from C or C++ code

To generate NEON instructions from C or C++ code, you must specify particular compiler options.

You must use RVCT 3.1 or later, and ARM Compiler 4.1, with a valid NEON compiler license. ARM Compiler 5.01 and later do not require a separate NEON compiler license.

To generate NEON instructions from C or C++ code, specify the following compiler options:

  • A target --cpu that has NEON capability, for example Cortex-A7, Cortex-A8, Cortex-A9, Cortex-A12, or Cortex-A15.

  • --vectorize to enable NEON vectorization.

  • -O2 (default) or -O3 optimization level.

  • -Otime to optimize for performance instead of code size.

You can also use --diag_warning=optimizations to obtain useful diagnostics from the compiler on what it can and cannot optimize or vectorize. For example:

armcc --cpu Cortex-A8 --vectorize -O3 -Otime --diag_warning=optimizations source.c

Note

To run code that contains NEON instructions, you must enable both the FPU and NEON.

Related information