Encoding:

SPECIAL

000000

rs

rt

rd

000

sa

LSA

000101

6

5

5

5

3

2

6

Format:

LSA 

Left Shift Add

LSA rd,rs,rt,sa

MSA

Left Shift Add

Purpose:

Left Shift Add

To left-shift a word by a fixed number of bits and add the result to another word.

Description:

GPR[rd] = (GPR[rs] << (sa + 1)) + GPR[rt]

The 32-bit word value in GPR rs is shifted left, inserting zeros into the emptied bits; the 32-bit word result is added to the 32-bit value in GPR rt and the 32-bit arithmetic result is sign-extended and placed into GPR rd.

No Integer Overflow exception occurs under any circumstances.

Restrictions:

A Reserved Instruction Exception is signaled if MSA implementation is not present.

If GPR rt does not contain sign-extended 32-bit values (bits 63..31 equal), then the result of the operation is UNPREDICTABLE.

Operation:

if NotWordValue(GPR[rt]) then
   UNPREDICTABLE
endif
if Config3MSAP = 1 then
   s = sa + 1
   temp = (GPR[rs](31-s)..0 || 0s) + GPR[rt]
   GPR[rd] = sign_extend(temp31..0)
else
   SignalException(ReservedInstruction)
endif

Exceptions:

Reserved Instruction Exception.

Programming Notes:

Unlike nearly all other word operations, the LSA input operand GPR rs does not have to be a properly sign-extended word value to produce a valid sign-extended 32-bit result. The result word is always sign-extended into a 64-bit destination register.