slw.

Shift Left Word Immediate

slw. RT,RA,RB

Shifts the contents of a register left by a specified number of bits and updates the condition register.

Details

For slw., the contents of register RA are shifted left by the amount specified in RB, and the result is placed into register RT. The shift count is masked to 5 bits.

Pseudocode Operation

if 'slw.' then
    RT <- (RA) << ((RB) & 31)

Programming Note

The slw instruction shifts the contents of RA left by a number of bits specified in RB, with the shift count masked to 5 bits. This operation is useful for bit manipulation tasks but be cautious as shifting large values can lead to overflow. The result is stored in RT, and this instruction operates at user privilege level.

Example

slw. r3, r4, r5

Encoding

Binary Layout
18
0
LI
6
AA
30
LK
31
 
Format XO-form
Opcode 0x7C000031
Extension Base
Registers Altered CR0, XER

Operands

  • RT
    Target General Purpose Register
  • RA
    Source General Purpose Register
  • RB
    Shift Count (0-31)