Encoding:

SPECIAL3

011111

0

00000

rt

rd

ABSQ_S.PH

01001

ABSQ_S.PH

010010

6

5

5

5

5

6

Format:

ABSQ_S.PH  rd, rt

MIPSDSP

Find Absolute Value of Two Fractional Halfwords

Purpose:

Find Absolute Value of Two Fractional Halfwords

Find the absolute value of each of a pair of Q15 fractional halfword values with 16-bit saturation.

Description:

rd = sign_extend(sat16(abs(rt31..16))) || sat16(abs(rt15..0))

For each value in the right-most pair of Q15 fractional halfword values in register rt, the absolute value is found and written to the corresponding Q15 halfword in register rd. If either input value is the minimum Q15 value (-1.0 in decimal, 0x8000 in hexadecimal), the corresponding result is saturated to 0x7FFF. The upper 32 bits of register rt are ignored.

The sign of the left-most halfword result is extended into the 32 most-significant bits of the destination register.

This instruction sets bit 20 in the DSPControl register in the ouflag field if either input value was saturated.

Restrictions:

No data-dependent exceptions are possible.

The operands must be values in the specified format. If they are not, the results are UNPREDICTABLE and the values of the operand vectors become UNPREDICTABLE.

Operation:

tempB15..0 = satAbs16( GPR[rt]31..16 )
tempA15..0 = satAbs16( GPR[rt]15..0 )
GPR[rd]63..0 = (tempB15)32 || tempB15..0 || tempA15..0
function satAbs16( a15..0 )
   if ( a15..0 = 0x8000 ) then
      DSPControlouflag:20 = 1
      temp15..0 = 0x7FFF
   else
      if ( a15 = 1 ) then
          temp15..0 = -a15..0
      else
         temp15..0 = a15..0
      endif
   endif
   return temp15..0 
endfunction satAbs16

Exceptions:

Reserved Instruction, DSP Disabled