Skip to content

Commit 2d8d2be

Browse files
author
Krzysztof Parzyszek
committed
[Hexagon] Implement TLI::isExtractSubvectorCheap hook
1 parent 0ebd288 commit 2d8d2be

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

llvm/lib/Target/Hexagon/HexagonISelLowering.cpp

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2141,6 +2141,20 @@ bool HexagonTargetLowering::shouldExpandBuildVectorWithShuffles(EVT VT,
21412141
return false;
21422142
}
21432143

2144+
bool HexagonTargetLowering::isExtractSubvectorCheap(EVT ResVT, EVT SrcVT,
2145+
unsigned Index) const {
2146+
assert(ResVT.getVectorElementType() == SrcVT.getVectorElementType());
2147+
if (!ResVT.isSimple() || !SrcVT.isSimple())
2148+
return false;
2149+
2150+
MVT ResTy = ResVT.getSimpleVT(), SrcTy = SrcVT.getSimpleVT();
2151+
if (ResTy.getVectorElementType() != MVT::i1)
2152+
return true;
2153+
2154+
// Non-HVX bool vectors are relatively cheap.
2155+
return SrcTy.getVectorNumElements() <= 8;
2156+
}
2157+
21442158
bool HexagonTargetLowering::isShuffleMaskLegal(ArrayRef<int> Mask,
21452159
EVT VT) const {
21462160
return true;

llvm/lib/Target/Hexagon/HexagonISelLowering.h

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -158,6 +158,8 @@ class HexagonTargetLowering : public TargetLowering {
158158
// Should we expand the build vector with shuffles?
159159
bool shouldExpandBuildVectorWithShuffles(EVT VT,
160160
unsigned DefinedValues) const override;
161+
bool isExtractSubvectorCheap(EVT ResVT, EVT SrcVT,
162+
unsigned Index) const override;
161163

162164
bool isShuffleMaskLegal(ArrayRef<int> Mask, EVT VT) const override;
163165
TargetLoweringBase::LegalizeTypeAction getPreferredVectorAction(MVT VT)

0 commit comments

Comments
 (0)