|Version 9 (modified by cameron, 3 years ago)|
Horizontal Packing Operations
The table below lists the various IDISA horizontal operations on vectors of w-bit fields, together with their description and semantic specification.
Binary Packing Operations
These operations generally have the form r = hsimd<w>::op(a, b) for each operation op, where a and b are operand vectors of w-bit fields and r is the corresponding result vector.
In general, operand fields may be interpreted as either signed or unsigned w-bit integers, depending on the operation. When the results depend on this interpretation, the notation s(a) refers to the interpretation of field a as a signed integer (2's complement interpretation), while the notation u(a) refers to the interpretation as an unsigned integer (natural binary interpretation).
In general, result fields are converted to w bits by truncation.
|add||addition||ri = c2i + c2i+1|
|min||minimum value||ri = if s(c2i) < s(c2i+1) then c2i else c2i+1|
|umin||minimum value||ri = if u(c2i) < u(c2i+1) then c2i else c2i+1|
|packl||pack low||ri = c2i+1|
|packh||pack high||ri = c2i|
|packus||pack with unsigned saturation||ri = usN(concat(c2i, c2i+1))|
|packss||pack with signed saturation||ri = ssN(concat(c2i, c2i+1))|
where the w-bit unsigned and signed saturation functions are defined as follows.
- usw(x) = x, if u(x) < 2w
- usw(x) = 2w-1, if u(x) >= 2w
- ssw(x) = x, if -2w-1 <= s(x) < 2w-1
- ssw(x) = 2w-1-1, if s(x) >= 2w-1
- ssw(x) = -2w-1, if s(x) < 2w-1
In these definitions, fields are numbered left-to-right in so-called *big-endian* style. Implementations using little-endian processors generally reverse the arguments c2i and c2i+1.
Horizontal Bit Packing
The operation n = hsimd<w>::signmask(a) packs together the high (sign) bits of each w-bit field of a, returning the result as an ordinary integer value.