vavguw
Vector Average Unsigned Word
Computes (a+b+1)/2 for words.
Details
The Vector Average Unsigned Word instruction computes the average of corresponding unsigned word elements from two source vectors and stores the result in a destination vector. Each word element is treated as an unsigned integer, summed, incremented by one, right-shifted by one bit, and then truncated to fit into a word.
Pseudocode Operation
Programming Note
The vavguw instruction is used to compute the average of unsigned word elements from two vectors. Ensure that the Vector Facility (VEC) bit in the Machine State Register (MSR) is set; otherwise, a Vector_Unavailable exception will be raised. This instruction processes each 32-bit word element independently, so alignment requirements are not strict. Be cautious with potential overflow when summing large unsigned integers.
Example
Encoding
Operands
-
vD
Target -
vA
Src A -
vB
Src B