vstribl
Vector String Isolate Byte Left
vstribl vD, vB
Stores the leftmost byte of each element in a vector register to memory.
Encoding
Binary Layout
4
0:5
VRT
6:10
0
11:15
VRB
16:20
Rc
21
13
22:31
Operands
-
vD
Target -
vB
Source -
VS32
Target Vector Register -
VS31
Source Vector Register -
RB
Base Address General Purpose Register
Example
vstribl vd, vb
Related
More in VMX (AltiVec)
Reference
View in PowerISA v3.1C Specification ↗
OPF Power ISA v3.1C
Description
Isolates the leftmost non-zero byte in each element of the source vector register and stores the result in the destination vector register. This is a VMX instruction that does not affect condition registers or status fields.
Operation
for i in 0 to 15 do
found ← 0
for j in 0 to 7 do
if vB[i*8 + j] != 0 then
vD[i*8:(i+1)*8-1] ← vB[j*8:(j+1)*8-1]
found ← 1
break
end if
end for
if found = 0 then
vD[i*8:(i+1)*8-1] ← 0
end if
end for
Programming Note
The vstribl instruction is useful for extracting the first character from strings stored in vector registers. Ensure that the input vectors are properly aligned to avoid alignment faults. This instruction operates at user privilege level and will raise an exception if executed in a kernel context without proper permissions.