From 93798497a98c5dc6e2027bbc6333322dba69cd4f Mon Sep 17 00:00:00 2001 From: Craig Topper Date: Wed, 6 Dec 2017 18:40:46 +0000 Subject: [PATCH] [X86] Simplify the TTI code for getInterleavedMemoryOpCost around for AVX512BW. NFCI Previously the lambda for AVX512 passed out a flag that indicated whether AVX512BW was required and that was checked against the AVX512BW subtarget flag outside. This patch changes the interface to pass the AVX512BW subtarget bit in and return its value if we detect 16 or 8 bit types. git-svn-id: https://llvm.org/svn/llvm-project/llvm/trunk@319919 91177308-0d34-0410-b5e6-96231b3b80d8 --- lib/Target/X86/X86TargetTransformInfo.cpp | 13 ++++--------- 1 file changed, 4 insertions(+), 9 deletions(-) diff --git a/lib/Target/X86/X86TargetTransformInfo.cpp b/lib/Target/X86/X86TargetTransformInfo.cpp index 9b07491c75c..223eed3048d 100644 --- a/lib/Target/X86/X86TargetTransformInfo.cpp +++ b/lib/Target/X86/X86TargetTransformInfo.cpp @@ -2839,21 +2839,16 @@ int X86TTIImpl::getInterleavedMemoryOpCost(unsigned Opcode, Type *VecTy, ArrayRef Indices, unsigned Alignment, unsigned AddressSpace) { - auto isSupportedOnAVX512 = [](Type *VecTy, bool &RequiresBW) { - RequiresBW = false; + auto isSupportedOnAVX512 = [](Type *VecTy, bool HasBW) { Type *EltTy = VecTy->getVectorElementType(); if (EltTy->isFloatTy() || EltTy->isDoubleTy() || EltTy->isIntegerTy(64) || EltTy->isIntegerTy(32) || EltTy->isPointerTy()) return true; - if (EltTy->isIntegerTy(16) || EltTy->isIntegerTy(8)) { - RequiresBW = true; - return true; - } + if (EltTy->isIntegerTy(16) || EltTy->isIntegerTy(8)) + return HasBW; return false; }; - bool RequiresBW; - bool HasAVX512Solution = isSupportedOnAVX512(VecTy, RequiresBW); - if (ST->hasAVX512() && HasAVX512Solution && (!RequiresBW || ST->hasBWI())) + if (ST->hasAVX512() && isSupportedOnAVX512(VecTy, ST->hasBWI())) return getInterleavedMemoryOpCostAVX512(Opcode, VecTy, Factor, Indices, Alignment, AddressSpace); if (ST->hasAVX2()) -- 2.50.1