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.
Encoding
Binary Layout
4
0:5
vD
6:10
vA
11:15
RB
16:20
397
21:31
Operands
-
vD
Target -
vA
Source -
RB
Count (GPR) -
VRT
Target Vector Register -
VRA
Source Vector Register
Reference
View in PowerISA v3.1C Specification ↗
OPF Power ISA v3.1C
Description
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.
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.