xxblendvh

VSX Vector Blend Variable Halfword

xxblendvh XT, XA, XB, XC

Selects halfwords from XA or XB based on the MSB of halfwords in XC.

Details

For xxblendvh, the contents of each halfword in the target vector are selected from either the first or second source vector based on the corresponding bit in the control vector.

Pseudocode Operation

if MSR.VSX=0 then VSX_Unavailable()
do i = 0 to 7
    if VSR[32×CX+C].hword[i].bit[0]=0 then
        VSR[32×TX+T].hword[i] ←VSR[32×AX+A].hword[i]
    else
        VSR[32×TX+T].hword[i] ←VSR[32×BX+B].hword[i]
end

Programming Note

Ensure VSX is enabled by checking and setting the appropriate bit in the MSR register. This instruction blends halfwords from two source vectors into a target vector based on a control vector's bits. Be cautious of alignment requirements for vector registers to avoid undefined behavior.

Example

xxblendvh vs1, vs2, vs3, vs4

Encoding

Binary Layout
60
0
XT
6
XA
11
XB
16
XC
21
34
26
 
Format XX4-form
Opcode 0xF0000022
Extension VSX
Registers Altered MSR

Operands

  • XT
    Target
  • XA
    Src A
  • XB
    Src B
  • XC
    Control
  • VRT
    Target VSX Register
  • VRA
    Source VSX Register
  • VRB
    Source VSX Register