vclrrb

Vector Clear Right Bytes

vclrrb vD, vA, RB

Clears the N rightmost bytes of a vector.

Details

The Vector Clear Rightmost Bytes instruction (vclrrb) copies the contents of each byte element from VSR[VRA+32] to VSR[VRT+32]. If the integer value in GPR[RB] is greater than 15, N is set to 16; otherwise, N is the integer value in GPR[RB]. Bytes from position N to 15 in VSR[VRT+32] are then cleared (set to 0x00).

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[i] ←VSR[VRA+32].byte[i]
end
do i = N to 15
   VSR[VRT+32].byte[i] ←0x00
end

Programming Note

The vclrrb instruction is useful for clearing the rightmost bytes of a vector register based on a specified count. Ensure that the Vector Facility (MSR.VEC) is enabled to avoid a Vector_Unavailable exception. The value in GPR[RB] should be between 0 and 15; values greater than 15 will result in all bytes being cleared. This instruction operates on vector registers, so ensure proper alignment and privilege level as required by the system.

Example

vclrrb vd, va, r5

Encoding

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

Operands

  • vD
    Target
  • vA
    Source
  • RB
    Count (GPR)