Encoding:

MSA

011110

110

df

wt

ws

wd

3R

010101

6

3

2

5

5

5

6

Format:

HSUB_S.df 

Vector Signed Horizontal Subtract

HSUB_S.H wd,ws,wt

MSA

Vector Signed Horizontal Subtract

HSUB_S.W wd,ws,wt

MSA

Vector Signed Horizontal Subtract

HSUB_S.D wd,ws,wt

MSA

Vector Signed Horizontal Subtract

Purpose:

Vector Signed Horizontal Subtract

Vector sign extend and pairwise subtract the even elements from the odd elements to double width elements

Description:

(wd[2i+1], wd[2i]) = signed(ws[2i+1]) - signed(wt[2i])

The sign-extended odd elements in vector wt are subtracted from the sign-extended even elements in vector wt producing a signed result twice the size of the input operands. The result is written to vector wd.

The operands are values in integer data format half the size of df. The results are values in integer data format df.

Restrictions:

No data-dependent exceptions are possible.

Operation:

HSUB_S.H
   for i in 0 .. WRLEN/16-1
      WR[wd]16i+15..16i = hsub_s(WR[ws]16i+15..16i, WR[wt]16i+15..16i, 8)
   endfor
HSUB_S.W
   for i in 0 .. WRLEN/32-1
      WR[wd]32i+31..32i = hsub_s(WR[ws]32i+31..32i, WR[wt]32i+31..32i, 16)
   endfor
HSUB_S.D
   for i in 0 .. WRLEN/64-1
      WR[wd]64i+63..64i = hsub_s(WR[ws]64i+63..64i, WR[wt]64i+63..64i, 32)
   endfor
function hsub_s(ts, tt, n)
   t = ((ts2n-1)n || ts2n-1..n) - ((ttn-1)n || ttn-1..0)
   return t
endfunction hsub_s

Exceptions:

Reserved Instruction Exception, MSA Disabled Exception.