[llvm] r354575 - [X86][SSE] combineX86ShufflesRecursively - moved to generic op input index lookup. NFCI.

Simon Pilgrim via llvm-commits llvm-commits at lists.llvm.org
Thu Feb 21 04:24:49 PST 2019


Author: rksimon
Date: Thu Feb 21 04:24:49 2019
New Revision: 354575

URL: http://llvm.org/viewvc/llvm-project?rev=354575&view=rev
Log:
[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.

Modified:
    llvm/trunk/lib/Target/X86/X86ISelLowering.cpp

Modified: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
URL: http://llvm.org/viewvc/llvm-project/llvm/trunk/lib/Target/X86/X86ISelLowering.cpp?rev=354575&r1=354574&r2=354575&view=diff
==============================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp (original)
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp Thu Feb 21 04:24:49 2019
@@ -31807,13 +31807,9 @@ static SDValue combineX86ShufflesRecursi
             : (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;
   }




More information about the llvm-commits mailing list