summaryrefslogtreecommitdiffstats
path: root/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
diff options
context:
space:
mode:
authorCraig Topper <craig.topper@intel.com>2017-11-25 18:09:37 +0000
committerCraig Topper <craig.topper@intel.com>2017-11-25 18:09:37 +0000
commitea37e201ec2f9c3d8b2c9bb37ff48cacdd992f55 (patch)
tree6bebfa5efe92abba04700e0a8ba456b2e9e7def6 /llvm/lib/Target/X86/X86TargetTransformInfo.cpp
parente7426556c16d86d52356b23538708dbea2008a76 (diff)
downloadbcm5719-llvm-ea37e201ec2f9c3d8b2c9bb37ff48cacdd992f55.tar.gz
bcm5719-llvm-ea37e201ec2f9c3d8b2c9bb37ff48cacdd992f55.zip
[X86] Don't report gather is legal on Skylake CPUs when AVX2/AVX512 is disabled. Allow gather on SKX/CNL/ICL when AVX512 is disabled by using AVX2 instructions.
Summary: This adds a new fast gather feature bit to cover all CPUs that support fast gather that we can use independent of whether the AVX512 feature is enabled. I'm only using this new bit to qualify AVX2 codegen. AVX512 is still implicitly assuming fast gather to keep tests working and to match the scatter behavior. Test command lines have been added for these two cases. Reviewers: magabari, delena, RKSimon, zvi Reviewed By: RKSimon Subscribers: llvm-commits Differential Revision: https://reviews.llvm.org/D40282 llvm-svn: 318983
Diffstat (limited to 'llvm/lib/Target/X86/X86TargetTransformInfo.cpp')
-rw-r--r--llvm/lib/Target/X86/X86TargetTransformInfo.cpp8
1 files changed, 5 insertions, 3 deletions
diff --git a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
index f878f050e4e..d06d6a5d180 100644
--- a/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
+++ b/llvm/lib/Target/X86/X86TargetTransformInfo.cpp
@@ -2518,9 +2518,11 @@ bool X86TTIImpl::isLegalMaskedGather(Type *DataTy) {
int DataWidth = isa<PointerType>(ScalarTy) ?
DL.getPointerSizeInBits() : ScalarTy->getPrimitiveSizeInBits();
- // AVX-512 and Skylake AVX2 allows gather and scatter
- return (DataWidth == 32 || DataWidth == 64) && (ST->hasAVX512() ||
- ST->getProcFamily() == X86Subtarget::IntelSkylake);
+ // Some CPUs have better gather performance than others.
+ // TODO: Remove the explicit ST->hasAVX512()?, That would mean we would only
+ // enable gather with a -march.
+ return (DataWidth == 32 || DataWidth == 64) &&
+ (ST->hasAVX512() || (ST->hasFastGather() && ST->hasAVX2()));
}
bool X86TTIImpl::isLegalMaskedScatter(Type *DataType) {
OpenPOWER on IntegriCloud