vextracthm

Vector Extract Halfword Mask

vextracthm RA, vB

Extracts MSB of each halfword into a GPR mask.

Details

The vextracthm instruction extracts bit 0 of each halfword element from a vector register (VSR) into a general-purpose register (GPR). The contents of these bits are concatenated and placed into the upper bits of GPR[RT], while the lower bits of GPR[RT] are set to zero.

Pseudocode Operation

if MSR.VEC=0 then Vector_Unavailable()
do i = 0 to 7
   GPR[RT].bit[56+i] ←VSR[VRB+32].hword[i].bit[0]
end
do i = 8 to 15
   GPR[RT].bit[48+i] ←VSR[VRB+32].hword[i].bit[0]
end
GPR[RT].bit[0:47] ←0

Programming Note

The vextracthm instruction is useful for extracting the least significant bit of each halfword from a vector register and placing them into a general-purpose register. Ensure that the Vector Facility (MSR.VEC) is enabled before using this instruction; otherwise, it will raise an exception. The upper 16 bits of the destination GPR will contain the extracted bits, with the lower 48 bits set to zero.

Example

vextracthm r4, vb

Encoding

Binary Layout
4
0
RA
6
0
11
vB
16
1666
21
 
Format VX-form
Opcode 0x10000682
Extension VMX (AltiVec)
Registers Altered MSR

Operands

  • RA
    Target
  • vB
    Source