Intrinsic function

from Wikipedia, the free encyclopedia

High-level languages - compilers often support so-called intrinsic functions (English intrinsic functions or short intrinsics literally for interior [functions] ; rarely intrinsics called) in which processor- specific operations in function calls are encapsulated. In contrast to the use of inline assembler , the compiler can take full account of intrinsics when optimizing .

In order to use intrinsics it is often necessary to include certain header files or to set certain compiler options. Intrinsics are usually given special names in order to be able to distinguish them more easily from library or [developer] own functions, for example with two underscores as a prefix .


The program line

u32_intvalue = __ROUND(f_floatvalue);

is from IAR C - compiler for the processor R32C in the assembler code ROUND translated, wherein the compiler control of the processor registers have, which are used for the variables. ( With the R32C ROUND, the opcode converts a floating point number into an integer number , taking into account the rounding mode set for the processor .)

Situation in the programming languages ​​C ++ and C for x86

Microsoft's and Intel's C and C ++ - compiler as well as GCC offer intrinsic functions directly on SIMD instruction, as well (MMX, SSE, SSE2, SSE3, SSSE3, SSE4) of the x86 processors represent. The newer versions of the Microsoft compilers (VC2005 and VC2008) do not support inline assembler for 64-bit applications. To compensate for the lack of the inline assembler, additional intrinsic functions have been added that are mapped to standard assembler instructions (such as bit scan) that are otherwise not accessible through C ++ or C.

Individual evidence

  1. Chapter Compiler Intrinsics . In: Visual C ++ Language Reference , MSDN
  2. paragraph INTRINSIC FUNCTIONS (English). In: R32C IAR C / C ++ Compiler Reference Guide , IAR Systems
  3. Intrinsics and Inline Assembly ( English ) In: Visual Studio 2010 SDK . Microsoft . Retrieved January 5, 2016 .; Translation: intrinsic functions and inline assemblies