Intrinsic function

From Infogalactic: the planetary knowledge core
Jump to: navigation, search

<templatestyles src="Module:Hatnote/styles.css"></templatestyles>

In compiler theory, an intrinsic function is a function available for use in a given programming language whose implementation is handled specially by the compiler. Typically, it substitutes a sequence of automatically generated instructions for the original function call, similar to an inline function. Unlike an inline function though, the compiler has an intimate knowledge of the intrinsic function and can therefore better integrate it and optimize it for the situation. This is also called builtin function in many languages.

Compilers that implement intrinsic functions generally enable them only when the user has requested optimization, falling back to a default implementation provided by the language runtime environment otherwise.

Intrinsic functions are often used to explicitly implement automatic vectorization and parallelization in languages which do not address such constructs. Altivec and OpenMP are examples of APIs which use intrinsic functions to declare, respectively, vectorizable and multiprocessor-aware operations during compilation. The compiler parses the intrinsic functions and converts them into vector math or multiprocessing object code appropriate for the target platform.

Microsoft[1] and Intel's C/C++ compilers as well as GCC[2] implement intrinsics that map directly to the x86 SIMD instructions (MMX, SSE, SSE2, SSE3, SSSE3, SSE4). The Visual C++ compiler of Microsoft Visual Studio does not support inline assembler for X86-64.[3][4][5][6] To compensate for the lack of inline assembly, new intrinsics have been added that map to standard assembly instructions that are not normally accessible through C/C++ (e.g.: bit scan). The HotSpot JVM's just-in-time compiler also has intrinsics for specific Java APIs.[7]

References

  1. Lua error in package.lua at line 80: module 'strict' not found.
  2. Lua error in package.lua at line 80: module 'strict' not found.
  3. Lua error in package.lua at line 80: module 'strict' not found.
  4. Lua error in package.lua at line 80: module 'strict' not found.
  5. Lua error in package.lua at line 80: module 'strict' not found.
  6. Lua error in package.lua at line 80: module 'strict' not found.
  7. Lua error in package.lua at line 80: module 'strict' not found.

External links


<templatestyles src="Asbox/styles.css"></templatestyles>