What is the best way for pairwise comparison of two integer registers and extraction of equal elements using SSE instructions? For example, if a = [6 4 7 2] and b = [2 4 9 2] (each register contains four 32-bit integers), the result should be [4 2 x x]. An alternative form of this question is how to obtain a binary mask of equal elements (..0101b) that can be used for shuffling or as an index to lookup a parameter for shuffling instruction in the precomputed table.
What is the best way for pairwise comparison of two integer registers and extraction
Share
I would probably use a variant of what
drhirschproposes:This gives you the same index to use in looking up a shuffle mask using only two operations.