Version 11 (modified by cameron, 8 years ago) (diff)

--

# 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 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(abi) = abi >> w/2
• l(abi) = abi & ((1 << w/2) - 1)
 add_hl horizontal addition ri = h(abi) + l(abi) min_hl minimum value ri = if s(h(abi)) < s(l(abi)) then h(abi) else l(abi) umin_hl minimum value ri = if u(h(abi)) < u(l(abi)) then h(abi) else l(abi) packl pack low ri = l(abi) packh pack high ri = h(abi) packus pack with unsigned saturation ri = us(abi) packss pack with signed saturation ri = ss(abi)

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

## 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.