vsrah
Vector Shift Right Algebraic Halfword
Arithmetic right shift of halfwords.
Details
The Vector Shift Right Algebraic Halfword instruction (vsrah) shifts each halfword element of the source vector right by a specified number of bits. The shift amount is determined by the low-order 4 bits of the corresponding halfword in the second source vector. Bits shifted out are discarded, and copies of the sign bit (bit 0) are supplied to the vacated positions on the left.
Pseudocode Operation
Programming Note
The vsrah instruction is used to perform right algebraic shifts on halfword elements of a vector. Ensure that the Vector Facility (MSR.VEC) is enabled before using this instruction; otherwise, a Vector_Unavailable exception will be raised. The shift amount for each element is determined by the low-order 4 bits of the corresponding element in the second source vector. Be cautious with alignment as halfword operations require proper alignment to avoid undefined behavior.
Example
Encoding
Operands
-
vD
Target -
vA
Data -
vB
Shift