summaryrefslogtreecommitdiffstats
path: root/llvm/lib
diff options
context:
space:
mode:
authorKrzysztof Parzyszek <kparzysz@quicinc.com>2019-09-20 15:19:20 +0000
committerKrzysztof Parzyszek <kparzysz@quicinc.com>2019-09-20 15:19:20 +0000
commit2b5d7e93dd18c13d5358f602d361273ec0960b37 (patch)
treea15824af839d2677ecbf8f477ec6d473a22633c2 /llvm/lib
parentd21087af958656e3eab173fc69bf7a83a3956e90 (diff)
downloadbcm5719-llvm-2b5d7e93dd18c13d5358f602d361273ec0960b37.tar.gz
bcm5719-llvm-2b5d7e93dd18c13d5358f602d361273ec0960b37.zip
[MVT] Add v256i1 to MachineValueType
This type can show up when lowering some HVX vector code on Hexagon. llvm-svn: 372403
Diffstat (limited to 'llvm/lib')
-rw-r--r--llvm/lib/CodeGen/ValueTypes.cpp2
-rw-r--r--llvm/lib/Target/Hexagon/HexagonISelLowering.cpp21
2 files changed, 16 insertions, 7 deletions
diff --git a/llvm/lib/CodeGen/ValueTypes.cpp b/llvm/lib/CodeGen/ValueTypes.cpp
index f56aa84bad0..73b862d51c0 100644
--- a/llvm/lib/CodeGen/ValueTypes.cpp
+++ b/llvm/lib/CodeGen/ValueTypes.cpp
@@ -144,6 +144,7 @@ std::string EVT::getEVTString() const {
case MVT::v32i1: return "v32i1";
case MVT::v64i1: return "v64i1";
case MVT::v128i1: return "v128i1";
+ case MVT::v256i1: return "v256i1";
case MVT::v512i1: return "v512i1";
case MVT::v1024i1: return "v1024i1";
case MVT::v1i8: return "v1i8";
@@ -287,6 +288,7 @@ Type *EVT::getTypeForEVT(LLVMContext &Context) const {
case MVT::v32i1: return VectorType::get(Type::getInt1Ty(Context), 32);
case MVT::v64i1: return VectorType::get(Type::getInt1Ty(Context), 64);
case MVT::v128i1: return VectorType::get(Type::getInt1Ty(Context), 128);
+ case MVT::v256i1: return VectorType::get(Type::getInt1Ty(Context), 256);
case MVT::v512i1: return VectorType::get(Type::getInt1Ty(Context), 512);
case MVT::v1024i1: return VectorType::get(Type::getInt1Ty(Context), 1024);
case MVT::v1i8: return VectorType::get(Type::getInt8Ty(Context), 1);
diff --git a/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp b/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp
index ac70b4db86e..66b6e11bb07 100644
--- a/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp
+++ b/llvm/lib/Target/Hexagon/HexagonISelLowering.cpp
@@ -1864,26 +1864,33 @@ bool HexagonTargetLowering::isShuffleMaskLegal(ArrayRef<int> Mask,
TargetLoweringBase::LegalizeTypeAction
HexagonTargetLowering::getPreferredVectorAction(MVT VT) const {
- if (VT.getVectorNumElements() == 1 || VT.isScalableVector())
- return TargetLoweringBase::TypeScalarizeVector;
-
- // Always widen vectors of i1.
+ unsigned VecLen = VT.getVectorNumElements();
MVT ElemTy = VT.getVectorElementType();
- if (ElemTy == MVT::i1)
- return TargetLoweringBase::TypeWidenVector;
+
+ if (VecLen == 1 || VT.isScalableVector())
+ return TargetLoweringBase::TypeScalarizeVector;
if (Subtarget.useHVXOps()) {
+ unsigned HwLen = Subtarget.getVectorLength();
// If the size of VT is at least half of the vector length,
// widen the vector. Note: the threshold was not selected in
// any scientific way.
ArrayRef<MVT> Tys = Subtarget.getHVXElementTypes();
if (llvm::find(Tys, ElemTy) != Tys.end()) {
- unsigned HwWidth = 8*Subtarget.getVectorLength();
+ unsigned HwWidth = 8*HwLen;
unsigned VecWidth = VT.getSizeInBits();
if (VecWidth >= HwWidth/2 && VecWidth < HwWidth)
return TargetLoweringBase::TypeWidenVector;
}
+ // Split vectors of i1 that correspond to (byte) vector pairs.
+ if (ElemTy == MVT::i1 && VecLen == 2*HwLen)
+ return TargetLoweringBase::TypeSplitVector;
}
+
+ // Always widen (remaining) vectors of i1.
+ if (ElemTy == MVT::i1)
+ return TargetLoweringBase::TypeWidenVector;
+
return TargetLoweringBase::TypeSplitVector;
}
OpenPOWER on IntegriCloud