Version 3 (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, or signed or unsigned saturation. When the results depend on the interpration t(x) refers to the truncation of a field to the N least significant bits of x, ss(x) refers to conversion by signed saturation and us(x) refers to conversion by unsigned saturation.

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

## IDISA 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)
 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 shift left logical immediate ri = ai << k srli shift right logical immediate ri = u(ai) >> k srai 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

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

 if if sign bit ri = if s(ai) < 0 then bi else ci