]> granicus.if.org Git - llvm/commitdiff
[X86] Make combineLoopSADPattern use CONCAT_VECTORS instead of INSERT_SUBVECTORS...
authorCraig Topper <craig.topper@intel.com>
Fri, 23 Aug 2019 06:08:33 +0000 (06:08 +0000)
committerCraig Topper <craig.topper@intel.com>
Fri, 23 Aug 2019 06:08:33 +0000 (06:08 +0000)
CONCAT_VECTORS is more canonical for the early DAG combine runs
until we start getting into the op legalization phases.

git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@369734 91177308-0d34-0410-b5e6-96231b3b80d8

lib/Target/X86/X86ISelLowering.cpp

index a29b6a8283cb196d81bc9b6208de3e48d7e9e0de..7b47be5c3fd8c15053f4d4d8ceb31dc1c6b75523 100644 (file)
@@ -43660,9 +43660,11 @@ static SDValue combineLoopSADPattern(SDNode *N, SelectionDAG &DAG,
 
   if (VT.getSizeInBits() > ResVT.getSizeInBits()) {
     // Fill the upper elements with zero to match the add width.
-    SDValue Zero = DAG.getConstant(0, DL, VT);
-    Sad = DAG.getNode(ISD::INSERT_SUBVECTOR, DL, VT, Zero, Sad,
-                      DAG.getIntPtrConstant(0, DL));
+    assert(VT.getSizeInBits() % ResVT.getSizeInBits() == 0 && "Unexpected VTs");
+    unsigned NumConcats = VT.getSizeInBits() / ResVT.getSizeInBits();
+    SmallVector<SDValue, 4> Ops(NumConcats, DAG.getConstant(0, DL, ResVT));
+    Ops[0] = Sad;
+    Sad = DAG.getNode(ISD::CONCAT_VECTORS, DL, VT, Ops);
   } else if (ExperimentalVectorWideningLegalization &&
              VT.getSizeInBits() < ResVT.getSizeInBits()) {
     Sad = DAG.getNode(ISD::EXTRACT_SUBVECTOR, DL, VT, Sad,