Encoding:

P32A

001000

rt

rs

0001000

100

111

111

6

5

5

7

3

3

3

Format:

ABSQ_S.PH  rt, rs

DSP

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:

rt = sat16(abs(rs31..16)) || sat16(abs(rs15..0))

For each value in the pair of Q15 fractional halfword values in register rs, the absolute value is found and written to the corresponding Q15 halfword in register rt. If either input value is the minimum Q15 value (-1.0 in deci mal,

0x8000 in hexadecimal), the corresponding result is saturated to 0x7FFF.

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:

ValidateAccessToDSPResources()
tempB15..0 = satAbs16( GPR[rs]31..16 )
tempA15..0 = satAbs16( GPR[rs]15..0 )
GPR[rt]31..0 = 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