We currently bail if the target shuffle decodes to more than 2 input vectors, this change alters the input index to work for any number of inputs for when we drop that requirement.
git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@354575
91177308-0d34-0410-b5e6-
96231b3b80d8
: (OpMask[OpIdx] << OpRatioLog2) + (RootMaskedIdx & (OpRatio - 1));
OpMaskedIdx = OpMaskedIdx & (MaskWidth - 1);
- if (OpMask[OpIdx] < (int)OpMask.size()) {
- assert(0 <= OpInputIdx[0] && "Unknown target shuffle input");
- OpMaskedIdx += OpInputIdx[0] * MaskWidth;
- } else {
- assert(0 <= OpInputIdx[1] && "Unknown target shuffle input");
- OpMaskedIdx += OpInputIdx[1] * MaskWidth;
- }
+ int InputIdx = OpMask[OpIdx] / (int)OpMask.size();
+ assert(0 <= OpInputIdx[InputIdx] && "Unknown target shuffle input");
+ OpMaskedIdx += OpInputIdx[InputIdx] * MaskWidth;
Mask[i] = OpMaskedIdx;
}