vexpandqm
Vector Expand Quadword Mask
Expands bits from a GPR mask into a quadword-element vector.
Details
Expands individual bits from a source vector register into quadword-sized elements in the destination vector register, where each bit controls whether the corresponding quadword is set to all 1s or all 0s. This is a VMX instruction with no effect on condition registers or status fields.
Pseudocode Operation
for i in 0 to 1 do
if vB[i] = 1 then
vD[i*128:(i+1)*128-1] ← 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF
else
vD[i*128:(i+1)*128-1] ← 0x00000000000000000000000000000000
end if
end for
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
Encoding
Operands
-
vD
Target -
vB
Source -
VRT
Target Vector Register -
VRB
Source Vector Register