Encoding:

MSA

011110

1110

df

wt

ws

wd

3RF

011100

6

4

1

5

5

5

6

Format:

MSUBR_Q.df 

Vector Fixed-Point Multiply and Subtract Rounded

MSUBR_Q.H wd,ws,wt

MSA

Vector Fixed-Point Multiply and Subtract Rounded

MSUBR_Q.W wd,ws,wt

MSA

Vector Fixed-Point Multiply and Subtract Rounded

Purpose:

Vector Fixed-Point Multiply and Subtract Rounded

Vector fixed-point multiply and subtract rounded.

Description:

wd[i] = saturate(round(wd[i] - ws[i] * wt[i]))

The products of fixed-point elements in vector wt by fixed-point elements in vector ws are subtracted from the fixedpoint elements in vector wd. The multiplication result is not saturated, i.e. exact (-1) * (-1) = 1 is subtracted from the destination. The rounded and saturated fixed-point results are stored back to wd.

Internally, the multiplication, subtraction, and rounding operate on data double the size of df. Truncation to fixedpoint data format df is performed at the very last stage, after saturation.

The rounding is done by adding 1 to the most significant bit that is going to be discarded at truncation.

The operands and results are values in fixed-point data format df.

Restrictions:

No data-dependent exceptions are possible.

Operation:

MSUBR_Q.H
   for i in 0 .. WRLEN/16-1
      WR[wd]16i+15..16i = 
             q_msubr(WR[wd]16i+15..16i, WR[ws]16i+15..16i, WR[wt]16i+15..16i, 16)
   endfor
MSUBR_Q.W
   for i in 0 .. WRLEN/32-1
      WR[wd]32i+31..32i = 
             q_msubr(WR[wd]32i+31..32i, WR[ws]32i+31..32i, WR[wt]32i+31..32i, 32)
   endfor
function mulx_s(ts, tt, n)
   s = (tsn-1)n || tsn-1..0 
   t = (ttn-1)n || ttn-1..0
   p = s * t 
   return p2n-1..0
endfunction mulx_s
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 q_msubr(td, ts, tt, n)
   p = mulx_s(ts, tt, n)
   d = (tdn-1 || tdn-1..0 || 0n-1) - p2n-1..0
   d = d + (1 || 0n-2)
   d = sat_s(d2n-1..n-1, n+1, n)
   return dn-1..0
endfunction q_msubr

Exceptions:

Reserved Instruction Exception, MSA Disabled Exception.