]> granicus.if.org Git - llvm/commitdiff
[X86][SSE] combineX86ShufflesRecursively - moved to generic op input index lookup...
authorSimon Pilgrim <llvm-dev@redking.me.uk>
Thu, 21 Feb 2019 12:24:49 +0000 (12:24 +0000)
committerSimon Pilgrim <llvm-dev@redking.me.uk>
Thu, 21 Feb 2019 12:24:49 +0000 (12:24 +0000)
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

lib/Target/X86/X86ISelLowering.cpp

index c99ad480601d5193c8ef6cdbf10c40669b2ca819..5e03e94f4596578e24ed6d4c1c1871ef0a9c4433 100644 (file)
@@ -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;
   }