vstribl

Vector String Isolate Byte Left

vstribl vD, vB

Stores the leftmost byte of each element in a vector register to memory.

Details

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.

Pseudocode 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.

Example

vstribl vd, vb

Encoding

Binary Layout
4
0
VRT
6
0
11
VRB
16
Rc
21
13
22
 
Format VX-form
Opcode 0x1000000D
Extension VMX (AltiVec)

Operands

  • vD
    Target
  • vB
    Source
  • VS32
    Target Vector Register
  • VS31
    Source Vector Register
  • RB
    Base Address General Purpose Register