vsum4shs
Vector Sum-across Partial (1/4) Signed Halfword Saturate
Sums every 2 halfwords into a word.
Details
The vsum4shs instruction performs a vector sum across quarter signed halfword saturate operation. It adds the signed integer values in two halfword elements of each word from VSR[VRA+32] to the corresponding signed integer value in the same word of VSR[VRB+32]. If the intermediate result exceeds 2^31 - 1 or is less than -2^31, it saturates to these limits and sets the SAT flag. The low-order 32 bits of each result are placed into the corresponding word elements of VSR[VRT+32].
Pseudocode Operation
Programming Note
The vsum4shs instruction is commonly used for performing saturated addition of signed halfwords within vector registers. Ensure that the Vector Facility (MSR.VEC) is enabled before using this instruction; otherwise, a Vector_Unavailable exception will be raised. Be cautious with saturation handling as it can affect the results if intermediate sums exceed 32-bit integer limits.
Example
Encoding
Operands
-
vD
Target -
vA
Src A -
vB
Accumulator