vexpandbm

Vector Expand Byte Mask

vexpandbm vD, vB

Expands the mask from bit 0 of each byte element in the source VSR to all bits in the corresponding element in the target VSR.

Details

The Vector Expand Byte Mask instruction replicates the contents of bit 0 of each byte element in the source vector register (VRB) to all bits in the corresponding byte element in the target vector register (VRT).

Pseudocode Operation

if MSR.VEC=0 then
    Vector_Unavailable()
do i = 0 to 15
    let bmi be the contents of bit 0 of byte element i of VSR[VRB+32]
    if bmi is equal to 1 then
        VSR[VRT+32].byte[i] ←0xFF
    else
        VSR[VRT+32].byte[i] ←0x00
end

Programming Note

The vexpandbm instruction is useful for creating masks where each byte is either all zeros or all ones based on the least significant bit of the corresponding source byte. Ensure that the Vector Facility (MSR.VEC) is enabled before using this instruction; otherwise, a Vector_Unavailable exception will be raised. This operation is efficient for processing data in parallel across multiple bytes.

Example

vexpandbm vd, vb

Encoding

Binary Layout
4
0
VRT
6
0
11
VRB
16
1602
21
 
Format VX-form
Opcode 0x10000642
Extension VMX (AltiVec)
Registers Altered MSR

Operands

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