Encoding:

SPECIAL3

011111

0

rt

rd

ABSQ_S.W

10001

ABSQ_S.PH

010010

6

5

5

5

5

6

Format:

ABSQ_S.W  rd, rt

MIPSDSP

Find Absolute Value of Fractional Word

Purpose:

Find Absolute Value of Fractional Word

Find the absolute value of a fractional Q31 value with 32-bit saturation.

Description:

rd = sign_extend(sat32(abs(rt31..0)))

The absolute value of the right-most Q31 fractional value in register rt is found, sign-extended to 64 bits, and written to destination register rd. If the input value is the minimum Q31 value (-1.0 in decimal, 0x80000000 in hexadecimal), the result is saturated to 0x7FFFFFFF before being sign-extended and written to register rd.

This instruction sets bit 20 in the DSPControl register in the ouflag field if the 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:

temp31..0 = satAbs32( GPR[rt]31..0 )
GPR[rd]63..0 = (temp31)32 || temp31..0
function satAbs32( a31..0 )
   if ( a31..0 = 0x80000000 ) then
      DSPControlouflag:20 = 1
      temp31..0 = 0x7FFFFFFF
   else
      if ( a31 = 1 ) then
          temp31..0 = -a31..0
      else
         temp31..0 = a31..0
      endif
   endif
   return temp31..0 
endfunction satAbs32

Exceptions:

Reserved Instruction, DSP Disabled