Encoding:

MSA

011110

000

df

wt

ws

wd

3R

010001

6

3

2

5

5

5

6

Format:

SUBS_S.df 

Vector Signed Saturated Subtract of Signed Values

SUBS_S.B wd,ws,wt

MSA

Vector Signed Saturated Subtract of Signed Values

SUBS_S.H wd,ws,wt

MSA

Vector Signed Saturated Subtract of Signed Values

SUBS_S.W wd,ws,wt

MSA

Vector Signed Saturated Subtract of Signed Values

SUBS_S.D wd,ws,wt

MSA

Vector Signed Saturated Subtract of Signed Values

Purpose:

Vector Signed Saturated Subtract of Signed Values

Vector subtraction from vector saturating the result as signed value.

Description:

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

The elements in vector wt are subtracted from the eleme nts in vector ws. Signed arithmetic is performed and o verflows 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:

SUBS_S.B
   for i in 0 .. WRLEN/8-1
      WR[wd]8i+7..8i = subs_s(WR[ws]8i+7..8i, WR[wt]8i+7..8i, 8)
   endfor
SUBS_S.H
   for i in 0 .. WRLEN/16-1
      WR[wd]16i+15..16i = subs_s(WR[ws]16i+15..16i, WR[wt]16i+15..16i, 16)
   endfor
SUBS_S.W
   for i in 0 .. WRLEN/32-1
      WR[wd]32i+31..32i = subs_s(WR[ws]32i+31..32i, WR[wt]32i+31..32i, 32)
   endfor
SUBS_S.D
   for i in 0 .. WRLEN/64-1
      WR[wd]64i+63..64i = subs_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 subs_s(ts, tt, n)
   t = (tsn-1 || ts) - (ttn-1 || tt)
   return sat_s(t, n+1, n)
endfunction subs_s

Exceptions:

Reserved Instruction Exception, MSA Disabled Exception.