Encoding:

MSA

011110

110

df

wt

ws

wd

3R

010000

6

3

2

5

5

5

6

Format:

AVER_S.df 

Vector Signed Average Rounded

AVER_S.B wd,ws,wt

MSA

Vector Signed Average Rounded

AVER_S.H wd,ws,wt

MSA

Vector Signed Average Rounded

AVER_S.W wd,ws,wt

MSA

Vector Signed Average Rounded

AVER_S.D wd,ws,wt

MSA

Vector Signed Average Rounded

Purpose:

Vector Signed Average Rounded

Vector average rounded using the signed values.

Description:

wd[i] = (ws[i] + wt[i] + 1) / 2

The elements in vector wt are added to the elements in vector ws. The addition of the elements plus 1 (for rounding) is done signed with full precision, i.e. the result has one extra bit. Signed division by 2 (or arithmetic shift right by one bit) is performed 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:

AVER_S.B:
   for i in 0 .. WRLEN/8-1
      WR[wd]8i+7..8i = aver_s(WR[ws]8i+7..8i, WR[wt]8i+7..8i, 8)
   endfor
AVER_S.H:
   for i in 0 .. WRLEN/16-1
      WR[wd]16i+15..16i = aver_s(WR[ws]16i+15..16i, WR[wt]16i+15..16i, 16)
   endfor
AVER_S.W:
   for i in 0 .. WRLEN/32-1
      WR[wd]32i+31..32i = aver_s(WR[ws]32i+31..32i, WR[wt]32i+31..32i, 32)
   endfor
AVER_S.D:
   for i in 0 .. WRLEN/64-1
      WR[wd]64i+63..64i = aver_s(WR[ws]64i+63..64i, WR[wt]64i+63..64i, 64)
   endfor
function ave_s(ts, tt, n)
   t = (tsn-1 || ts) + (ttn-1 || tt) + 1
   return tn..1
endfunction aver_s

Exceptions:

Reserved Instruction Exception, MSA Disabled Exception.