Encoding:

POOL32A

000000

rt

rs

sa

0

SHLL_S.W

1111110101

6

5

5

5

1

10

SPECIAL3

011111

sa

rt

rd

SHLL_S.W

10100

SHLL.QB

010011

6

5

5

5

5

6

Format:

SHLL_S.W rdt, rts, sa

microMIPSDSP

Shift Left Logical Word with Saturation

Purpose:

Shift Left Logical Word with Saturation

To execute a left shift of a word with saturation by a fixed number of bits.

Description:

rdt = sign_extend(sat32(rts << sa))

The right-most 32-bit word in register rts is shifted left by sa bits, with zeros inserted into the bit positions emptied by the shift. If the shift results in a signed overflow, the shifted result is saturated to either the maximum positive (hexadecimal 0x7FFFFFFF) or minimum negative (hexadecimal 0x80000000) 32-bit value, depending on the sign of the original unshifted value. The shifted result is then sign-extended to 64 bits and written to destination register rdt.

The instruction's sa field specifies the shift value, interpreted as a five-bit unsigned integer.

If the shift operation results in an overflow and saturation, this instruction writes a 1 to bit 22 of the DSPControl register within the ouflag field.

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 = sat32ShiftLeft( GPR[rts]31..0, sa4..0 )
GPR[rdt]63..0 = (temp31)32 || temp31..0
function sat32ShiftLeft( a13..0, s4..0 )
   if ( s = 0 ) then
      temp31..0 = a
   else
      sign = a31
      temp31..0 = ( a31-s..0 || 0s )
      discard31..0 = ( sign(32-s) || a30..30-(s-1) )
      if (( discard31..0 != 0x00000000 ) and ( discard31..0 != 0xFFFFFFFF )) then
          temp31..0 = ( sign = 0 ? 0x7FFFFFFF : 0x80000000 )
          DSPControlouflag:22 = 1
      endif
   endif
   return temp31..0
endfunction sat32ShiftLeft

Exceptions:

Reserved Instruction, DSP Disabled

Programming Notes:

To do a logical left shift of a word in a register without saturation, use the MIPS64 SLL instruction.