vsubsws
Vector Subtract Signed Word Saturate
Subtracts 4 signed words with saturation.
Details
The vsubsws instruction performs a vectorized subtraction of signed words from two source vectors, saturating the result to the range [-128, 127]. If the result exceeds these bounds, it is clamped to the nearest boundary value, and the SAT flag in the VSCR register is set.
Pseudocode Operation
Programming Note
The vsubsws instruction is useful for performing vectorized subtraction of signed words with saturation, ensuring that results do not overflow. Ensure that the VEC bit in the MSR register is set to enable vector operations; otherwise, a Vector_Unavailable exception will be raised. Be aware that the SAT flag in the VSCR register indicates if any result was saturated during the operation.
Example
Encoding
Operands
-
vD
Target -
vA
Src A -
vB
Src B