Version 9 (modified by cameron, 8 years ago) (diff) |
---|
IDISA Vertical Operations
The tables below list the various IDISA vertical operations on vectors of N-bit fields, together with their description and semantic specification.
In general, operand fields may be interpreted as either signed or unsigned N-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 N-bits by truncation.
Binary Operations
These operations generally have the form r = simd<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.
add | addition | r_{i} = a_{i} + b_{i} |
sub | subtraction | r_{i} = a_{i} - b_{i} |
mul | multiplication | r_{i} = a_{i} * b_{i} |
eq | equality | r_{i} = if a_{i} = b_{i} then -1 else 0 |
gt | greater than | r_{i} = if s(a_{i}) > s(b_{i}) then -1 else 0 |
ugt | unsigned greater than | r_{i} = if u(a_{i}) > u(b_{i}) then -1 else 0 |
lt | less than | r_{i} = if s(a_{i}) < s(b_{i}) then -1 else 0 |
ult | unsigned less than | r_{i} = if u(a_{i}) < u(b_{i}) then -1 else 0 |
max | maximum value | r_{i} = if s(a_{i}) > s(b_{i}) then a_{i} else b_{i} |
umax | unsigned maximum value | r_{i} = if u(a_{i}) > u(b_{i}) then a_{i} else b_{i} |
min | minimum value | r_{i} = if s(a_{i}) < s(b_{i}) then a_{i} else b_{i} |
umin | unsigned minimum value | r_{i} = if u(a_{i}) < u(b_{i}) then a_{i} else b_{i} |
sll | shift left logical | r_{i} = a_{i} << b_{i} |
srl | shift right logical | r_{i} = u(a_{i}) >> b_{i} |
sra | shift right arithmetic | r_{i} = s(a_{i}) >> b_{i} |
Unary Operations
These operations generally have the form r = simd<w>::op(a) for each operation op, where a is an operand vector of w bit fields and r is the corresponding result vector.
Some of these operations involve operations on the high half of each field h(a_{i}) and the the low half of each field l(a_{i}), where
- h(a_{i}) = a_{i} >> w/2
- l(a_{i}) = a_{i} & ((1 << w/2) - 1)
Some operations also involve an immediate shift operand supplied as template parameter <k>: these shift all fields by the same constant amount.
abs | absolute value | r_{i} = if s(a_{i}) < 0 then -a_{i} else a_{i} |
neg | negate | r_{i} = -s(a_{i}) |
add_hl | add halves | r_{i} = h(a_{i}) + l(a_{i}) using w-bit addition |
xor_hl | bitwise xor halves | r_{i} = h(a_{i}) xor l(a_{i}) |
slli<k> | shift left logical immediate | r_{i} = a_{i} << k |
srli<k> | shift right logical immediate | r_{i} = u(a_{i}) >> k |
srai<k> | shift right arithmetic immediate | r_{i} = s(a_{i}) >> k |
popcount | population count | r_{i} = number of 1 bits in u(a_{i}) |
ctz | count trailing zeroes | r_{i} = the number of consecutive 0 bits in a_{i} counting from the right |
Ternary Operation
This operation has the form r = simd<w>::op(a, b, c) for each operation op, where a, b, and c are operand vectors of w bit fields and r is the corresponding result vector.
if | if sign bit | r_{i} = if s(a_{i}) < 0 then b_{i} else c_{i} |