| AI Engine Intrinsics User Guide (v2026.1)

Loading...
Searching...
No Matches
Functions
Elementary Functions
Intrinsics » Scalar Operations

## Overview

Functions providing elementary mathematical functionality.

The scalar unit on the AIE has support for several fixed-point/integer and/or floating-point non-linear functions. Current support includes Sin/Cos, Inv, InvSqrt and Sqrt functions.

This floating point intrinsics can generate exceptions, for more information you can go here.

## Functions
float | _expf (float x)
| Exponent.
float | _logf (float x)
| Logarithm.
float | _sqrtf (float a)
| Square Root.
float | inv (float a)
| Inverse.
int | inv (int a, int sft1, int sft2)
| Inverse.
float | invsqrt (float a)
| Inverse Square Root.
int | invsqrt (int a, int sft1, int sft2)
| Inverse Square Root.
cint16 | sincos (unsigned int)
| Sine and Cosine.
int | sqrt (int a, int sft1, int sft2)
| Square Root.

## Function Documentation

## ◆ _expf()

float _expf | ( | float | x | ) |

Exponent.

Parameters

  a | Single precision floating-point input value

Returns
  Single precision floating point exponential function

## ◆ _logf()

float _logf | ( | float | x | ) |

Logarithm.

Parameters

  a | Single precision floating-point input value

Returns
  Single precision floating point logarithmic function

## ◆ _sqrtf()

float _sqrtf | ( | float | a | ) |

Square Root.

Parameters

  a | Single precision floating-point input value

Returns
  Single precision floating-point result

## ◆ inv() [1/2]

float inv | ( | float | a | ) |

Inverse.

Parameters

  a | Single precision floating-point input value

Returns
  Single precision floating point inverse

## ◆ inv() [2/2]

int inv | ( | int | a,
|  | int | sft1,
|  | int | sft2 )

Inverse.

Equivalent to float2fix(inv(fix2float(a,sft1)),sft2).

Parameters

  a | Fixed-point input value
  sft1 | Decimal point of input value
  sft2 | Decimal point of output value

Returns
  Fixed-point result

## ◆ invsqrt() [1/2]

float invsqrt | ( | float | a | ) |

Inverse Square Root.

Parameters

  a | Single precision floating-point input value

Returns
  Single precision floating point inverse square root

## ◆ invsqrt() [2/2]

int invsqrt | ( | int | a,
|  | int | sft1,
|  | int | sft2 )

Inverse Square Root.

Equivalent to float2fix(invsqrt(fix2float(a,sft1)),sft2).

Parameters

  a | Fixed-point input value
  sft1 | Decimal point of input value
  sft2 | Decimal point of output value

Returns
  Fixed-point result

## ◆ sincos()

cint16 sincos | ( | unsigned int |  | ) |

Sine and Cosine.

Parameters

  a | Fixed-point unsigned input value in Q1.31 format scaled with 1/Pi (input value 2^31 corresponds to Pi). Only the upper 20-bit of the input value are used.

Returns
  32-bit integer concatenating Sine (bits [31:16]) and Cosine (bits [15:0]) in signed Q.15 fixed-point format

## ◆ sqrt()

int sqrt | ( | int | a,
|  | int | sft1,
|  | int | sft2 )

Square Root.

Equivalent to float2fix(sqrt(fix2float(a,sft1)),sft2).

Parameters

  a | Fixed-point input value
  sft1 | Decimal point of input value
  sft2 | Decimal point of output value

Returns
  Fixed-point result