vsubsbs

Vector Subtract Signed Byte Saturate

vsubsbs vD, vA, vB

Subtracts 16 signed bytes with saturation.

Details

The Vector Subtract Signed Byte Saturate instruction performs a subtract operation on corresponding bytes of two source vectors and writes the result to a destination vector. The subtraction is saturated, meaning that if the result overflows or underflows, it is clamped to the minimum or maximum value representable by an 8-bit signed integer.

Pseudocode Operation

if MSR.VEC=0 then Vector_Unavailable()
do i = 0 to 15
    src1 ←EXTS(VSR[VRA+32].byte[i])
    src2 ←EXTS(VSR[VRB+32].byte[i])
    VSR[VRT+32].byte[i] ←si8_CLAMP(src1 + ¬src2 + 1)
end

Programming Note

This instruction is commonly used in applications requiring vectorized arithmetic operations on signed bytes, such as image processing or audio signal processing. Ensure that the Vector Facility (MSR.VEC) is enabled before using this instruction; otherwise, a Vector_Unavailable exception will be raised. The operation saturates results to prevent overflow or underflow, which can be crucial for maintaining data integrity in certain applications.

Example

vsubsbs vd, va, vb

Encoding

Binary Layout
4
0
vD
6
vA
11
vB
16
1792
21
 
Format VX-form
Opcode 0x10000700
Extension VMX (AltiVec)
Registers Altered MSR

Operands

  • vD
    Target
  • vA
    Src A
  • vB
    Src B