[PATCH] D15477: [X86][AVX] Only shuffle the lower half of vectors if the upper half is undefined
Elena Demikhovsky via llvm-commits
llvm-commits at lists.llvm.org
Mon Dec 21 00:18:46 PST 2015
delena added a comment.
You have 2 input vectors A and B.
Let's see them as (a0, a1) and (b0, b1). You are looking for the one of the following patterns, based on mask:
1. (a0, u), (b0, u)
2. (u, a1), (b0, u)
3. (a0, u), (u, b1)
4. (u, a1), (b0, u)
One pass through the mask vector will map the original shuffle to one of the 4 patterns, if possible.
Then you extract lower or upper part from A and from B according to the pattern.
And calculate the mask as following:
if (M[i] < NumElts) // vector A
Newmask[i] = M[i] % HalfNumElts
else // vector B
Newmask[i] = (M[i] % HalfNumElts) + HalfNumElts
More information about the llvm-commits