[PATCH] [CodeGen] Add hooks/combine to form vector extloads, and enable it on X86.

Matt Arsenault Matthew.Arsenault at amd.com
Fri Jan 9 13:36:22 PST 2015


================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:5334-5335
@@ +5333,4 @@
+        SDLoc dl(N);
+        unsigned NumSplits =
+            DstVT.getVectorNumElements() / SplitDstVT.getVectorNumElements();
+        unsigned Stride = SplitSrcVT.getSizeInBits() / 8;
----------------
I don't think this will work correctly for 3 vectors, but it probably doesn't matter

================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:5336
@@ +5335,3 @@
+            DstVT.getVectorNumElements() / SplitDstVT.getVectorNumElements();
+        unsigned Stride = SplitSrcVT.getSizeInBits() / 8;
+        SmallVector<SDValue, 4> SplitDsts;
----------------
This should use .getStoreSize()

================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:5671-5682
@@ +5670,14 @@
+      DoXform = ExtendUsesToFormExtLoad(N, N0, ISD::ZERO_EXTEND, SetCCs, TLI);
+    if (DoXform) {
+      LoadSDNode *LN0 = cast<LoadSDNode>(N0);
+      EVT SrcVT = N0.getValueType();
+      EVT DstVT = VT;
+      EVT SplitSrcVT = SrcVT;
+      EVT SplitDstVT = DstVT;
+      ISD::LoadExtType ExtType = ISD::ZEXTLOAD;
+      while (!TLI.isLoadExtLegalOrCustom(ExtType, SplitDstVT, SplitSrcVT) &&
+             SplitSrcVT.getVectorNumElements() > 1) {
+        SplitDstVT = DAG.GetSplitDestVTs(SplitDstVT).first;
+        SplitSrcVT = DAG.GetSplitDestVTs(SplitSrcVT).first;
+      }
+
----------------
This looks like the same in the sextload handling. Should probably be moved to a new function

================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:5688
@@ +5687,3 @@
+            DstVT.getVectorNumElements() / SplitDstVT.getVectorNumElements();
+        unsigned Stride = SplitSrcVT.getSizeInBits() / 8;
+        SmallVector<SDValue, 4> SplitDsts;
----------------
This should also use getStoreSize()

================
Comment at: lib/CodeGen/SelectionDAG/DAGCombiner.cpp:5694-5698
@@ +5693,7 @@
+        for (unsigned Idx = 0; Idx < NumSplits; Idx++) {
+          SDValue SplitLoad = DAG.getExtLoad(
+              ExtType, dl, SplitDstVT, LN0->getChain(), BasePTR,
+              LN0->getPointerInfo().getWithOffset(Idx * Stride), SplitSrcVT,
+              LN0->isVolatile(), LN0->isNonTemporal(), LN0->isInvariant(),
+              LN0->getAlignment(), LN0->getAAInfo());
+
----------------
It might be helpful to add a new version of getExtLoad based on the version that takes the MMO and an offset rather than having to pass all of the separate arguments

================
Comment at: lib/Target/X86/X86ISelLowering.cpp:20109
@@ -20107,1 +20108,3 @@
 
+bool X86TargetLowering::isVectorExtLdDesirable(SDValue) const {
+  return true;
----------------
Missing override

http://reviews.llvm.org/D6904

EMAIL PREFERENCES
  http://reviews.llvm.org/settings/panel/emailpreferences/






More information about the llvm-commits mailing list