vabsduh

Vector Absolute Difference Unsigned Halfword

vabsduh vD, vA, vB

Computes |A - B| for halfwords.

Encoding

Binary Layout
4
0:5
vD
6:10
vA
11:15
vB
16:20
1091
21:31
 
Format VA-form
Opcode 0x10000443
Extension VMX (AltiVec)

Operands

  • vD
    Target
  • vA
    Src A
  • vB
    Src B

Example

vabsduh vd, va, vb

Registers Altered

MSR

Related

More in VMX (AltiVec)

Reference

Description

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.

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.