sraw

Shift Right Algebraic Word

sraw RA, RS, RB

Performs an arithmetic right shift (sign bit replicated) on a 32-bit word. Updates Carry (CA) if bits are shifted out.

Details

The sraw instruction performs a right algebraic shift on the contents of register RS by a variable number of bits specified by (RB)58:63. The result is placed into register RA.

Pseudocode Operation

n <- RB[58:63]; RA <- (RS) >>a n

Programming Note

When Rc=1 (dot form), CR0 is updated with the signed comparison of the result against zero (LT, GT, EQ) and the current SO bit from XER.

Example

sraw r3, r4, r5

Encoding

Binary Layout
31
0
RS
6
RA
11
RB
16
792
21
Rc
31
 
Format X-form
Opcode 0x7C000638
Extension Base
Registers Altered CR0

Operands

  • RA
    Target Register
  • RS
    Source Register
  • RB
    Shift Amount Register