From: Simon Pilgrim Date: Thu, 21 Feb 2019 12:24:49 +0000 (+0000) Subject: [X86][SSE] combineX86ShufflesRecursively - moved to generic op input index lookup... X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=011c90c0e4e84a5dd96d2a733ac1572eef3c3d84;p=llvm [X86][SSE] combineX86ShufflesRecursively - moved to generic op input index lookup. NFCI. 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 --- diff --git a/lib/Target/X86/X86ISelLowering.cpp b/lib/Target/X86/X86ISelLowering.cpp index c99ad480601..5e03e94f459 100644 --- a/lib/Target/X86/X86ISelLowering.cpp +++ b/lib/Target/X86/X86ISelLowering.cpp @@ -31807,13 +31807,9 @@ static SDValue combineX86ShufflesRecursively( : (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; }