[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

Craig Topper via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Fri Aug 11 14:24:38 PDT 2017


craig.topper created this revision.

Currently this routine is only setup to return true if you're extracting half of a vector. But we should also be reporting that extracting a quarter is cheap too.

Don't have a test case just happened to notice.


https://reviews.llvm.org/D36638

Files:
  lib/Target/X86/X86ISelLowering.cpp


Index: lib/Target/X86/X86ISelLowering.cpp
===================================================================
--- lib/Target/X86/X86ISelLowering.cpp
+++ lib/Target/X86/X86ISelLowering.cpp
@@ -4579,7 +4579,7 @@
   if (!isOperationLegalOrCustom(ISD::EXTRACT_SUBVECTOR, ResVT))
     return false;
 
-  return (Index == 0 || Index == ResVT.getVectorNumElements());
+  return (Index % ResVT.getVectorNumElements()) == 0;
 }
 
 bool X86TargetLowering::isCheapToSpeculateCttz() const {


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D36638.110814.patch
Type: text/x-patch
Size: 479 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20170811/77e46255/attachment.bin>


More information about the llvm-commits mailing list