[PATCH] D29690: [AVX512] Fix EXTRACT_VECTOR_ELT with variable index.

Elena Demikhovsky via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Mon Feb 20 02:50:08 PST 2017


delena accepted this revision.
delena added a comment.
This revision is now accepted and ready to land.

It's not AVX-512 specific any more, please re-title the review.
Please specify that you are removing the VINSERT together with the code that using it and we don't need this node any more.

LGTM after the minor changes in the comments.



================
Comment at: lib/Target/X86/X86ISelLowering.cpp:13779
   if (!isa<ConstantSDNode>(Idx)) {
-    if (VecVT.is512BitVector() ||
-        (VecVT.is256BitVector() && Subtarget.hasInt256() &&
-         VecVT.getScalarSizeInBits() == 32)) {
-
-      MVT MaskEltVT =
-        MVT::getIntegerVT(VecVT.getScalarSizeInBits());
-      MVT MaskVT = MVT::getVectorVT(MaskEltVT, VecVT.getSizeInBits() /
-                                    MaskEltVT.getSizeInBits());
-
-      Idx = DAG.getZExtOrTrunc(Idx, dl, MaskEltVT);
-      auto PtrVT = getPointerTy(DAG.getDataLayout());
-      SDValue Mask = DAG.getNode(X86ISD::VINSERT, dl, MaskVT,
-                                 getZeroVector(MaskVT, Subtarget, DAG, dl), Idx,
-                                 DAG.getConstant(0, dl, PtrVT));
-      SDValue Perm = DAG.getNode(X86ISD::VPERMV, dl, VecVT, Mask, Vec);
-      return DAG.getNode(ISD::EXTRACT_VECTOR_ELT, dl, Op.getValueType(), Perm,
-                         DAG.getConstant(0, dl, PtrVT));
-    }
+    // Its more profitable to goes through memory (1 cycles throughput)
+    // than use VMOVD + VPERMV/PSHUFB sequence ( 2/3 cycles throughput)
----------------
It's more profitable to go ..
than using ..


Repository:
  rL LLVM

https://reviews.llvm.org/D29690





More information about the llvm-commits mailing list