vsrh
Vector Shift Right Halfword
Shifts the contents of each element in a vector right by a specified number of bits.
Details
The Vector Shift Right Halfword instruction 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 on the least significant side are lost, and zeros are filled in on the most significant side.
Pseudocode Operation
Programming Note
The vsrh instruction is used to perform element-wise right shifts on halfwords within a vector. Ensure that the shift amounts in the second source vector are within the range of 0-15 to avoid unexpected behavior. This instruction requires the VEC bit in the MSR register to be set; otherwise, it will raise an exception. Be cautious with alignment as unaligned access might lead to performance penalties or exceptions depending on the system configuration.
Example
Encoding
Operands
-
vD
Target -
vA
Data -
vB
Shift -
VRT
Target Vector Register -
VRA
Source Vector Register -
VRB
Source Vector Register