vexpandqm

Vector Expand Quadword Mask

vexpandqm vD, vB

Expands bits from a GPR mask into a quadword-element vector.

Details

The vexpandqm instruction expands the mask bit from VSR[VRB+32] to all elements in VSR[VRT+32]. If the mask bit is 1, all elements are set to 0xFFFFFFFFFFFFFFFF; if the mask bit is 0, all elements are set to 0x0000000000000000.

Pseudocode Operation

if MSR.VEC=0 then
    Vector_Unavailable()

let bmi be the contents of bit 0 of VSR[VRB+32].

if bmi = 1 then
    VSR[VRT+32] ← 0xFFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF_FFFF
else
    VSR[VRT+32] ← 0x0000_0000_0000_0000_0000_0000_0000_0000

Programming Note

The vexpandqm instruction is used to set all elements in a vector register based on the value of a single mask bit. Ensure that the Vector Facility (VEC) is enabled in the MSR before using this instruction; otherwise, it will raise an exception. This instruction is useful for quickly initializing vectors with either all ones or all zeros based on a condition.

Example

vexpandqm vd, vb

Encoding

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

Operands

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