xxsel
VSX Vector Select
Selects elements from two source vectors based on a mask vector.
Details
Selects bits from XA or XB for each bit position based on the corresponding bit in the mask register XC. Where XC has a 1 bit, the result takes the bit from XA; where XC has a 0 bit, the result takes the bit from XB. This is a VSX instruction with no effect on condition or status flags.
Pseudocode Operation
for i in 0 to 127 do
if XC[i] = 1 then
XT[i] ← XA[i]
else
XT[i] ← XB[i]
Programming Note
The xxsel instruction is commonly used for conditional vector selection based on a mask. Ensure that the VSX feature is enabled in the MSR register to avoid an exception. The source and destination vectors must be properly aligned, typically requiring 16-byte alignment for optimal performance.
Example
Encoding
Operands
-
XT
Target -
XA
True Src -
XB
False Src -
XC
Mask -
VRT
Target Vector Register -
VRA
Source Vector Register -
VRB
Source Vector Register -
VRC
Source Vector Register