vexpandhm
Vector Expand Halfword Mask
Expands bits from a GPR mask into a halfword-element vector.
Details
Expands individual bits from a source vector register into halfword-sized elements in the destination vector register, where each bit controls whether the corresponding halfword 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 7 do
if vB[i] = 1 then
vD[i*16:(i+1)*16-1] ← 0xFFFF
else
vD[i*16:(i+1)*16-1] ← 0x0000
end if
end for
Programming Note
The vexpandhm instruction is useful for creating masks based on the least significant bit of each halfword in the source vector. Ensure that the Vector Facility (VEC) bit in the Machine State Register (MSR) is set to 1 before using this instruction, as attempting to execute it with VEC=0 will result in a Vector Unavailable exception. This instruction operates on 8 halfwords per vector register and does not require any specific alignment of the data.
Example
Encoding
Operands
-
vD
Target -
vB
Source