Intrinsics for moving values from vector data-types to accumulator data-types.
More...
Intrinsics for moving values from vector data-types to accumulator data-types.
Moving data from vector data-types to accumulator data-types (e.g. for initialization) requires adjustment in precision because the accumulator data-types are wider in size. For fixed point arithmetic, an appropriate left shift operation would align the decimal point between the two representations. The shift amount is specified as a parameter (in the range 0 to 63).
The upshift intrinsics performs the saturation computing and then the upshift :
input_datatype saturation ( input_datatype ival ,
int shift ,
bool & has_sat )
{
input_datatype oval
{
min = - 2^( output_precision - 1 )
max = 2^( output_precision - 1 ) - 1
if ( is_unsigned( output_datatype ) )
{
max = 2 ^ output_precision - 1
}
min = - 2 ^ output_precision + 1
{
has_sat = True
}
{
has_sat = True
}
else
{
oval = ival
}
}
else
oval = ival
return oval
}
v64uint8 min(v64uint8 a, v64uint8 b)
Calculates the minimum between two input vectors.
Definition me_vadd.h:431
v64uint8 max(v64uint8 a, v64uint8 b)
Calculates the maximum between two input vectors.
Definition me_vadd.h:504
unsigned int get_symsat()
Control for rounding mode (for Shift-Round-Saturate). See Rounding modes for possible values.
Definition me_set_mode.h:139
unsigned int get_sat()
Control for rounding mode (for Shift-Round-Saturate). See Rounding modes for possible values.
Definition me_set_mode.h:138
v64int8 shift(v64int8 a, v64int8 b, unsigned int shift)
Concatenates a and b, interprets them as a vector of 128 bytes and returns a::b[shift*elem_size:shift...
Definition me_scl2vec.h:164
No rounding is needed as there is no loss in precision. Thus, after the saturation is computed, the shift is performed:
output_datatype lane_ups ( input_datatype ival ,
int shift,
bool & sat)
{
input_datatype oval_aux
output_datatype oval
sat = False
oval_aux = saturation( ival,
shift, sat )
return oval
}
The full ups call then applies the above algorithm to all lanes of a vector and sets the status saturation bit (if saturation is triggered):
vec_output_datatype
ups ( vec_input_datatype ival ,
int shift,
bool & sat)
{
vec_output_datatype out
bool sat = False
bool sat_aux = False
for i in lanes(ival)
{
r = lane_ups(i,
shift, sat_aux)
sat |= sat_aux
}
if sat
set_ups_sat()
return out
}
v64int8 upd_elem(v64int8 v, int idx, char b)
v16accfloat ups(v16bfloat16)
- Note
- Saturation status is not cleared automatically. If set, it will remain set until the user clears the status bit.
- See also
- 'srs' intrinsics (Shift-Round-Saturate)