vstribr

Vector String Isolate Byte Right

vstribr VRT,VRB
vstribr. VRT,VRB

Isolates the rightmost non-zero byte in a vector string and shifts it to the left.

Details

The vstribr instruction isolates the rightmost non-zero byte in VSR[VRB+32] and shifts it to the left, filling the remaining bytes with zeros. If Rc=1, CR6 is updated based on whether a null character was found.

Pseudocode Operation

if MSR.VEC=0 then
    Vector_Unavailable()
null_found ←0
while (!null_found) do i = 0 to 15
    null_found ←(VSR[VRB+32].byte[15-i] = 0)
    VSR[VRT+32].byte[15-i] ←VSR[VRB+32].byte[15-i]
end
do j = i to 15
    VSR[VRT+32].byte[15-j] ←0
end
if Rc=1 then
    CR.field[6] ←0b00 || null_found || 0b0

Programming Note

When Rc=1, CR1 is set from the FPSCR[FX, FEX, VX, OX] bits immediately after the operation completes.

Example

vstribr v1, v3

Encoding

Binary Layout
0
0
VRT
6
VRB
11
Rc
16
13
21
 
Format VX-form
Opcode 0x10000246
Extension VMX (AltiVec)
Registers Altered CR6 (if Rc=1)

Operands

  • vD
    Target
  • vB
    Source
  • VRT
    Target Vector Register
  • VRB
    Source Vector Register