AI Engine-ML Intrinsics User Guide  (v2023.2)

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
vThe input vector
v32int8 pack (v32int16 v)
 
v32uint8 pack (v32uint16 v)
 
v64int4 pack (v64int8 v)
 
v64uint4 pack (v64uint8 v)
 

Vector unpacking operations

Parameters
vThe 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
Parameters
vThe input vector
signindicates 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)
 

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
Parameters
vThe input vector
signindicates 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 
)

◆ 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 
)
unpack
v32int16 unpack(v32int8 v)
Definition: me_ldst.h:86
pack
v32int8 pack(v32int16 v)
Definition: me_ldst.h:77