vgnb

Vector Gather Non-Zero Bytes

vgnb vD, vB, UIM

Gathers every Nth bit from a vector register and places it into a general-purpose register.

Details

The vgnb instruction gathers every Nth bit from the contents of VSR[VRB+32] starting with bit 0, concatenates them, and places the result into GPR[RT]. The value of N must be between 2 and 7 inclusive.

Pseudocode Operation

if MSR.VEC=0 then
    Vector_Unavailable()
else if N<2 | N>7 then
    result ←UNDEFINED
else do
    j ←0
    result ←0x0000_0000_0000_0000
    do i = 0 to 127 by N
        result.bit[j] ←VSR[VRB+32].bit[i]
        jj + 1
    end
end
GPR[RT] ←result

Programming Note

N must be between 2 and 7 inclusive.

Example

vgnb vd, vb, uim

Encoding

Binary Layout
4
0
vD
6
UIM
11
vB
16
1228
 
Format VX-form
Opcode 0x100004CC
Extension VMX (AltiVec)
Registers Altered MSR

Operands

  • vD
    Target
  • vB
    Source
  • UIM
    Stream
  • RT
    Target General Purpose Register
  • VRB
    Source Vector Register
  • N
    Gather interval (2 to 7)