vclrlb

Vector Clear Left Bytes

vclrlb vD, vA, RB

Clears the leftmost bytes in a vector register based on the value in a general-purpose register.

Details

The contents of VSR[VRA+32] are placed into VSR[VRT+32] with the leftmost 16-N bytes set to 0, where N is the integer value in GPR[RB] or 16 if GPR[RB] > 15.

Pseudocode Operation

if MSR.VEC=0 then
    Vector_Unavailable()
N ← (GPR[RB] > 15) ? 16 : GPR[RB]
do i = 0 to N-1
    VSR[VRT+32].byte[15-i] ← VSR[VRA+32].byte[15-i]
end
do i = N to 15
    VSR[VRT+32].byte[15-i] ← 0x00
end

Programming Note

The vclrlb instruction is useful for clearing the leftmost bytes of a vector register based on the value in GPR[RB]. Ensure that the Vector Facility (MSR.VEC) is enabled; otherwise, a Vector_Unavailable exception will be raised. Be cautious with alignment and ensure that the values in VRA and VRT are correctly set to avoid unintended data manipulation.

Example

vclrlb vd, va, r5

Encoding

Binary Layout
4
0
vD
6
vA
11
RB
16
397
 
Format VX-form
Opcode 0x1000018D
Extension VMX (AltiVec)
Registers Altered MSR

Operands

  • vD
    Target
  • vA
    Source
  • RB
    Count (GPR)
  • VRT
    Target Vector Register
  • VRA
    Source Vector Register