ArticleslgStudy

mathematics

Intrinsic function

Intrinsic function is a mathematics topic covered in the lgStudy science library. This page brings together a partial reference excerpt, illustrations, worked examples, real-world applications and a short study plan, so you can understand Intrinsic function rather than just read about it. In short: In computer software, in compiler theory, an intrinsic function, also called built-in function or builtin function, is a function (subroutine) available for use in a given programming language whose implementation is handled specially by the compiler. Typically, it may substitute a sequence of automatically generated instructions for the original function call, similar to an inline function.

Key takeaways

  • Intrinsic function belongs to mathematics; place it in that map before memorising details.
  • Learn the definition first, then one example that makes the definition concrete.
  • Connect Intrinsic function to a quantity you can measure, compute or draw — that is where exam questions come from.
  • Reproduce the core statement of Intrinsic function from memory before moving on to harder problems.

Reference excerpt

In computer software, in compiler theory, an intrinsic function, also called built-in function or builtin function, is a function (subroutine) available for use in a given programming language whose implementation is handled specially by the compiler. Typically, it may substitute a sequence of automatically generated instructions for the original function call, similar to an inline function. Unlike an inline function, the compiler has an intimate knowledge of an intrinsic function and can thus better integrate and optimize it for a given situation. Compilers that implement intrinsic functions may enable them only when a program requests optimization, otherwise falling back to a default implementation provided by the language runtime system (environment).

Vectorization and parallelization Intrinsic functions are often used to explicitly implement vectorization and parallelization in languages which do not address such constructs. Some application programming interfaces (API), for example, AltiVec and OpenMP, use intrinsic functions to declare, respectively, vectorizable and multiprocessing-aware operations during compiling. The compiler parses the intrinsic functions and converts them into vector math or multiprocessing object code appropriate for the target platform. Some intrinsics are used to provide additional constraints to the optimizer, such as values a variable cannot assume.

By programming language

C and C++ Compilers for C and C++, of Microsoft, Intel, and the GCC implement intrinsics that map directly to the x86 single instruction, multiple data (SIMD) instructions (MMX, Streaming SIMD Extensions (SSE), SSE2, SSE3, SSSE3, SSE4, AVX, AVX2, AVX512, FMA, ...). Intrinsics allow mapping to standard assembly instructions that are not normally accessible through C/C++; e.g. bit scan and parallel operations on 128 bits and 256 bits. Some C and C++ compilers provide non-portable platform-specific intrinsics. Other intrinsics (such as GNU built-ins) are slightly more abstracted, approximating the abilities of several contemporary platforms, with portable fall back implementations on platforms with no appropriate instructions. It's common for C++ libraries, such as glm or Sony's vector maths libraries, to achieve portability via conditional compilation (based on platform specific compiler flags), providing fully portable high-level primitives (e.g., a four-element floating-point vector type) mapped onto the appropriate low level programming language implementations, while still benefiting from the C++ type system and inlining; hence the advantage over linking to hand-written assembly object files, using the C ABI.

Examples The following are examples of signatures of intrinsic functions from Intel's set of intrinsic functions.

COBOL Intrinsic function Module for COBOL was introduced in ANSI INCITS X3.23a-1989 and ISO 1989:1985/Amd 1:1992.

Java The HotSpot Java virtual machine's (JVM) just-in-time compiler also has intrinsics for specific Java APIs. Hotspot intrinsics are standard Java APIs which may have one or more optimized implementation on some platforms.

PL/I ANSI/ISO PL/I defines nearly 90 builtin functions. These are conventionally grouped as follows:

String-handling builtin functions such as INDEX, LENGTH Arithmetic builtin functions such as ABS, CEIL, ROUND Mathematical builtin functions like SIN, COS, LOG, ERF Array-handling builtin functions, for example ANY, ALL, PROD Condition-handling builtin functions like ONCODE, ONFILE Storage Control builtin functions, for example ADDR, POINTER Input-Output builtins: LINENO Miscellaneous builtin functions like DATE and TIME Individual compilers have added additional builtins specific to a machine architecture or operating system. A builtin function is identified by leaving its name undeclared and allowing it to default, or by declaring it BUILTIN. A user-supplied function of the same name can be substituted by declaring it as ENTRY.

References

External links Intel Intrinsics Guide Using milicode routines, IBM AIX 6.1 documentation

Worked examples

Example 1 — a first encounter with Intrinsic function

Start with the simplest possible case. Write down what Intrinsic function claims or describes in one sentence, then invent the smallest concrete situation in which that sentence is true. In mathematics, the smallest case is usually a single object, a single equation or a single measurement. Check that every symbol or term in your sentence has a meaning in that case.

Example 2 — changing one variable

Take the situation from Example 1 and change exactly one quantity: double it, halve it, or set it to zero. Predict what should happen to Intrinsic function before you calculate. Comparing your prediction with the result is the fastest way to find out whether you understand the idea or only the words.

Example 3 — an exam-style question

Typical questions about Intrinsic function ask you to (a) state it precisely, (b) apply it to given data, and (c) explain a limitation. Practise writing all three answers in under five minutes; the third part is what separates a full-mark answer from an average one.

Applications of Intrinsic function

In research
Intrinsic function appears in mathematics research whenever the underlying quantities have to be modelled precisely. Papers usually cite it as a starting assumption and then explore where it breaks down.
In technology and industry
Engineering practice reuses Intrinsic function in design rules, simulations and safety margins. Knowing the idea lets you read a specification sheet and understand why the numbers look the way they do.
In the classroom
Intrinsic function is common in secondary-school and first-year university syllabi. It links to neighbouring topics Compiler construction, Computer programming, so understanding it makes those chapters shorter.
In everyday life
Look for Intrinsic function outside the textbook — in sport, cooking, traffic, electronics or the sky above you. An example you found yourself is remembered far longer than one you were given.
Ask Teacher Smith questions about this articleOpens your AI tutor with a question about “Intrinsic function” →

How to study Intrinsic function in 20 minutes

  1. Read the reference excerpt below once, without taking notes.
  2. Close the page and write down what Intrinsic function means in your own words.
  3. Compare your version with the excerpt and mark what you missed.
  4. Work through the three examples above with pen and paper.
  5. Explain Intrinsic function out loud to somebody else — or to Teacher Smith in the lgStudy chat.

Frequently asked questions

What is Intrinsic function in simple terms?

In computer software, in compiler theory, an intrinsic function, also called built-in function or builtin function, is a function (subroutine) available for use in a given programming language whose implementation is handled specially by the compiler. Typically, it may substitute a sequence of auto…

Why does Intrinsic function matter?

Because it connects several mathematics ideas at once: it gives you a definition you can apply, a quantity you can calculate, and a way to check whether a result is plausible.

How should I study Intrinsic function?

Read the excerpt, restate it from memory, then work through the examples and applications listed on this page. The five-step study plan above takes about twenty minutes.

What does this page cover?

It gives you a compact reference excerpt plus original lgStudy explanations, examples, applications and study material on Intrinsic function.

Tags

  • Compiler construction
  • Computer programming

Keep exploring