Context Navigation

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<N>::op(a, b) for each
operation op, where a and b are operand vectors of N bit fields and r is
the corresponding result vector.

add

addition

ri = ai + bi

sub

subtraction

ri = ai - bi

mul

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 << bi

srl

shift right logical

ri = u(ai) >> bi

sra

shift right arithmetic

ri = s(ai) >> bi

Unary Operations

These operations generally have the form r = simd<N>::op(a) for each
operation op, where a is an operand vector of N 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 >> N/2

l(ai) = ai & (1 << N/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)

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<N>::op(a, b, c) for each
operation op, where a, b, and c are operand vectors of N bit fields and r is
the corresponding result vector.