vabsduh
Vector Absolute Difference Unsigned Halfword
Computes |A - B| for halfwords.
Details
Computes the absolute value of the difference between corresponding unsigned halfwords in vA and vB, storing results in vD. Each result is calculated as |vA[i] − vB[i]| for each of four halfword elements. No condition flags are affected.
Pseudocode Operation
vD[0:15] ← |vA[0:15] − vB[0:15]| as unsigned
vD[16:31] ← |vA[16:31] − vB[16:31]| as unsigned
vD[32:47] ← |vA[32:47] − vB[32:47]| as unsigned
vD[48:63] ← |vA[48:63] − vB[48:63]| as unsigned
vD[64:79] ← |vA[64:79] − vB[64:79]| as unsigned
vD[80:95] ← |vA[80:95] − vB[80:95]| as unsigned
vD[96:111] ← |vA[96:111] − vB[96:111]| as unsigned
vD[112:127] ← |vA[112:127] − vB[112:127]| as unsigned
Programming Note
The vabsduh instruction is commonly used for vectorized image processing tasks where pixel intensity differences need to be calculated. Ensure that the input vectors are properly aligned to halfword boundaries to avoid misaligned access exceptions. This instruction operates at user privilege level and does not generate any exceptions under normal operation, but it will raise a Vector_Unavailable exception if the VEC bit in the MSR is not set.
Example
Encoding
Operands
-
vD
Target -
vA
Src A -
vB
Src B