[PATCH] D36638: [AVX512] Correct isExtractSubvectorCheap so that it will return true for extracting 128-bits from the upper 256-bits of a 512-bit vector

Phabricator via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Sun Aug 13 10:43:51 PDT 2017


This revision was automatically updated to reflect the committed changes.
Closed by commit rL310794: [AVX512] Correct isExtractSubvectorCheap so that it will return the correct… (authored by ctopper).

Changed prior to commit:
  https://reviews.llvm.org/D36638?vs=110859&id=110880#toc

Repository:
  rL LLVM

https://reviews.llvm.org/D36638

Files:
  llvm/trunk/lib/Target/X86/X86ISelLowering.cpp


Index: llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
===================================================================
--- llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
+++ llvm/trunk/lib/Target/X86/X86ISelLowering.cpp
@@ -4579,7 +4579,13 @@
   if (!isOperationLegalOrCustom(ISD::EXTRACT_SUBVECTOR, ResVT))
     return false;
 
-  return (Index == 0 || Index == ResVT.getVectorNumElements());
+  // Mask vectors support all subregister combinations and operations that
+  // extract half of vector.
+  if (ResVT.getVectorElementType() == MVT::i1)
+    return Index = 0 || ((ResVT.getSizeInBits() == SrcVT.getSizeInBits() * 2) &&
+                         (Index == ResVT.getVectorNumElements()));
+
+  return (Index % ResVT.getVectorNumElements()) == 0;
 }
 
 bool X86TargetLowering::isCheapToSpeculateCttz() const {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36638.110880.patch
Type: text/x-patch
Size: 819 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170813/34f9c0a3/attachment.bin>


More information about the llvm-commits mailing list