Built-In Functions

The following built-in functions are supported:

The __builtin_frame_address() function always returns zero.

The __builtin_sqrt() and __builtin_sqrtf() functions are supported only when hardware float support is enabled. That is, __builtin_sqrt() is supported only when the Trigonometric Math Unit (TMU) is enabled. And, __builtin_sqrtf() is supported only when the TMU is enabled or when compiling for the Control Law Accelerator (CLA).

When calling built-in functions that may be unavailable at run-time, use the Clang __has_builtin macro as shown in the following example to make sure the function is supported:

#if __has_builtin(__builtin_sqrt) double estimate = __builtin_sqrt(x); #else double estimate = fast_approximate_sqrt(x); #endif

If the built-in function is supported and the device has the appropriate hardware support, the built-in function will invoke the hardware support.

If the built-in function is supported but the device does not have the appropriate hardware enabled, the built-in function will usually become a call to an RTS library function. For example, __builtin_sqrt() will become a call to the library function sqrt().

The __builtin_return_address() function always returns zero.