[X86] Simplify the end of custom type legalization for (v2i32/v4i16/v8i8 (bitcast...
authorCraig Topper <craig.topper@intel.com>
Fri, 12 Oct 2018 22:00:00 +0000 (22:00 +0000)
committerCraig Topper <craig.topper@intel.com>
Fri, 12 Oct 2018 22:00:00 +0000 (22:00 +0000)
Generic legalization should be able to finish legalizing the EXTRACT_SUBVECTOR probably by turning it into a BUILD_VECTOR. But we should emit the simplest sequence.

llvm-svn: 344424

llvm/lib/Target/X86/X86ISelLowering.cpp

index 220e2e2..ffb5acf 100644 (file)
@@ -26307,13 +26307,9 @@ void X86TargetLowering::ReplaceNodeResults(SDNode *N,
     SDValue Expanded = DAG.getNode(ISD::SCALAR_TO_VECTOR, dl,
                                    MVT::v2f64, N->getOperand(0));
     SDValue ToVecInt = DAG.getBitcast(WiderVT, Expanded);
-
-    SmallVector<SDValue, 8> Elts;
-    for (unsigned i = 0, e = NumElts; i != e; ++i)
-      Elts.push_back(DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, SVT,
-                                   ToVecInt, DAG.getIntPtrConstant(i, dl)));
-
-    Results.push_back(DAG.getBuildVector(DstVT, dl, Elts));
+    SDValue Extract = DAG.getNode(ISD::EXTRACT_SUBVECTOR, dl, DstVT,
+                                  ToVecInt, DAG.getIntPtrConstant(0, dl));
+    Results.push_back(Extract);
     return;
   }
   case ISD::MGATHER: {