| AI Engine-ML Intrinsics User Guide (v2025.2)

Loading...
Searching...
No Matches
Pack/Unpack
Vector Conversions

## Overview

Pack/unpack operations convert between two representations of vector types.

## Vector packing operations
  These intrinsics perform saturation based on the control register here: Control Register. Rounding is not done. No status flags are updated. Parameters
  v | The input vector
v32int8 | pack (v32int16 v)
v32uint8 | pack (v32uint16 v)
v64int4 | pack (v64int8 v)
v64uint4 | pack (v64uint8 v)
v32int8 | pack_conf (v32int16 v, crsat_t sat)
v32uint8 | pack_conf (v32uint16 v, crsat_t sat)
v64int4 | pack_conf (v64int8 v, crsat_t sat)
v64uint4 | pack_conf (v64uint8 v, crsat_t sat)

## Vector unpacking operations
  Parameters
  v | The input vector
v32int16 | unpack (v32int8 v)
v32uint16 | unpack (v32uint8 v)
v64int8 | unpack (v64int4 v)
v64uint8 | unpack (v64uint4 v)

## Vector packing operations (dynamic sign)
  These intrinsics perform saturation based on the control register here: Control Register. Rounding is not done. No status flags are updated. The `sign` argument affects the extension the elements in the vector. For instance, in pseudo-code: v = {0b0000000011111111, ...} assert pack(v, true)[0] == 0b01111111 assert pack(v, false)[0] == 0b11111111 # Reasoning: # v is signed 255, truncating will result in -128 so the top bit is truncated to give INT_MAX for 8b (127) == 0b01111111 # v is unsigned so just truncate and saturate the value == 0b11111111 pack v32int8 pack(v32int16 v) Definition me_ldst.h:76 Parameters
  v | The input vector
  sign | indicates the sign of the pack conversion
v32int8 | pack (v32int16 v, int sign)
v32uint8 | pack (v32uint16 v, int sign)
v64int4 | pack (v64int8 v, int sign)
v64uint4 | pack (v64uint8 v, int sign)
v32int8 | pack_conf (v32int16 v, int sign, crsat_t sat)
v32uint8 | pack_conf (v32uint16 v, int sign, crsat_t sat)
v64int4 | pack_conf (v64int8 v, int sign, crsat_t sat)
v64uint4 | pack_conf (v64uint8 v, int sign, crsat_t sat)

## Vector unpacking operations (dynamic sign)
  These intrinsics perform saturation based on the control register here: Control Register. Rounding is not done. No status flags are updated. The `sign` argument affects the extension the elements in the vector. For instance, in pseudo-code: v = {0b11111111, ...} assert unpack(v, true)[0] == 0b1111111111111111 assert unpack(v, false)[0] == 0b0000000011111111 # Reasoning: # true means v is signed so -1_8b should extend to -1_16b == 0b1111111111111111 # false means v is unsigned so 0b11111111 is 255_8b and should stay 255 in 16b == 0b0000000011111111 unpack v32int16 unpack(v32int8 v) Definition me_ldst.h:89 Parameters
  v | The input vector
  sign | indicates the sign of the pack conversion
v32int16 | unpack (v32int8 v, uint1_t sign)
v32uint16 | unpack (v32uint8 v, uint1_t sign)
v64int8 | unpack (v64int4 v, uint1_t sign)
v64uint8 | unpack (v64uint4 v, uint1_t sign)

## Function Documentation

## ◆ pack() [1/8]

v32int8 pack | ( | v32int16 | v | ) |

## ◆ pack() [2/8]

v32int8 pack | ( | v32int16 | v,
|  | int | sign )

## ◆ pack() [3/8]

v32uint8 pack | ( | v32uint16 | v | ) |

## ◆ pack() [4/8]

v32uint8 pack | ( | v32uint16 | v,
|  | int | sign )

## ◆ pack() [5/8]

v64int4 pack | ( | v64int8 | v | ) |

## ◆ pack() [6/8]

v64int4 pack | ( | v64int8 | v,
|  | int | sign )

## ◆ pack() [7/8]

v64uint4 pack | ( | v64uint8 | v | ) |

## ◆ pack() [8/8]

v64uint4 pack | ( | v64uint8 | v,
|  | int | sign )

## ◆ pack_conf() [1/8]

v32int8 pack_conf | ( | v32int16 | v,
|  | crsat_t | sat )

## ◆ pack_conf() [2/8]

v32int8 pack_conf | ( | v32int16 | v,
|  | int | sign,
|  | crsat_t | sat )

## ◆ pack_conf() [3/8]

v32uint8 pack_conf | ( | v32uint16 | v,
|  | crsat_t | sat )

## ◆ pack_conf() [4/8]

v32uint8 pack_conf | ( | v32uint16 | v,
|  | int | sign,
|  | crsat_t | sat )

## ◆ pack_conf() [5/8]

v64int4 pack_conf | ( | v64int8 | v,
|  | crsat_t | sat )

## ◆ pack_conf() [6/8]

v64int4 pack_conf | ( | v64int8 | v,
|  | int | sign,
|  | crsat_t | sat )

## ◆ pack_conf() [7/8]

v64uint4 pack_conf | ( | v64uint8 | v,
|  | crsat_t | sat )

## ◆ pack_conf() [8/8]

v64uint4 pack_conf | ( | v64uint8 | v,
|  | int | sign,
|  | crsat_t | sat )

## ◆ unpack() [1/8]

v32int16 unpack | ( | v32int8 | v | ) |

## ◆ unpack() [2/8]

v32int16 unpack | ( | v32int8 | v,
|  | uint1_t | sign )

## ◆ unpack() [3/8]

v32uint16 unpack | ( | v32uint8 | v | ) |

## ◆ unpack() [4/8]

v32uint16 unpack | ( | v32uint8 | v,
|  | uint1_t | sign )

## ◆ unpack() [5/8]

v64int8 unpack | ( | v64int4 | v | ) |

## ◆ unpack() [6/8]

v64int8 unpack | ( | v64int4 | v,
|  | uint1_t | sign )

## ◆ unpack() [7/8]

v64uint8 unpack | ( | v64uint4 | v | ) |

## ◆ unpack() [8/8]

v64uint8 unpack | ( | v64uint4 | v,
|  | uint1_t | sign )