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.
Encoding
Binary Layout
60
0:5
XT
6:10
XA
11:15
XB
16:20
XC
21:25
33
26:31
Operands
-
XT
Target -
XA
Src A -
XB
Src B -
XC
Control
Reference
View in PowerISA v3.1C Specification ↗
OPF Power ISA v3.1C
Description
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].
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.