3.3 Methods of writing code for NEON

You can use a number of different methods to write code for NEON.

These methods are as follows:

  • Write in assembly language, or use embedded assembly language in C, and use the NEON instructions directly.

  • Write in C or C++ using the NEON C language extensions.

  • Call a library routine that has been optimized to use NEON instructions.

  • Use automatic vectorization to get loops vectorized for NEON.

Optimizing for performance requires an understanding of where in the program most of the time is spent. To gain maximum performance benefits you might also have to use profiling and benchmarking of the code under realistic conditions.

Related concepts
3.2 The NEON unit
3.6 Automatic vectorization
3.8 Stride patterns and data accesses
3.9 Factors affecting NEON vectorization performance
3.12 Data dependency conflicts when vectorizing code
3.13 Carry-around scalar variables and vectorization
3.14 Reduction of a vector to a scalar
3.15 Vectorization on loops containing pointers
3.16 Nonvectorization on loops containing pointers and indirect addressing
3.17 Nonvectorization on conditional loop exits
3.18 Vectorizable loop iteration counts
3.19 Indicating loop iteration counts to the compiler with __promise(expr)
3.20 Grouping structure accesses for vectorization
3.21 Vectorization and struct member lengths
3.22 Nonvectorization of function calls to non-inline functions from within loops
3.23 Conditional statements and efficient vectorization
3.24 Vectorization diagnostics to tune code for improved performance
3.25 Vectorizable code example
3.26 DSP vectorizable code example
Related tasks
3.4 Generating NEON instructions from C or C++ code
Related reference
8.189 --vectorize, --no_vectorize
3.5 NEON C extensions
3.7 Data references within a vectorizable loop
3.10 NEON vectorization performance goals
3.11 Recommended loop structure for vectorization
3.27 What can limit or prevent automatic vectorization
Non-ConfidentialPDF file icon PDF versionARM DUI0472J
Copyright © 2010-2013 ARM. All rights reserved.