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.
In general, horizontal SIMD operations combine data from multiple fields of a register.
Binary Packing Operations
These operations generally have the form r = hsimd<w>::op(a, b) for each operation op, where a and b considered to be consecutive W-bit operand vectors of w-bit fields and r is the corresponding result vector of w/2-bit fields. Let ab represent the 2W-bit concatenation of a and b. The the result vector consists of the w/2 bit results of applying op to each field of ab.
In several cases, the operation op involves the the functions h and l which extract the high and low w/2 bits each of fields of ab.
- h(ab_{i}) = ab_{i} >> w/2
- l(ab_{i}) = ab_{i} & ((1 << w/2) - 1)
add_hl | horizontal addition | r_{i} = h(ab_{i}) + l(ab_{i}) |
min_hl | minimum value | r_{i} = if s(h(ab_{i})) < s(l(ab_{i})) then h(ab_{i}) else l(ab_{i}) |
umin_hl | minimum value | r_{i} = if u(h(ab_{i})) < u(l(ab_{i})) then h(ab_{i}) else l(ab_{i}) |
packl | pack low | r_{i} = l(ab_{i}) |
packh | pack high | r_{i} = h(ab_{i}) |
packus | pack with unsigned saturation | r_{i} = us(ab_{i}) |
packss | pack with signed saturation | r_{i} = ss(ab_{i}) |
where the w-bit unsigned and signed saturation functions are defined as follows.
- us_{w}(x) = x, if u(x) < 2^{w}
- us_{w}(x) = 2^{w}-1, if u(x) >= 2^{w}
- ss_{w}(x) = x, if -2^{w-1} <= s(x) < 2^{w-1}
- ss_{w}(x) = 2^{w-1}-1, if s(x) >= 2^{w-1}
- ss_{w}(x) = -2^{w-1}, if s(x) < 2^{w-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.