wiki:IDISA_Vertical

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 ri = ai + bi
sub subtraction ri = ai - bi
mult multiplication ri = ai * bi
eq equality ri = if ai = bi then -1 else 0
gt greater than ri = if s(ai) > s(bi) then -1 else 0
ugt unsigned greater than ri = if u(ai) > u(bi) then -1 else 0
lt less than ri = if s(ai) < s(bi) then -1 else 0
ult unsigned less than ri = if u(ai) < u(bi) then -1 else 0
max maximum value ri = if s(ai) > s(bi) then ai else bi
umax unsigned maximum value ri = if u(ai) > u(bi) then ai else bi
min minimum value ri = if s(ai) < s(bi) then ai else bi
umin unsigned minimum value ri = if u(ai) < u(bi) then ai else bi
sll shift left logical ri = ai << (u(bi) mod w)
srl shift right logical ri = u(ai) >> (u(bi) mod w)
sra shift right arithmetic ri = s(ai) >> (u(bi) mod w)

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(ai) and the the low half of each field l(ai), where

  • h(ai) = ai >> w/2
  • l(ai) = ai & ((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 ri = if s(ai) < 0 then -ai else ai
neg negate ri = -s(ai)
add_hl add halves ri = h(ai) + l(ai) using w-bit addition
xor_hl bitwise xor halves ri = h(ai) xor l(ai)
slli<k> shift left logical immediate ri = ai << k
srli<k> shift right logical immediate ri = u(ai) >> k
srai<k> shift right arithmetic immediate ri = s(ai) >> k
popcount population count ri = number of 1 bits in u(ai)
ctz count trailing zeroes ri = the number of consecutive 0 bits in ai 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 ri = if s(ai) < 0 then bi else ci
Last modified 4 years ago Last modified on Jan 5, 2014, 11:34:10 PM