vsumsws
Vector Sum-across Signed Word Saturate
Adds the contents of four word elements of one vector register to a single word element of another vector register and saturates the result.
Details
The sum of the signed integer values in the four word elements of VSR[VRA+32] is added to the signed integer value in the word element 3 of VSR[VRB+32]. The low-order 32 bits of the result are placed into word element 3 of VSR[VRT+32], and the high-order 96 bits are set to zero. If the intermediate result is greater than 2^31 - 1, it saturates to 2^31 - 1; if less than -2^31, it saturates to -2^31.
Pseudocode Operation
Programming Note
This instruction is useful for accumulating sums of signed integers with saturation, preventing overflow. Ensure that the vector registers are properly aligned and that the VEC bit in the MSR is set to 1. Be aware of the saturation behavior; if the sum exceeds the 32-bit signed integer range, it will be clamped to the maximum or minimum value. The result is stored only in the fourth word element of the destination register, with the other elements zeroed out.
Example
Encoding
Operands
-
vD
Target -
vA
Src A -
vB
Accumulator -
VRT
Target Vector Register -
VRA
Source Vector Register -
VRB
Source Vector Register -
VA
Source Vector Register -
VB
Source Vector Register -
VC
Source Vector Register