From: Krzysztof Parzyszek Date: Wed, 12 Oct 2022 18:35:59 +0000 (-0700) Subject: [Hexagon] Implement TLI::isExtractSubvectorCheap hook X-Git-Tag: upstream/17.0.6~30790 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=2d8d2bec701b6c1378431d2790e1f50e2a9bb0e3;p=platform%2Fupstream%2Fllvm.git [Hexagon] Implement TLI::isExtractSubvectorCheap hook --- diff --git a/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp b/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp index e29fda8..da86291 100644 --- a/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp +++ b/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp @@ -2141,6 +2141,20 @@ bool HexagonTargetLowering::shouldExpandBuildVectorWithShuffles(EVT VT, return false; } +bool HexagonTargetLowering::isExtractSubvectorCheap(EVT ResVT, EVT SrcVT, + unsigned Index) const { + assert(ResVT.getVectorElementType() == SrcVT.getVectorElementType()); + if (!ResVT.isSimple() || !SrcVT.isSimple()) + return false; + + MVT ResTy = ResVT.getSimpleVT(), SrcTy = SrcVT.getSimpleVT(); + if (ResTy.getVectorElementType() != MVT::i1) + return true; + + // Non-HVX bool vectors are relatively cheap. + return SrcTy.getVectorNumElements() <= 8; +} + bool HexagonTargetLowering::isShuffleMaskLegal(ArrayRef Mask, EVT VT) const { return true; diff --git a/llvm/lib/Target/Hexagon/HexagonISelLowering.h b/llvm/lib/Target/Hexagon/HexagonISelLowering.h index fcd9d28..07c6cea 100644 --- a/llvm/lib/Target/Hexagon/HexagonISelLowering.h +++ b/llvm/lib/Target/Hexagon/HexagonISelLowering.h @@ -158,6 +158,8 @@ public: // Should we expand the build vector with shuffles? bool shouldExpandBuildVectorWithShuffles(EVT VT, unsigned DefinedValues) const override; + bool isExtractSubvectorCheap(EVT ResVT, EVT SrcVT, + unsigned Index) const override; bool isShuffleMaskLegal(ArrayRef Mask, EVT VT) const override; TargetLoweringBase::LegalizeTypeAction getPreferredVectorAction(MVT VT)