4.6.3. Compiler intrinsics

Compiler intrinsics provide similar functionality to inline assembly, and additional features such as type checking and automatic register allocation. An intrinsic function appears as a function call in C or C++, but is replaced during compilation by a sequence of low-level instructions. You can express low-level architectural behavior in a high-level language.

In addition to giving direct access to instructions that do not normally map well onto high-level language statements, using intrinsics means that the compiler can optimize the operation to improve performance. When using intrinsics, you do not have to consider register allocation and interlock issues. The compiler handles these issues.

GCC and ARM compilers support the same NEON intrinsic syntax, making C or C++ code portable between the toolchains. To add support for NEON intrinsics, include the header file arm_neon.h.

The header file arm_neon.h defines a set of vector data types of different sizes. For example:

The intrinsics in Example 4.9 are equivalent to the NEON instruction VADD.I32 result, a, b.

Example 4.9. Intrinsics basic usage

int32x2_t result, a, b;
result = vadd_s32(a,b)

Copyright © 2014 ARM. All rights reserved.ARM DAI0425
Non-ConfidentialID080414