| AI Engine API User Guide (AIE-API) 2025.2

Loading...
Searching...
No Matches
Functions
Operator Overloading

## Overview

The AIE API provides overloading for most of the available operators.

In order to use them, you need to include a special header file and use the aie::operators namespace.

#include <aie_api/operators.hpp>
using namespace aie::operators;
aie::mask<16> less_than_add(aie::vector<int32, 16> a, aie::vector<int32, 16> b, aie::vector<int32, 16> c)
{
return c < (a + b);
}

## Functions
template<ArithmeticType T1, ArithmeticType T2>
constexpr auto | aie::operators::operator!= (const T1 &a, const T2 &b)
| Not equal to comparison operator.
template<ArithmeticType T1, ArithmeticType T2>
constexpr auto | aie::operators::operator& (const T1 &a, const T2 &b)
| Bitwise AND operation.
template<ArithmeticType T1, ArithmeticType T2>
constexpr auto | aie::operators::operator+ (const T1 &a, const T2 &b)
| Addition operator.
template<ArithmeticType T1, ArithmeticType T2>
constexpr T1 & | aie::operators::operator+= (T1 &lhs, const T2 &rhs)
| Addition assignment operator.
template<ArithmeticType T>
constexpr auto | aie::operators::operator- (const T &a)
| Negation operator.
template<ArithmeticType T1, ArithmeticType T2>
constexpr auto | aie::operators::operator- (const T1 &a, const T2 &b)
| Subtraction operator.
template<ArithmeticType T1, ArithmeticType T2>
constexpr T1 & | aie::operators::operator-= (T1 &lhs, const T2 &rhs)
| Subtraction assignment operator.
template<ArithmeticType T1, ArithmeticType T2>
constexpr auto | aie::operators::operator< (const T1 &a, const T2 &b)
| Less than comparison operator.
template<Vector Vec>
constexpr auto | aie::operators::operator<< (const Vec &a, unsigned shift)
| Bitwise left shift operator.
template<ArithmeticType T1, ArithmeticType T2>
constexpr auto | aie::operators::operator<= (const T1 &a, const T2 &b)
| Less than or equal comparison operator.
template<ArithmeticType T1, ArithmeticType T2>
constexpr auto | aie::operators::operator== (const T1 &a, const T2 &b)
| Equal to comparison operator.
template<ArithmeticType T1, ArithmeticType T2>
constexpr auto | aie::operators::operator> (const T1 &a, const T2 &b)
| Greater than comparison operator.
template<ArithmeticType T1, ArithmeticType T2>
constexpr auto | aie::operators::operator>= (const T1 &a, const T2 &b)
| Greater than or equal comparison operator.
template<Vector Vec>
constexpr auto | aie::operators::operator>> (const Vec &a, unsigned shift)
| Bitwise right shift operator.
template<ArithmeticType T1, ArithmeticType T2>
constexpr auto | aie::operators::operator^ (const T1 &a, const T2 &b)
| Bitwise XOR operation.
template<ArithmeticType T1, ArithmeticType T2>
constexpr auto | aie::operators::operator| (const T1 &a, const T2 &b)
| Bitwise OR operation.
template<ArithmeticType T>
constexpr auto | aie::operators::operator~ (const T &a)
| Bitwise NOT operation.

## Function Documentation

## ◆ operator!=()

template<ArithmeticType T1, ArithmeticType T2>

auto aie::operators::operator!= | ( | const T1 & | a,
|  | const T2 & | b )
| constexpr

Not equal to comparison operator.

It is equivalent to aie::neq.

## ◆ operator&()

template<ArithmeticType T1, ArithmeticType T2>

auto aie::operators::operator& | ( | const T1 & | a,
|  | const T2 & | b )
| constexpr

Bitwise AND operation.

It is equivalent to aie::bit_and.

## ◆ operator+()

template<ArithmeticType T1, ArithmeticType T2>

auto aie::operators::operator+ | ( | const T1 & | a,
|  | const T2 & | b )
| constexpr

Addition operator.

It is equivalent to aie::add.

## ◆ operator+=()

template<ArithmeticType T1, ArithmeticType T2>

T1 & aie::operators::operator+= | ( | T1 & | lhs,
|  | const T2 & | rhs )
| constexpr

Addition assignment operator.

## ◆ operator-() [1/2]

template<ArithmeticType T>

auto aie::operators::operator- | ( | const T & | a | ) |
| constexpr

Negation operator.

It is equivalent to aie::neg.

## ◆ operator-() [2/2]

template<ArithmeticType T1, ArithmeticType T2>

auto aie::operators::operator- | ( | const T1 & | a,
|  | const T2 & | b )
| constexpr

Subtraction operator.

It is equivalent to aie::sub.

## ◆ operator-=()

template<ArithmeticType T1, ArithmeticType T2>

T1 & aie::operators::operator-= | ( | T1 & | lhs,
|  | const T2 & | rhs )
| constexpr

Subtraction assignment operator.

## ◆ operator<()

template<ArithmeticType T1, ArithmeticType T2>

auto aie::operators::operator< | ( | const T1 & | a,
|  | const T2 & | b )
| constexpr

Less than comparison operator.

It is equivalent to aie::lt.

## ◆ operator<<()

template<Vector Vec>

auto aie::operators::operator<< | ( | const Vec & | a,
|  | unsigned | shift )
| constexpr

Bitwise left shift operator.

It is equivalent to aie::upshift.

## ◆ operator<=()

template<ArithmeticType T1, ArithmeticType T2>

auto aie::operators::operator<= | ( | const T1 & | a,
|  | const T2 & | b )
| constexpr

Less than or equal comparison operator.

It is equivalent to aie::le.

## ◆ operator==()

template<ArithmeticType T1, ArithmeticType T2>

auto aie::operators::operator== | ( | const T1 & | a,
|  | const T2 & | b )
| constexpr

Equal to comparison operator.

It is equivalent to aie::eq.

## ◆ operator>()

template<ArithmeticType T1, ArithmeticType T2>

auto aie::operators::operator> | ( | const T1 & | a,
|  | const T2 & | b )
| constexpr

Greater than comparison operator.

It is equivalent to aie::gt.

## ◆ operator>=()

template<ArithmeticType T1, ArithmeticType T2>

auto aie::operators::operator>= | ( | const T1 & | a,
|  | const T2 & | b )
| constexpr

Greater than or equal comparison operator.

It is equivalent to aie::ge.

## ◆ operator>>()

template<Vector Vec>

auto aie::operators::operator>> | ( | const Vec & | a,
|  | unsigned | shift )
| constexpr

Bitwise right shift operator.

It is equivalent to aie::downshift.

## ◆ operator^()

template<ArithmeticType T1, ArithmeticType T2>

auto aie::operators::operator^ | ( | const T1 & | a,
|  | const T2 & | b )
| constexpr

Bitwise XOR operation.

It is equivalent to aie::bit_xor.

## ◆ operator|()

template<ArithmeticType T1, ArithmeticType T2>

auto aie::operators::operator| | ( | const T1 & | a,
|  | const T2 & | b )
| constexpr

Bitwise OR operation.

It is equivalent to aie::bit_or.

## ◆ operator~()

template<ArithmeticType T>

auto aie::operators::operator~ | ( | const T & | a | ) |
| constexpr

Bitwise NOT operation.

It is equivalent to aie::bit_not.