Encoding:

MSA

011110

010

df

wt

ws

wd

3R

010000

6

3

2

5

5

5

6

Format:

ADDS_S.df 

Vector Signed Saturated Add of Signed Values

ADDS_S.B wd,ws,wt

MSA

Vector Signed Saturated Add of Signed Values

ADDS_S.H wd,ws,wt

MSA

Vector Signed Saturated Add of Signed Values

ADDS_S.W wd,ws,wt

MSA

Vector Signed Saturated Add of Signed Values

ADDS_S.D wd,ws,wt

MSA

Vector Signed Saturated Add of Signed Values

Purpose:

Vector Signed Saturated Add of Signed Values

Vector addition to vector saturating the result as signed value.

Description:

wd[i] = saturate_signed(signed(ws[i]) + signed(wt[i]))

The elements in v ector wt are added to the ele ments in vector ws. Signed arithmetic is performed and overflows clamp to the largest and/or smallest representable signed values before writing the result to vector wd.

The operands and results are values in integer data format df.

Restrictions:

No data-dependent exceptions are possible.

Operation:

ADDS_S.B:
   for i in 0 .. WRLEN/8-1
      WR[wd]8i+7..8i = adds_s(WR[ws]8i+7..8i, WR[wt]8i+7..8i, 8)
   endfor
ADDS_S.H:
   for i in 0 .. WRLEN/16-1
      WR[wd]16i+15..16i = adds_s(WR[ws]16i+15..16i, WR[wt]16i+15..16i, 16)
   endfor
ADDS_S.W:
   for i in 0 .. WRLEN/32-1
      WR[wd]32i+31..32i = adds_s(WR[ws]32i+31..32i, WR[wt]32i+31..32i, 32)
   endfor
ADDS_S.D:
   for i in 0 .. WRLEN/64-1
      WR[wd]64i+63..64i = adds_s(WR[ws]64i+63..64i, WR[wt]64i+63..64i, 64)
   endfor
function sat_s(tt, n, b)
   if ttn-1 = 0 and ttn-1..b-1 != 0n-b+1 then
      return 0n-b+1 || 1b-1
   endif
   if ttn-1 = 1 and ttn-1..b-1 != 1n-b+1 then
      return 1n-b+1 || 0b-1
   else
      return tt
   endif
endfunction sat_s
function adds_s(ts, tt, n)
   t = (tsn-1 || ts) + (ttn-1 || tt)
   return sat_s(t, n+1, n)
endfunction adds_s

Exceptions:

Reserved Instruction Exception, MSA Disabled Exception.