3.2 Performance benefits of compiler intrinsics
The use of compiler intrinsics offers a number of performance benefits:
The low-level instructions substituted for an intrinsic might be more
efficient than corresponding implementations in C or C++, resulting in both reduced
instruction and cycle counts. To implement the intrinsic, the compiler automatically
generates the best sequence of instructions for the specified target architecture. For
L_add intrinsic maps directly to the ARM
assembly language instruction
QADD r0, r0, r1 /* Assuming r0 = a, r1 = b on entry */
More information is given to the compiler than the underlying C and C++ language is
able to convey. This enables the compiler to perform optimizations and to generate
instruction sequences that it could not otherwise have performed.
These performance benefits can be significant for real-time processing applications.
However, care is required because the use of intrinsics can decrease code portability.