srq (Shift Right with MQ) instruction

Purpose

Rotates the contents of a general-purpose register to the left by a specified number of bits, places the rotated word in the MQ Register, and places the logical AND of the rotated word and a generated mask in a general-purpose register.

Note: The srq instruction is supported only in the POWER® family architecture.

Syntax

Bits Value
0 - 5 31
6 - 10 RS
11 - 15 RA
16 - 20 RB
21 - 30 664
31 Rc
POWER® family 
srq RA, RS, RB
srq. RA, RS, RB

Description

The srq instruction rotates the contents of the source general-purpose register (GPR) RS to the left by 32 minus N bits, where N is the shift amount specified in bits 27-31 of GPR RB, and stores the rotated word in the MQ Register. The mask depends on bit 26 of GPR RB.

Consider the following when using the srq instruction:

  • If bit 26 of GPR RB is 0, then a mask of N zeros followed by 32 minus N ones is generated.
  • If bit 26 of GPR RB is 1, then a mask of all zeros is generated.

This instruction then stores the logical AND of the rotated word and the generated mask in GPR RA.

The srq instruction has two syntax forms. Each syntax form has a different effect on Condition Register Field 0.

Item Description
Syntax Form Overflow Exception (OE) Fixed-Point Exception Register Record Bit (Rc) Condition Register Field 0
srq None None 0 None
srq. None None 1 LT,GT,EQ,SO

The two syntax forms of the srq instruction never affect the Fixed-Point Exception Register. If the syntax form sets the Record (Rc) bit to 1, the instruction affects the Less Than (LT) zero, Greater Than (GT) zero, Equal To (EQ) zero, and Summary Overflow (SO) bits in Condition Register Field 0.

Parameters

Item Description
RA Specifies target general-purpose register where result of operation is stored.
RS Specifies source general-purpose register for operation.
RB Specifies source general-purpose register for operation.

Examples

  1. The following code rotates the contents of GPR 4 to the left by 28 bits, places the rotated word in the MQ Register, and places logical AND of the rotated word and the generated mask in GPR 6:
    
    # Assume GPR 4 holds 0x9000 300F.
    # Assume GPR 25 holds 0x0000 00024.
    srq 6,4,25
    # GPR 6 now holds 0x0000 0000.
    # The MQ Register now holds 0xF900 0300.
    
  2. The following code rotates the contents of GPR 4 to the left by 28 bits, places the rotated word in the MQ Register, places logical AND of the rotated word and the generated mask in GPR 6, and sets Condition Register Field 0 to reflect the result of the operation:
    
    # Assume GPR 4 holds 0xB000 300F.
    # Assume GPR 25 holds 0x0000 0004.
    srq. 6,4,8
    # GPR 6 now holds 0x0B00 0300.
    # The MQ Register now holds 0xFB00 0300.
    # Condition Register Field 0 now contains 0x4.