xxblendvb

VSX Vector Blend Variable Byte

xxblendvb XT, XA, XB, XC

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

Details

For xxblendvb, the contents of VSR[XT] are determined by the contents of VSR[XC]. If bit 0 of byte element i in VSR[XC] is 0, then byte element i of VSR[XT] is taken from VSR[XA]; otherwise, it is taken from VSR[XB].

Pseudocode Operation

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

Programming Note

The xxblendvb instruction blends bytes from two source vectors based on a control vector. Ensure that the VSX (Vector Scalar Extensions) are enabled in the MSR register to avoid an exception. The instruction operates on 16-byte vectors, and each byte is independently selected from either of the two source vectors based on the corresponding bit in the control vector. This instruction is useful for conditional data merging but requires careful handling of the control vector to achieve the desired result.

Example

xxblendvb vs1, vs2, vs3, vs4

Encoding

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

Operands

  • XT
    Target
  • XA
    Src A
  • XB
    Src B
  • XC
    Control