sradi

Shift Right Algebraic Doubleword Immediate

sradi RA, RS, SH

Performs an arithmetic right shift on a 64-bit doubleword by a constant amount.

Details

Arithmetically shifts RS right by SH bit positions (0–63), preserving the sign bit and shifting in sign-extended bits. Sets XER[CA] if any 1-bits are shifted out from a negative number. The condition register CR0 is updated if Rc=1.

Pseudocode Operation

n ← SH
RA ← RS >>a n
if RS < 0 & (RS & MASK(64-n, 63)) ≠ 0 then XER[CA] ← 1
else XER[CA] ← 0
if Rc = 1 then CR0 ← (RA < 0, RA > 0, RA = 0, SO)

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

sradi r3, r4, 10

// r3 = r4 >> 10 (Signed 64-bit).

Encoding

Binary Layout
31
0
RS
6
RA
11
SH
16
413
21
Rc
31
 
Format XS-form
Opcode 0x7C000674
Extension Base
Registers Altered CR0

Operands

  • RA
    Target Register
  • RS
    Source Register
  • SH
    Shift Amount (0-63, Split field)