xxsel
VSX Vector Select
xxsel XT, XA, XB, XC
Selects elements from two source vectors based on a mask vector.
Details
The xxsel instruction selects elements from two source vectors (src1 and src2) based on the corresponding bits in a mask vector. If the bit in the mask is 0, the element from src1 is selected; if the bit is 1, the element from src2 is selected.
Pseudocode Operation
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
xxsel vs1, vs2, vs3, vs4
Encoding
Binary Layout
60
6
XT
11
XA
16
XB
21
XC
26
3
28 29 30 31
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