From b465a983168bf87dc269848c82ffc49ac8dbec20 Mon Sep 17 00:00:00 2001 From: Krzysztof Parzyszek Date: Mon, 10 Oct 2022 15:53:10 -0700 Subject: [PATCH] [Hexagon] Fix isTypeForHVX for vector predicates HexagonSubtarget::isTypeFixHVX would stop breaking the type up when it reached 64 bits in width. HVX vector predicates can be shorter than that, for example <32 x i1> would have a bitwidth of 32, and it's still a valid HVX type. --- llvm/lib/Target/Hexagon/HexagonSubtarget.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/llvm/lib/Target/Hexagon/HexagonSubtarget.cpp b/llvm/lib/Target/Hexagon/HexagonSubtarget.cpp index ba37e04..fd85087 100644 --- a/llvm/lib/Target/Hexagon/HexagonSubtarget.cpp +++ b/llvm/lib/Target/Hexagon/HexagonSubtarget.cpp @@ -222,7 +222,7 @@ bool HexagonSubtarget::isTypeForHVX(Type *VecTy, bool IncludeBool) const { // The given type may be something like <17 x i32>, which is not MVT, // but can be represented as (non-simple) EVT. EVT Ty = EVT::getEVT(VecTy, /*HandleUnknown*/false); - if (Ty.getSizeInBits() <= 64 || !Ty.getVectorElementType().isSimple()) + if (!Ty.getVectorElementType().isSimple()) return false; auto isHvxTy = [this, IncludeBool](MVT SimpleTy) { @@ -236,7 +236,7 @@ bool HexagonSubtarget::isTypeForHVX(Type *VecTy, bool IncludeBool) const { // qualifies for HVX, dividing it in half after each step. MVT ElemTy = Ty.getVectorElementType().getSimpleVT(); unsigned VecLen = PowerOf2Ceil(Ty.getVectorNumElements()); - while (ElemTy.getSizeInBits() * VecLen > 64) { + while (VecLen > 1) { MVT SimpleTy = MVT::getVectorVT(ElemTy, VecLen); if (SimpleTy.isValid() && isHvxTy(SimpleTy)) return true; -- 2.7.4