From 6ee29ca87db9619e0ec1257442b0621e304b2f58 Mon Sep 17 00:00:00 2001 From: Philip Reames Date: Thu, 17 Apr 2025 12:13:00 -0700 Subject: [PATCH 1/4] [RISCV][TTI] Use processShuffleMask for shuffle legalization estimate We had some code which tried to estimate legalization costs for illegally typed shuffles, but only handle the case of a widening shuffle, and used a somewhat adhoc heuristic. We can reuse the processShuffleMask utility (which we already use for individual vector register splitting when exact VLEN is known) to perform the same splitting given the legal vector type as the unit of split instead. This makes the costing both simpler and more robust. Note that this swings costs for illegal shuffles pretty wildly as we were previously sometimes hitting the adhoc code, and sometimes falling through into generic scalarization costing. I don't know that any of the costs for the individual tests in tree are significant, but the test which which triggered me finding this was reported to me by Alexey reduced from something triggering a bad choice in SLP for x264. So this has the potential to be somewhat high impact. --- .../Target/RISCV/RISCVTargetTransformInfo.cpp | 102 +++-- .../CostModel/RISCV/shuffle-exact-vlen.ll | 415 ++++++------------ .../CostModel/RISCV/shuffle-permute.ll | 24 +- .../SLPVectorizer/RISCV/reductions.ll | 66 +-- 4 files changed, 233 insertions(+), 374 deletions(-) diff --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp index 9b91de36a688a..39b571c358460 100644 --- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp +++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp @@ -383,6 +383,61 @@ static VectorType *getVRGatherIndexType(MVT DataVT, const RISCVSubtarget &ST, return cast(EVT(IndexVT).getTypeForEVT(C)); } +/// Attempt to approximate the cost of a shuffle which will require splitting +/// during legalization. Note that processShuffleMasks is not an exact proxy +/// for the algorithm used in LegalizeVectorTypes, but hopefull it's a +/// reasonably close upperbound. +static InstructionCost costShuffleViaSplitting(RISCVTTIImpl &TTI, MVT LegalVT, + VectorType *Tp, + ArrayRef Mask, + TTI::TargetCostKind CostKind) { + assert(LegalVT.isFixedLengthVector() && !Mask.empty()); + unsigned LegalNumElts = LegalVT.getVectorNumElements(); + // Number of destination vectors after legalization: + unsigned NumOfDests = divideCeil(Mask.size(), LegalNumElts); + // We are going to permute multiple sources and the result will be in + // multiple destinations. Providing an accurate cost only for splits where + // the element type remains the same. + if (NumOfDests <= 1 || + LegalVT.getVectorElementType().getSizeInBits() != + Tp->getElementType()->getPrimitiveSizeInBits() || + LegalNumElts >= Tp->getElementCount().getFixedValue()) + return InstructionCost::getInvalid(); + + unsigned VecTySize = TTI.getDataLayout().getTypeStoreSize(Tp); + unsigned LegalVTSize = LegalVT.getStoreSize(); + // Number of source vectors after legalization: + unsigned NumOfSrcs = divideCeil(VecTySize, LegalVTSize); + + auto *SingleOpTy = FixedVectorType::get(Tp->getElementType(), LegalNumElts); + + unsigned NormalizedVF = LegalNumElts * std::max(NumOfSrcs, NumOfDests); + unsigned NumOfSrcRegs = NormalizedVF / LegalNumElts; + unsigned NumOfDestRegs = NormalizedVF / LegalNumElts; + SmallVector NormalizedMask(NormalizedVF, PoisonMaskElem); + assert(NormalizedVF >= Mask.size() && + "Normalized mask expected to be not shorter than original mask."); + copy(Mask, NormalizedMask.begin()); + InstructionCost Cost = 0; + SmallDenseSet, unsigned>> ReusedSingleSrcShuffles; + processShuffleMasks( + NormalizedMask, NumOfSrcRegs, NumOfDestRegs, NumOfDestRegs, []() {}, + [&](ArrayRef RegMask, unsigned SrcReg, unsigned DestReg) { + if (ShuffleVectorInst::isIdentityMask(RegMask, RegMask.size())) + return; + if (!ReusedSingleSrcShuffles.insert(std::make_pair(RegMask, SrcReg)) + .second) + return; + Cost += TTI.getShuffleCost(TTI::SK_PermuteSingleSrc, SingleOpTy, + RegMask, CostKind, 0, nullptr); + }, + [&](ArrayRef RegMask, unsigned Idx1, unsigned Idx2, bool NewReg) { + Cost += TTI.getShuffleCost(TTI::SK_PermuteTwoSrc, SingleOpTy, RegMask, + CostKind, 0, nullptr); + }); + return Cost; +} + /// Try to perform better estimation of the permutation. /// 1. Split the source/destination vectors into real registers. /// 2. Do the mask analysis to identify which real registers are @@ -645,48 +700,13 @@ InstructionCost RISCVTTIImpl::getShuffleCost(TTI::ShuffleKind Kind, return true; } }; - // We are going to permute multiple sources and the result will be in - // multiple destinations. Providing an accurate cost only for splits where - // the element type remains the same. + if (!Mask.empty() && LT.first.isValid() && LT.first != 1 && - shouldSplit(Kind) && - LT.second.getVectorElementType().getSizeInBits() == - Tp->getElementType()->getPrimitiveSizeInBits() && - LT.second.getVectorNumElements() < - cast(Tp)->getNumElements() && - divideCeil(Mask.size(), - cast(Tp)->getNumElements()) == - static_cast(*LT.first.getValue())) { - unsigned NumRegs = *LT.first.getValue(); - unsigned VF = cast(Tp)->getNumElements(); - unsigned SubVF = PowerOf2Ceil(VF / NumRegs); - auto *SubVecTy = FixedVectorType::get(Tp->getElementType(), SubVF); - - InstructionCost Cost = 0; - for (unsigned I = 0, NumSrcRegs = divideCeil(Mask.size(), SubVF); - I < NumSrcRegs; ++I) { - bool IsSingleVector = true; - SmallVector SubMask(SubVF, PoisonMaskElem); - transform( - Mask.slice(I * SubVF, - I == NumSrcRegs - 1 ? Mask.size() % SubVF : SubVF), - SubMask.begin(), [&](int I) -> int { - if (I == PoisonMaskElem) - return PoisonMaskElem; - bool SingleSubVector = I / VF == 0; - IsSingleVector &= SingleSubVector; - return (SingleSubVector ? 0 : 1) * SubVF + (I % VF) % SubVF; - }); - if (all_of(enumerate(SubMask), [](auto &&P) { - return P.value() == PoisonMaskElem || - static_cast(P.value()) == P.index(); - })) - continue; - Cost += getShuffleCost(IsSingleVector ? TTI::SK_PermuteSingleSrc - : TTI::SK_PermuteTwoSrc, - SubVecTy, SubMask, CostKind, 0, nullptr); - } - return Cost; + shouldSplit(Kind)) { + InstructionCost SplitCost = + costShuffleViaSplitting(*this, LT.second, FVTp, Mask, CostKind); + if (SplitCost.isValid()) + return SplitCost; } } diff --git a/llvm/test/Analysis/CostModel/RISCV/shuffle-exact-vlen.ll b/llvm/test/Analysis/CostModel/RISCV/shuffle-exact-vlen.ll index 23d5999237e30..b73abbfeba084 100644 --- a/llvm/test/Analysis/CostModel/RISCV/shuffle-exact-vlen.ll +++ b/llvm/test/Analysis/CostModel/RISCV/shuffle-exact-vlen.ll @@ -6,11 +6,11 @@ define <64 x i32> @interleave_v32i32(<32 x i32> %x, <32 x i32> %y) vscale_range(2,2) { ; CHECK-LABEL: 'interleave_v32i32' -; CHECK-NEXT: Cost Model: Found an estimated cost of 224 for instruction: %a = shufflevector <32 x i32> %x, <32 x i32> %y, <64 x i32> +; CHECK-NEXT: Cost Model: Found an estimated cost of 302 for instruction: %a = shufflevector <32 x i32> %x, <32 x i32> %y, <64 x i32> ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret <64 x i32> %a ; ; CHECK-SIZE-LABEL: 'interleave_v32i32' -; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 224 for instruction: %a = shufflevector <32 x i32> %x, <32 x i32> %y, <64 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 22 for instruction: %a = shufflevector <32 x i32> %x, <32 x i32> %y, <64 x i32> ; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret <64 x i32> %a ; %a = shufflevector <32 x i32> %x, <32 x i32> %y, <64 x i32> @@ -319,7 +319,7 @@ define void @shuffle1() vscale_range(2,2) { ; RV32-NEXT: Cost Model: Found an estimated cost of 68 for instruction: %zipv8i64 = shufflevector <8 x i64> poison, <8 x i64> poison, <16 x i32> ; RV32-NEXT: Cost Model: Found an estimated cost of 139 for instruction: %zip1v16i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <16 x i32> ; RV32-NEXT: Cost Model: Found an estimated cost of 139 for instruction: %zip2v16i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <16 x i32> -; RV32-NEXT: Cost Model: Found an estimated cost of 256 for instruction: %zipv16i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <32 x i32> +; RV32-NEXT: Cost Model: Found an estimated cost of 278 for instruction: %zipv16i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <32 x i32> ; RV32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void ; ; RV64-LABEL: 'shuffle1' @@ -370,110 +370,59 @@ define void @shuffle1() vscale_range(2,2) { ; RV64-NEXT: Cost Model: Found an estimated cost of 74 for instruction: %zipv8i64 = shufflevector <8 x i64> poison, <8 x i64> poison, <16 x i32> ; RV64-NEXT: Cost Model: Found an estimated cost of 151 for instruction: %zip1v16i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <16 x i32> ; RV64-NEXT: Cost Model: Found an estimated cost of 151 for instruction: %zip2v16i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <16 x i32> -; RV64-NEXT: Cost Model: Found an estimated cost of 96 for instruction: %zipv16i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <32 x i32> +; RV64-NEXT: Cost Model: Found an estimated cost of 302 for instruction: %zipv16i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <32 x i32> ; RV64-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void ; -; RV32-SIZE-LABEL: 'shuffle1' -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v2i8 = shufflevector <2 x i8> poison, <2 x i8> poison, <2 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v2i8 = shufflevector <2 x i8> poison, <2 x i8> poison, <2 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv2i8 = shufflevector <2 x i8> poison, <2 x i8> poison, <4 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v4i8 = shufflevector <4 x i8> poison, <4 x i8> poison, <4 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v4i8 = shufflevector <4 x i8> poison, <4 x i8> poison, <4 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv4i8 = shufflevector <4 x i8> poison, <4 x i8> poison, <8 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v8i8 = shufflevector <8 x i8> poison, <8 x i8> poison, <8 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v8i8 = shufflevector <8 x i8> poison, <8 x i8> poison, <8 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv8i8 = shufflevector <8 x i8> poison, <8 x i8> poison, <16 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v16i8 = shufflevector <16 x i8> poison, <16 x i8> poison, <16 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v16i8 = shufflevector <16 x i8> poison, <16 x i8> poison, <16 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv16i8 = shufflevector <16 x i8> poison, <16 x i8> poison, <32 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v2i16 = shufflevector <2 x i16> poison, <2 x i16> poison, <2 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v2i16 = shufflevector <2 x i16> poison, <2 x i16> poison, <2 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv2i16 = shufflevector <2 x i16> poison, <2 x i16> poison, <4 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v4i16 = shufflevector <4 x i16> poison, <4 x i16> poison, <4 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v4i16 = shufflevector <4 x i16> poison, <4 x i16> poison, <4 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv4i16 = shufflevector <4 x i16> poison, <4 x i16> poison, <8 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v8i16 = shufflevector <8 x i16> poison, <8 x i16> poison, <8 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v8i16 = shufflevector <8 x i16> poison, <8 x i16> poison, <8 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv8i16 = shufflevector <8 x i16> poison, <8 x i16> poison, <16 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v16i16 = shufflevector <16 x i16> poison, <16 x i16> poison, <16 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v16i16 = shufflevector <16 x i16> poison, <16 x i16> poison, <16 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv16i16 = shufflevector <16 x i16> poison, <16 x i16> poison, <32 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v2i32 = shufflevector <2 x i32> poison, <2 x i32> poison, <2 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v2i32 = shufflevector <2 x i32> poison, <2 x i32> poison, <2 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv2i32 = shufflevector <2 x i32> poison, <2 x i32> poison, <4 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v4i32 = shufflevector <4 x i32> poison, <4 x i32> poison, <4 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v4i32 = shufflevector <4 x i32> poison, <4 x i32> poison, <4 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv4i32 = shufflevector <4 x i32> poison, <4 x i32> poison, <8 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v8i32 = shufflevector <8 x i32> poison, <8 x i32> poison, <8 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v8i32 = shufflevector <8 x i32> poison, <8 x i32> poison, <8 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv8i32 = shufflevector <8 x i32> poison, <8 x i32> poison, <16 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v16i32 = shufflevector <16 x i32> poison, <16 x i32> poison, <16 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v16i32 = shufflevector <16 x i32> poison, <16 x i32> poison, <16 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv16i32 = shufflevector <16 x i32> poison, <16 x i32> poison, <32 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v2i64 = shufflevector <2 x i64> poison, <2 x i64> poison, <2 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v2i64 = shufflevector <2 x i64> poison, <2 x i64> poison, <2 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv2i64 = shufflevector <2 x i64> poison, <2 x i64> poison, <4 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v4i64 = shufflevector <4 x i64> poison, <4 x i64> poison, <4 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v4i64 = shufflevector <4 x i64> poison, <4 x i64> poison, <4 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv4i64 = shufflevector <4 x i64> poison, <4 x i64> poison, <8 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v8i64 = shufflevector <8 x i64> poison, <8 x i64> poison, <8 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v8i64 = shufflevector <8 x i64> poison, <8 x i64> poison, <8 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv8i64 = shufflevector <8 x i64> poison, <8 x i64> poison, <16 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v16i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <16 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v16i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <16 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 256 for instruction: %zipv16i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <32 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void -; -; RV64-SIZE-LABEL: 'shuffle1' -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v2i8 = shufflevector <2 x i8> poison, <2 x i8> poison, <2 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v2i8 = shufflevector <2 x i8> poison, <2 x i8> poison, <2 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv2i8 = shufflevector <2 x i8> poison, <2 x i8> poison, <4 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v4i8 = shufflevector <4 x i8> poison, <4 x i8> poison, <4 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v4i8 = shufflevector <4 x i8> poison, <4 x i8> poison, <4 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv4i8 = shufflevector <4 x i8> poison, <4 x i8> poison, <8 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v8i8 = shufflevector <8 x i8> poison, <8 x i8> poison, <8 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v8i8 = shufflevector <8 x i8> poison, <8 x i8> poison, <8 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv8i8 = shufflevector <8 x i8> poison, <8 x i8> poison, <16 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v16i8 = shufflevector <16 x i8> poison, <16 x i8> poison, <16 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v16i8 = shufflevector <16 x i8> poison, <16 x i8> poison, <16 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv16i8 = shufflevector <16 x i8> poison, <16 x i8> poison, <32 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v2i16 = shufflevector <2 x i16> poison, <2 x i16> poison, <2 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v2i16 = shufflevector <2 x i16> poison, <2 x i16> poison, <2 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv2i16 = shufflevector <2 x i16> poison, <2 x i16> poison, <4 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v4i16 = shufflevector <4 x i16> poison, <4 x i16> poison, <4 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v4i16 = shufflevector <4 x i16> poison, <4 x i16> poison, <4 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv4i16 = shufflevector <4 x i16> poison, <4 x i16> poison, <8 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v8i16 = shufflevector <8 x i16> poison, <8 x i16> poison, <8 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v8i16 = shufflevector <8 x i16> poison, <8 x i16> poison, <8 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv8i16 = shufflevector <8 x i16> poison, <8 x i16> poison, <16 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v16i16 = shufflevector <16 x i16> poison, <16 x i16> poison, <16 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v16i16 = shufflevector <16 x i16> poison, <16 x i16> poison, <16 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv16i16 = shufflevector <16 x i16> poison, <16 x i16> poison, <32 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v2i32 = shufflevector <2 x i32> poison, <2 x i32> poison, <2 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v2i32 = shufflevector <2 x i32> poison, <2 x i32> poison, <2 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv2i32 = shufflevector <2 x i32> poison, <2 x i32> poison, <4 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v4i32 = shufflevector <4 x i32> poison, <4 x i32> poison, <4 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v4i32 = shufflevector <4 x i32> poison, <4 x i32> poison, <4 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv4i32 = shufflevector <4 x i32> poison, <4 x i32> poison, <8 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v8i32 = shufflevector <8 x i32> poison, <8 x i32> poison, <8 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v8i32 = shufflevector <8 x i32> poison, <8 x i32> poison, <8 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv8i32 = shufflevector <8 x i32> poison, <8 x i32> poison, <16 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v16i32 = shufflevector <16 x i32> poison, <16 x i32> poison, <16 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v16i32 = shufflevector <16 x i32> poison, <16 x i32> poison, <16 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv16i32 = shufflevector <16 x i32> poison, <16 x i32> poison, <32 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v2i64 = shufflevector <2 x i64> poison, <2 x i64> poison, <2 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v2i64 = shufflevector <2 x i64> poison, <2 x i64> poison, <2 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv2i64 = shufflevector <2 x i64> poison, <2 x i64> poison, <4 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v4i64 = shufflevector <4 x i64> poison, <4 x i64> poison, <4 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v4i64 = shufflevector <4 x i64> poison, <4 x i64> poison, <4 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv4i64 = shufflevector <4 x i64> poison, <4 x i64> poison, <8 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v8i64 = shufflevector <8 x i64> poison, <8 x i64> poison, <8 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v8i64 = shufflevector <8 x i64> poison, <8 x i64> poison, <8 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv8i64 = shufflevector <8 x i64> poison, <8 x i64> poison, <16 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v16i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <16 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v16i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <16 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 96 for instruction: %zipv16i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <32 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void +; CHECK-SIZE-LABEL: 'shuffle1' +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v2i8 = shufflevector <2 x i8> poison, <2 x i8> poison, <2 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v2i8 = shufflevector <2 x i8> poison, <2 x i8> poison, <2 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv2i8 = shufflevector <2 x i8> poison, <2 x i8> poison, <4 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v4i8 = shufflevector <4 x i8> poison, <4 x i8> poison, <4 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v4i8 = shufflevector <4 x i8> poison, <4 x i8> poison, <4 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv4i8 = shufflevector <4 x i8> poison, <4 x i8> poison, <8 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v8i8 = shufflevector <8 x i8> poison, <8 x i8> poison, <8 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v8i8 = shufflevector <8 x i8> poison, <8 x i8> poison, <8 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv8i8 = shufflevector <8 x i8> poison, <8 x i8> poison, <16 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v16i8 = shufflevector <16 x i8> poison, <16 x i8> poison, <16 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v16i8 = shufflevector <16 x i8> poison, <16 x i8> poison, <16 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv16i8 = shufflevector <16 x i8> poison, <16 x i8> poison, <32 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v2i16 = shufflevector <2 x i16> poison, <2 x i16> poison, <2 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v2i16 = shufflevector <2 x i16> poison, <2 x i16> poison, <2 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv2i16 = shufflevector <2 x i16> poison, <2 x i16> poison, <4 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v4i16 = shufflevector <4 x i16> poison, <4 x i16> poison, <4 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v4i16 = shufflevector <4 x i16> poison, <4 x i16> poison, <4 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv4i16 = shufflevector <4 x i16> poison, <4 x i16> poison, <8 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v8i16 = shufflevector <8 x i16> poison, <8 x i16> poison, <8 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v8i16 = shufflevector <8 x i16> poison, <8 x i16> poison, <8 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv8i16 = shufflevector <8 x i16> poison, <8 x i16> poison, <16 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v16i16 = shufflevector <16 x i16> poison, <16 x i16> poison, <16 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v16i16 = shufflevector <16 x i16> poison, <16 x i16> poison, <16 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv16i16 = shufflevector <16 x i16> poison, <16 x i16> poison, <32 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v2i32 = shufflevector <2 x i32> poison, <2 x i32> poison, <2 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v2i32 = shufflevector <2 x i32> poison, <2 x i32> poison, <2 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv2i32 = shufflevector <2 x i32> poison, <2 x i32> poison, <4 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v4i32 = shufflevector <4 x i32> poison, <4 x i32> poison, <4 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v4i32 = shufflevector <4 x i32> poison, <4 x i32> poison, <4 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv4i32 = shufflevector <4 x i32> poison, <4 x i32> poison, <8 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v8i32 = shufflevector <8 x i32> poison, <8 x i32> poison, <8 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v8i32 = shufflevector <8 x i32> poison, <8 x i32> poison, <8 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv8i32 = shufflevector <8 x i32> poison, <8 x i32> poison, <16 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v16i32 = shufflevector <16 x i32> poison, <16 x i32> poison, <16 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v16i32 = shufflevector <16 x i32> poison, <16 x i32> poison, <16 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv16i32 = shufflevector <16 x i32> poison, <16 x i32> poison, <32 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v2i64 = shufflevector <2 x i64> poison, <2 x i64> poison, <2 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v2i64 = shufflevector <2 x i64> poison, <2 x i64> poison, <2 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv2i64 = shufflevector <2 x i64> poison, <2 x i64> poison, <4 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v4i64 = shufflevector <4 x i64> poison, <4 x i64> poison, <4 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v4i64 = shufflevector <4 x i64> poison, <4 x i64> poison, <4 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv4i64 = shufflevector <4 x i64> poison, <4 x i64> poison, <8 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v8i64 = shufflevector <8 x i64> poison, <8 x i64> poison, <8 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v8i64 = shufflevector <8 x i64> poison, <8 x i64> poison, <8 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %zipv8i64 = shufflevector <8 x i64> poison, <8 x i64> poison, <16 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip1v16i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <16 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %zip2v16i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <16 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 22 for instruction: %zipv16i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <32 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void ; %zip1v2i8 = shufflevector <2 x i8> poison, <2 x i8> poison, <2 x i32> %zip2v2i8 = shufflevector <2 x i8> poison, <2 x i8> poison, <2 x i32> @@ -567,7 +516,7 @@ define void @shuffle2() vscale_range(2,2) { ; RV32-NEXT: Cost Model: Found an estimated cost of 68 for instruction: %uzpv8i64 = shufflevector <8 x i64> poison, <8 x i64> poison, <16 x i32> ; RV32-NEXT: Cost Model: Found an estimated cost of 139 for instruction: %uzp1v16i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <16 x i32> ; RV32-NEXT: Cost Model: Found an estimated cost of 139 for instruction: %uzp2v16i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <16 x i32> -; RV32-NEXT: Cost Model: Found an estimated cost of 256 for instruction: %uzpv16i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <32 x i32> +; RV32-NEXT: Cost Model: Found an estimated cost of 278 for instruction: %uzpv16i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <32 x i32> ; RV32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void ; ; RV64-LABEL: 'shuffle2' @@ -606,86 +555,47 @@ define void @shuffle2() vscale_range(2,2) { ; RV64-NEXT: Cost Model: Found an estimated cost of 74 for instruction: %uzpv8i64 = shufflevector <8 x i64> poison, <8 x i64> poison, <16 x i32> ; RV64-NEXT: Cost Model: Found an estimated cost of 151 for instruction: %uzp1v16i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <16 x i32> ; RV64-NEXT: Cost Model: Found an estimated cost of 151 for instruction: %uzp2v16i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <16 x i32> -; RV64-NEXT: Cost Model: Found an estimated cost of 96 for instruction: %uzpv16i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <32 x i32> +; RV64-NEXT: Cost Model: Found an estimated cost of 302 for instruction: %uzpv16i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <32 x i32> ; RV64-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void ; -; RV32-SIZE-LABEL: 'shuffle2' -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp1v4i8 = shufflevector <4 x i8> poison, <4 x i8> poison, <4 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp2v4i8 = shufflevector <4 x i8> poison, <4 x i8> poison, <4 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %uzpv4i8 = shufflevector <4 x i8> poison, <4 x i8> poison, <8 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp1v8i8 = shufflevector <8 x i8> poison, <8 x i8> poison, <8 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp2v8i8 = shufflevector <8 x i8> poison, <8 x i8> poison, <8 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %uzpv8i8 = shufflevector <8 x i8> poison, <8 x i8> poison, <16 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp1v16i8 = shufflevector <16 x i8> poison, <16 x i8> poison, <16 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp2v16i8 = shufflevector <16 x i8> poison, <16 x i8> poison, <16 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %uzpv16i8 = shufflevector <16 x i8> poison, <16 x i8> poison, <32 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp1v4i16 = shufflevector <4 x i16> poison, <4 x i16> poison, <4 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp2v4i16 = shufflevector <4 x i16> poison, <4 x i16> poison, <4 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %uzpv4i16 = shufflevector <4 x i16> poison, <4 x i16> poison, <8 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp1v8i16 = shufflevector <8 x i16> poison, <8 x i16> poison, <8 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp2v8i16 = shufflevector <8 x i16> poison, <8 x i16> poison, <8 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %uzpv8i16 = shufflevector <8 x i16> poison, <8 x i16> poison, <16 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp1v16i16 = shufflevector <16 x i16> poison, <16 x i16> poison, <16 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp2v16i16 = shufflevector <16 x i16> poison, <16 x i16> poison, <16 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %uzpv16i16 = shufflevector <16 x i16> poison, <16 x i16> poison, <32 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp1v4i32 = shufflevector <4 x i32> poison, <4 x i32> poison, <4 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp2v4i32 = shufflevector <4 x i32> poison, <4 x i32> poison, <4 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %uzpv4i32 = shufflevector <4 x i32> poison, <4 x i32> poison, <8 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp1v8i32 = shufflevector <8 x i32> poison, <8 x i32> poison, <8 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp2v8i32 = shufflevector <8 x i32> poison, <8 x i32> poison, <8 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %uzpv8i32 = shufflevector <8 x i32> poison, <8 x i32> poison, <16 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp1v16i32 = shufflevector <16 x i32> poison, <16 x i32> poison, <16 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp2v16i32 = shufflevector <16 x i32> poison, <16 x i32> poison, <16 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %uzpv16i32 = shufflevector <16 x i32> poison, <16 x i32> poison, <32 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp1v4i64 = shufflevector <4 x i64> poison, <4 x i64> poison, <4 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp2v4i64 = shufflevector <4 x i64> poison, <4 x i64> poison, <4 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %uzpv4i64 = shufflevector <4 x i64> poison, <4 x i64> poison, <8 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp1v8i64 = shufflevector <8 x i64> poison, <8 x i64> poison, <8 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp2v8i64 = shufflevector <8 x i64> poison, <8 x i64> poison, <8 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %uzpv8i64 = shufflevector <8 x i64> poison, <8 x i64> poison, <16 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp1v16i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <16 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp2v16i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <16 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 256 for instruction: %uzpv16i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <32 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void -; -; RV64-SIZE-LABEL: 'shuffle2' -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp1v4i8 = shufflevector <4 x i8> poison, <4 x i8> poison, <4 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp2v4i8 = shufflevector <4 x i8> poison, <4 x i8> poison, <4 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %uzpv4i8 = shufflevector <4 x i8> poison, <4 x i8> poison, <8 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp1v8i8 = shufflevector <8 x i8> poison, <8 x i8> poison, <8 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp2v8i8 = shufflevector <8 x i8> poison, <8 x i8> poison, <8 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %uzpv8i8 = shufflevector <8 x i8> poison, <8 x i8> poison, <16 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp1v16i8 = shufflevector <16 x i8> poison, <16 x i8> poison, <16 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp2v16i8 = shufflevector <16 x i8> poison, <16 x i8> poison, <16 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %uzpv16i8 = shufflevector <16 x i8> poison, <16 x i8> poison, <32 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp1v4i16 = shufflevector <4 x i16> poison, <4 x i16> poison, <4 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp2v4i16 = shufflevector <4 x i16> poison, <4 x i16> poison, <4 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %uzpv4i16 = shufflevector <4 x i16> poison, <4 x i16> poison, <8 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp1v8i16 = shufflevector <8 x i16> poison, <8 x i16> poison, <8 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp2v8i16 = shufflevector <8 x i16> poison, <8 x i16> poison, <8 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %uzpv8i16 = shufflevector <8 x i16> poison, <8 x i16> poison, <16 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp1v16i16 = shufflevector <16 x i16> poison, <16 x i16> poison, <16 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp2v16i16 = shufflevector <16 x i16> poison, <16 x i16> poison, <16 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %uzpv16i16 = shufflevector <16 x i16> poison, <16 x i16> poison, <32 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp1v4i32 = shufflevector <4 x i32> poison, <4 x i32> poison, <4 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp2v4i32 = shufflevector <4 x i32> poison, <4 x i32> poison, <4 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %uzpv4i32 = shufflevector <4 x i32> poison, <4 x i32> poison, <8 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp1v8i32 = shufflevector <8 x i32> poison, <8 x i32> poison, <8 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp2v8i32 = shufflevector <8 x i32> poison, <8 x i32> poison, <8 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %uzpv8i32 = shufflevector <8 x i32> poison, <8 x i32> poison, <16 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp1v16i32 = shufflevector <16 x i32> poison, <16 x i32> poison, <16 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp2v16i32 = shufflevector <16 x i32> poison, <16 x i32> poison, <16 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %uzpv16i32 = shufflevector <16 x i32> poison, <16 x i32> poison, <32 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp1v4i64 = shufflevector <4 x i64> poison, <4 x i64> poison, <4 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp2v4i64 = shufflevector <4 x i64> poison, <4 x i64> poison, <4 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %uzpv4i64 = shufflevector <4 x i64> poison, <4 x i64> poison, <8 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp1v8i64 = shufflevector <8 x i64> poison, <8 x i64> poison, <8 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp2v8i64 = shufflevector <8 x i64> poison, <8 x i64> poison, <8 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %uzpv8i64 = shufflevector <8 x i64> poison, <8 x i64> poison, <16 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp1v16i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <16 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp2v16i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <16 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 96 for instruction: %uzpv16i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <32 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void +; CHECK-SIZE-LABEL: 'shuffle2' +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp1v4i8 = shufflevector <4 x i8> poison, <4 x i8> poison, <4 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp2v4i8 = shufflevector <4 x i8> poison, <4 x i8> poison, <4 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %uzpv4i8 = shufflevector <4 x i8> poison, <4 x i8> poison, <8 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp1v8i8 = shufflevector <8 x i8> poison, <8 x i8> poison, <8 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp2v8i8 = shufflevector <8 x i8> poison, <8 x i8> poison, <8 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %uzpv8i8 = shufflevector <8 x i8> poison, <8 x i8> poison, <16 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp1v16i8 = shufflevector <16 x i8> poison, <16 x i8> poison, <16 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp2v16i8 = shufflevector <16 x i8> poison, <16 x i8> poison, <16 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %uzpv16i8 = shufflevector <16 x i8> poison, <16 x i8> poison, <32 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp1v4i16 = shufflevector <4 x i16> poison, <4 x i16> poison, <4 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp2v4i16 = shufflevector <4 x i16> poison, <4 x i16> poison, <4 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %uzpv4i16 = shufflevector <4 x i16> poison, <4 x i16> poison, <8 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp1v8i16 = shufflevector <8 x i16> poison, <8 x i16> poison, <8 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp2v8i16 = shufflevector <8 x i16> poison, <8 x i16> poison, <8 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %uzpv8i16 = shufflevector <8 x i16> poison, <8 x i16> poison, <16 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp1v16i16 = shufflevector <16 x i16> poison, <16 x i16> poison, <16 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp2v16i16 = shufflevector <16 x i16> poison, <16 x i16> poison, <16 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %uzpv16i16 = shufflevector <16 x i16> poison, <16 x i16> poison, <32 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp1v4i32 = shufflevector <4 x i32> poison, <4 x i32> poison, <4 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp2v4i32 = shufflevector <4 x i32> poison, <4 x i32> poison, <4 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %uzpv4i32 = shufflevector <4 x i32> poison, <4 x i32> poison, <8 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp1v8i32 = shufflevector <8 x i32> poison, <8 x i32> poison, <8 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp2v8i32 = shufflevector <8 x i32> poison, <8 x i32> poison, <8 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %uzpv8i32 = shufflevector <8 x i32> poison, <8 x i32> poison, <16 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp1v16i32 = shufflevector <16 x i32> poison, <16 x i32> poison, <16 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp2v16i32 = shufflevector <16 x i32> poison, <16 x i32> poison, <16 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %uzpv16i32 = shufflevector <16 x i32> poison, <16 x i32> poison, <32 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp1v4i64 = shufflevector <4 x i64> poison, <4 x i64> poison, <4 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp2v4i64 = shufflevector <4 x i64> poison, <4 x i64> poison, <4 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %uzpv4i64 = shufflevector <4 x i64> poison, <4 x i64> poison, <8 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp1v8i64 = shufflevector <8 x i64> poison, <8 x i64> poison, <8 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp2v8i64 = shufflevector <8 x i64> poison, <8 x i64> poison, <8 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %uzpv8i64 = shufflevector <8 x i64> poison, <8 x i64> poison, <16 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp1v16i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <16 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 11 for instruction: %uzp2v16i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <16 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 22 for instruction: %uzpv16i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <32 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void ; %uzp1v4i8 = shufflevector <4 x i8> poison, <4 x i8> poison, <4 x i32> %uzp2v4i8 = shufflevector <4 x i8> poison, <4 x i8> poison, <4 x i32> @@ -810,11 +720,11 @@ define void @shuffle4(ptr %p) vscale_range(2,2) { ; RV32-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v8i32 = shufflevector <4 x i32> poison, <4 x i32> poison, <6 x i32> ; RV32-NEXT: Cost Model: Found an estimated cost of 22 for instruction: %v16i32 = shufflevector <8 x i32> poison, <8 x i32> poison, <12 x i32> ; RV32-NEXT: Cost Model: Found an estimated cost of 74 for instruction: %v32i32 = shufflevector <16 x i32> poison, <16 x i32> poison, <24 x i32> -; RV32-NEXT: Cost Model: Found an estimated cost of 168 for instruction: %v64i32 = shufflevector <32 x i32> poison, <32 x i32> poison, <48 x i32> +; RV32-NEXT: Cost Model: Found an estimated cost of 302 for instruction: %v64i32 = shufflevector <32 x i32> poison, <32 x i32> poison, <48 x i32> ; RV32-NEXT: Cost Model: Found an estimated cost of 19 for instruction: %v8i64 = shufflevector <4 x i64> poison, <4 x i64> poison, <6 x i32> ; RV32-NEXT: Cost Model: Found an estimated cost of 68 for instruction: %v16i64 = shufflevector <8 x i64> poison, <8 x i64> poison, <12 x i32> -; RV32-NEXT: Cost Model: Found an estimated cost of 192 for instruction: %v32i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <24 x i32> -; RV32-NEXT: Cost Model: Found an estimated cost of 384 for instruction: %v64i64 = shufflevector <32 x i64> poison, <32 x i64> poison, <48 x i32> +; RV32-NEXT: Cost Model: Found an estimated cost of 175 for instruction: %v32i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <24 x i32> +; RV32-NEXT: Cost Model: Found an estimated cost of 626 for instruction: %v64i64 = shufflevector <32 x i64> poison, <32 x i64> poison, <48 x i32> ; RV32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void ; ; RV64-LABEL: 'shuffle4' @@ -829,50 +739,31 @@ define void @shuffle4(ptr %p) vscale_range(2,2) { ; RV64-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v8i32 = shufflevector <4 x i32> poison, <4 x i32> poison, <6 x i32> ; RV64-NEXT: Cost Model: Found an estimated cost of 22 for instruction: %v16i32 = shufflevector <8 x i32> poison, <8 x i32> poison, <12 x i32> ; RV64-NEXT: Cost Model: Found an estimated cost of 74 for instruction: %v32i32 = shufflevector <16 x i32> poison, <16 x i32> poison, <24 x i32> -; RV64-NEXT: Cost Model: Found an estimated cost of 168 for instruction: %v64i32 = shufflevector <32 x i32> poison, <32 x i32> poison, <48 x i32> +; RV64-NEXT: Cost Model: Found an estimated cost of 302 for instruction: %v64i32 = shufflevector <32 x i32> poison, <32 x i32> poison, <48 x i32> ; RV64-NEXT: Cost Model: Found an estimated cost of 22 for instruction: %v8i64 = shufflevector <4 x i64> poison, <4 x i64> poison, <6 x i32> ; RV64-NEXT: Cost Model: Found an estimated cost of 74 for instruction: %v16i64 = shufflevector <8 x i64> poison, <8 x i64> poison, <12 x i32> -; RV64-NEXT: Cost Model: Found an estimated cost of 72 for instruction: %v32i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <24 x i32> -; RV64-NEXT: Cost Model: Found an estimated cost of 144 for instruction: %v64i64 = shufflevector <32 x i64> poison, <32 x i64> poison, <48 x i32> +; RV64-NEXT: Cost Model: Found an estimated cost of 187 for instruction: %v32i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <24 x i32> +; RV64-NEXT: Cost Model: Found an estimated cost of 674 for instruction: %v64i64 = shufflevector <32 x i64> poison, <32 x i64> poison, <48 x i32> ; RV64-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void ; -; RV32-SIZE-LABEL: 'shuffle4' -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v8i8 = shufflevector <4 x i8> poison, <4 x i8> poison, <6 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v16i8 = shufflevector <8 x i8> poison, <8 x i8> poison, <12 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v32i8 = shufflevector <16 x i8> poison, <16 x i8> poison, <24 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v64i8 = shufflevector <32 x i8> poison, <32 x i8> poison, <48 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v8i16 = shufflevector <4 x i16> poison, <4 x i16> poison, <6 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v16i16 = shufflevector <8 x i16> poison, <8 x i16> poison, <12 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v32i16 = shufflevector <16 x i16> poison, <16 x i16> poison, <24 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v64i16 = shufflevector <32 x i16> poison, <32 x i16> poison, <48 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v8i32 = shufflevector <4 x i32> poison, <4 x i32> poison, <6 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v16i32 = shufflevector <8 x i32> poison, <8 x i32> poison, <12 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v32i32 = shufflevector <16 x i32> poison, <16 x i32> poison, <24 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 168 for instruction: %v64i32 = shufflevector <32 x i32> poison, <32 x i32> poison, <48 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v8i64 = shufflevector <4 x i64> poison, <4 x i64> poison, <6 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v16i64 = shufflevector <8 x i64> poison, <8 x i64> poison, <12 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 192 for instruction: %v32i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <24 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 384 for instruction: %v64i64 = shufflevector <32 x i64> poison, <32 x i64> poison, <48 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void -; -; RV64-SIZE-LABEL: 'shuffle4' -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v8i8 = shufflevector <4 x i8> poison, <4 x i8> poison, <6 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v16i8 = shufflevector <8 x i8> poison, <8 x i8> poison, <12 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v32i8 = shufflevector <16 x i8> poison, <16 x i8> poison, <24 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v64i8 = shufflevector <32 x i8> poison, <32 x i8> poison, <48 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v8i16 = shufflevector <4 x i16> poison, <4 x i16> poison, <6 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v16i16 = shufflevector <8 x i16> poison, <8 x i16> poison, <12 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v32i16 = shufflevector <16 x i16> poison, <16 x i16> poison, <24 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v64i16 = shufflevector <32 x i16> poison, <32 x i16> poison, <48 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v8i32 = shufflevector <4 x i32> poison, <4 x i32> poison, <6 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v16i32 = shufflevector <8 x i32> poison, <8 x i32> poison, <12 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v32i32 = shufflevector <16 x i32> poison, <16 x i32> poison, <24 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 168 for instruction: %v64i32 = shufflevector <32 x i32> poison, <32 x i32> poison, <48 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v8i64 = shufflevector <4 x i64> poison, <4 x i64> poison, <6 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v16i64 = shufflevector <8 x i64> poison, <8 x i64> poison, <12 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 72 for instruction: %v32i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <24 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 144 for instruction: %v64i64 = shufflevector <32 x i64> poison, <32 x i64> poison, <48 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void +; CHECK-SIZE-LABEL: 'shuffle4' +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v8i8 = shufflevector <4 x i8> poison, <4 x i8> poison, <6 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v16i8 = shufflevector <8 x i8> poison, <8 x i8> poison, <12 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v32i8 = shufflevector <16 x i8> poison, <16 x i8> poison, <24 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v64i8 = shufflevector <32 x i8> poison, <32 x i8> poison, <48 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v8i16 = shufflevector <4 x i16> poison, <4 x i16> poison, <6 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v16i16 = shufflevector <8 x i16> poison, <8 x i16> poison, <12 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v32i16 = shufflevector <16 x i16> poison, <16 x i16> poison, <24 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v64i16 = shufflevector <32 x i16> poison, <32 x i16> poison, <48 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v8i32 = shufflevector <4 x i32> poison, <4 x i32> poison, <6 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v16i32 = shufflevector <8 x i32> poison, <8 x i32> poison, <12 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v32i32 = shufflevector <16 x i32> poison, <16 x i32> poison, <24 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 22 for instruction: %v64i32 = shufflevector <32 x i32> poison, <32 x i32> poison, <48 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v8i64 = shufflevector <4 x i64> poison, <4 x i64> poison, <6 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v16i64 = shufflevector <8 x i64> poison, <8 x i64> poison, <12 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 47 for instruction: %v32i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <24 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 114 for instruction: %v64i64 = shufflevector <32 x i64> poison, <32 x i64> poison, <48 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void ; %v8i8 = shufflevector <4 x i8> poison, <4 x i8> poison, <6 x i32> %v16i8 = shufflevector <8 x i8> poison, <8 x i8> poison, <12 x i32> @@ -911,11 +802,11 @@ define void @shuffle5(ptr %p) vscale_range(2,2) { ; RV32-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v8i32 = shufflevector <8 x i32> poison, <8 x i32> poison, <8 x i32> ; RV32-NEXT: Cost Model: Found an estimated cost of 22 for instruction: %v16i32 = shufflevector <16 x i32> poison, <16 x i32> poison, <16 x i32> ; RV32-NEXT: Cost Model: Found an estimated cost of 74 for instruction: %v32i32 = shufflevector <32 x i32> poison, <32 x i32> poison, <32 x i32> -; RV32-NEXT: Cost Model: Found an estimated cost of 224 for instruction: %v64i32 = shufflevector <64 x i32> poison, <64 x i32> poison, <64 x i32> +; RV32-NEXT: Cost Model: Found an estimated cost of 302 for instruction: %v64i32 = shufflevector <64 x i32> poison, <64 x i32> poison, <64 x i32> ; RV32-NEXT: Cost Model: Found an estimated cost of 19 for instruction: %v8i64 = shufflevector <8 x i64> poison, <8 x i64> poison, <8 x i32> ; RV32-NEXT: Cost Model: Found an estimated cost of 68 for instruction: %v16i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <16 x i32> -; RV32-NEXT: Cost Model: Found an estimated cost of 256 for instruction: %v32i64 = shufflevector <32 x i64> poison, <32 x i64> poison, <32 x i32> -; RV32-NEXT: Cost Model: Found an estimated cost of 512 for instruction: %v64i64 = shufflevector <64 x i64> poison, <64 x i64> poison, <64 x i32> +; RV32-NEXT: Cost Model: Found an estimated cost of 278 for instruction: %v32i64 = shufflevector <32 x i64> poison, <32 x i64> poison, <32 x i32> +; RV32-NEXT: Cost Model: Found an estimated cost of 352 for instruction: %v64i64 = shufflevector <64 x i64> poison, <64 x i64> poison, <64 x i32> ; RV32-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void ; ; RV64-LABEL: 'shuffle5' @@ -930,50 +821,31 @@ define void @shuffle5(ptr %p) vscale_range(2,2) { ; RV64-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %v8i32 = shufflevector <8 x i32> poison, <8 x i32> poison, <8 x i32> ; RV64-NEXT: Cost Model: Found an estimated cost of 22 for instruction: %v16i32 = shufflevector <16 x i32> poison, <16 x i32> poison, <16 x i32> ; RV64-NEXT: Cost Model: Found an estimated cost of 74 for instruction: %v32i32 = shufflevector <32 x i32> poison, <32 x i32> poison, <32 x i32> -; RV64-NEXT: Cost Model: Found an estimated cost of 224 for instruction: %v64i32 = shufflevector <64 x i32> poison, <64 x i32> poison, <64 x i32> +; RV64-NEXT: Cost Model: Found an estimated cost of 302 for instruction: %v64i32 = shufflevector <64 x i32> poison, <64 x i32> poison, <64 x i32> ; RV64-NEXT: Cost Model: Found an estimated cost of 22 for instruction: %v8i64 = shufflevector <8 x i64> poison, <8 x i64> poison, <8 x i32> ; RV64-NEXT: Cost Model: Found an estimated cost of 74 for instruction: %v16i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <16 x i32> -; RV64-NEXT: Cost Model: Found an estimated cost of 96 for instruction: %v32i64 = shufflevector <32 x i64> poison, <32 x i64> poison, <32 x i32> -; RV64-NEXT: Cost Model: Found an estimated cost of 192 for instruction: %v64i64 = shufflevector <64 x i64> poison, <64 x i64> poison, <64 x i32> +; RV64-NEXT: Cost Model: Found an estimated cost of 302 for instruction: %v32i64 = shufflevector <32 x i64> poison, <32 x i64> poison, <32 x i32> +; RV64-NEXT: Cost Model: Found an estimated cost of 352 for instruction: %v64i64 = shufflevector <64 x i64> poison, <64 x i64> poison, <64 x i32> ; RV64-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void ; -; RV32-SIZE-LABEL: 'shuffle5' -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v8i8 = shufflevector <8 x i8> poison, <8 x i8> poison, <8 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v16i8 = shufflevector <16 x i8> poison, <16 x i8> poison, <16 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v32i8 = shufflevector <32 x i8> poison, <32 x i8> poison, <32 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v64i8 = shufflevector <64 x i8> poison, <64 x i8> poison, <64 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v8i16 = shufflevector <8 x i16> poison, <8 x i16> poison, <8 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v16i16 = shufflevector <16 x i16> poison, <16 x i16> poison, <16 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v32i16 = shufflevector <32 x i16> poison, <32 x i16> poison, <32 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v64i16 = shufflevector <64 x i16> poison, <64 x i16> poison, <64 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v8i32 = shufflevector <8 x i32> poison, <8 x i32> poison, <8 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v16i32 = shufflevector <16 x i32> poison, <16 x i32> poison, <16 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v32i32 = shufflevector <32 x i32> poison, <32 x i32> poison, <32 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 224 for instruction: %v64i32 = shufflevector <64 x i32> poison, <64 x i32> poison, <64 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v8i64 = shufflevector <8 x i64> poison, <8 x i64> poison, <8 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v16i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <16 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 256 for instruction: %v32i64 = shufflevector <32 x i64> poison, <32 x i64> poison, <32 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 512 for instruction: %v64i64 = shufflevector <64 x i64> poison, <64 x i64> poison, <64 x i32> -; RV32-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void -; -; RV64-SIZE-LABEL: 'shuffle5' -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v8i8 = shufflevector <8 x i8> poison, <8 x i8> poison, <8 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v16i8 = shufflevector <16 x i8> poison, <16 x i8> poison, <16 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v32i8 = shufflevector <32 x i8> poison, <32 x i8> poison, <32 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v64i8 = shufflevector <64 x i8> poison, <64 x i8> poison, <64 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v8i16 = shufflevector <8 x i16> poison, <8 x i16> poison, <8 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v16i16 = shufflevector <16 x i16> poison, <16 x i16> poison, <16 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v32i16 = shufflevector <32 x i16> poison, <32 x i16> poison, <32 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v64i16 = shufflevector <64 x i16> poison, <64 x i16> poison, <64 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v8i32 = shufflevector <8 x i32> poison, <8 x i32> poison, <8 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v16i32 = shufflevector <16 x i32> poison, <16 x i32> poison, <16 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v32i32 = shufflevector <32 x i32> poison, <32 x i32> poison, <32 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 224 for instruction: %v64i32 = shufflevector <64 x i32> poison, <64 x i32> poison, <64 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v8i64 = shufflevector <8 x i64> poison, <8 x i64> poison, <8 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v16i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <16 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 96 for instruction: %v32i64 = shufflevector <32 x i64> poison, <32 x i64> poison, <32 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 192 for instruction: %v64i64 = shufflevector <64 x i64> poison, <64 x i64> poison, <64 x i32> -; RV64-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void +; CHECK-SIZE-LABEL: 'shuffle5' +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v8i8 = shufflevector <8 x i8> poison, <8 x i8> poison, <8 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v16i8 = shufflevector <16 x i8> poison, <16 x i8> poison, <16 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v32i8 = shufflevector <32 x i8> poison, <32 x i8> poison, <32 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v64i8 = shufflevector <64 x i8> poison, <64 x i8> poison, <64 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v8i16 = shufflevector <8 x i16> poison, <8 x i16> poison, <8 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v16i16 = shufflevector <16 x i16> poison, <16 x i16> poison, <16 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v32i16 = shufflevector <32 x i16> poison, <32 x i16> poison, <32 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v64i16 = shufflevector <64 x i16> poison, <64 x i16> poison, <64 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v8i32 = shufflevector <8 x i32> poison, <8 x i32> poison, <8 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v16i32 = shufflevector <16 x i32> poison, <16 x i32> poison, <16 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v32i32 = shufflevector <32 x i32> poison, <32 x i32> poison, <32 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 22 for instruction: %v64i32 = shufflevector <64 x i32> poison, <64 x i32> poison, <64 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v8i64 = shufflevector <8 x i64> poison, <8 x i64> poison, <8 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 4 for instruction: %v16i64 = shufflevector <16 x i64> poison, <16 x i64> poison, <16 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 22 for instruction: %v32i64 = shufflevector <32 x i64> poison, <32 x i64> poison, <32 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 352 for instruction: %v64i64 = shufflevector <64 x i64> poison, <64 x i64> poison, <64 x i32> +; CHECK-SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void ; %v8i8 = shufflevector <8 x i8> poison, <8 x i8> poison, <8 x i32> %v16i8 = shufflevector <16 x i8> poison, <16 x i8> poison, <16 x i32> @@ -997,3 +869,6 @@ define void @shuffle5(ptr %p) vscale_range(2,2) { ret void } +;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: +; RV32-SIZE: {{.*}} +; RV64-SIZE: {{.*}} diff --git a/llvm/test/Analysis/CostModel/RISCV/shuffle-permute.ll b/llvm/test/Analysis/CostModel/RISCV/shuffle-permute.ll index 973032853c20f..867d5aac3b9c9 100644 --- a/llvm/test/Analysis/CostModel/RISCV/shuffle-permute.ll +++ b/llvm/test/Analysis/CostModel/RISCV/shuffle-permute.ll @@ -226,24 +226,24 @@ define void @general_permute_two_source() { define void @legalization_examples() { ; CHECK-LABEL: 'legalization_examples' -; CHECK-NEXT: Cost Model: Found an estimated cost of 284 for instruction: %1 = shufflevector <32 x i64> undef, <32 x i64> undef, <16 x i32> -; CHECK-NEXT: Cost Model: Found an estimated cost of 284 for instruction: %2 = shufflevector <16 x i64> undef, <16 x i64> undef, <32 x i32> -; CHECK-NEXT: Cost Model: Found an estimated cost of 284 for instruction: %3 = shufflevector <32 x i64> undef, <32 x i64> undef, <32 x i32> -; CHECK-NEXT: Cost Model: Found an estimated cost of 284 for instruction: %4 = shufflevector <32 x i64> undef, <32 x i64> undef, <32 x i32> +; CHECK-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %1 = shufflevector <32 x i64> undef, <32 x i64> undef, <16 x i32> +; CHECK-NEXT: Cost Model: Found an estimated cost of 19 for instruction: %2 = shufflevector <16 x i64> undef, <16 x i64> undef, <32 x i32> +; CHECK-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %3 = shufflevector <32 x i64> undef, <32 x i64> undef, <32 x i32> +; CHECK-NEXT: Cost Model: Found an estimated cost of 294 for instruction: %4 = shufflevector <32 x i64> undef, <32 x i64> undef, <32 x i32> ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void ; ; SIZE-LABEL: 'legalization_examples' -; SIZE-NEXT: Cost Model: Found an estimated cost of 284 for instruction: %1 = shufflevector <32 x i64> undef, <32 x i64> undef, <16 x i32> -; SIZE-NEXT: Cost Model: Found an estimated cost of 284 for instruction: %2 = shufflevector <16 x i64> undef, <16 x i64> undef, <32 x i32> -; SIZE-NEXT: Cost Model: Found an estimated cost of 284 for instruction: %3 = shufflevector <32 x i64> undef, <32 x i64> undef, <32 x i32> -; SIZE-NEXT: Cost Model: Found an estimated cost of 284 for instruction: %4 = shufflevector <32 x i64> undef, <32 x i64> undef, <32 x i32> +; SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %1 = shufflevector <32 x i64> undef, <32 x i64> undef, <16 x i32> +; SIZE-NEXT: Cost Model: Found an estimated cost of 5 for instruction: %2 = shufflevector <16 x i64> undef, <16 x i64> undef, <32 x i32> +; SIZE-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %3 = shufflevector <32 x i64> undef, <32 x i64> undef, <32 x i32> +; SIZE-NEXT: Cost Model: Found an estimated cost of 24 for instruction: %4 = shufflevector <32 x i64> undef, <32 x i64> undef, <32 x i32> ; SIZE-NEXT: Cost Model: Found an estimated cost of 1 for instruction: ret void ; ; LOG-VRG-LABEL: 'legalization_examples' -; LOG-VRG-NEXT: Cost Model: Found an estimated cost of 284 for instruction: %1 = shufflevector <32 x i64> undef, <32 x i64> undef, <16 x i32> -; LOG-VRG-NEXT: Cost Model: Found an estimated cost of 284 for instruction: %2 = shufflevector <16 x i64> undef, <16 x i64> undef, <32 x i32> -; LOG-VRG-NEXT: Cost Model: Found an estimated cost of 284 for instruction: %3 = shufflevector <32 x i64> undef, <32 x i64> undef, <32 x i32> -; LOG-VRG-NEXT: Cost Model: Found an estimated cost of 284 for instruction: %4 = shufflevector <32 x i64> undef, <32 x i64> undef, <32 x i32> +; LOG-VRG-NEXT: Cost Model: Found an estimated cost of 8 for instruction: %1 = shufflevector <32 x i64> undef, <32 x i64> undef, <16 x i32> +; LOG-VRG-NEXT: Cost Model: Found an estimated cost of 19 for instruction: %2 = shufflevector <16 x i64> undef, <16 x i64> undef, <32 x i32> +; LOG-VRG-NEXT: Cost Model: Found an estimated cost of 16 for instruction: %3 = shufflevector <32 x i64> undef, <32 x i64> undef, <32 x i32> +; LOG-VRG-NEXT: Cost Model: Found an estimated cost of 134 for instruction: %4 = shufflevector <32 x i64> undef, <32 x i64> undef, <32 x i32> ; LOG-VRG-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void ; shufflevector <32 x i64> undef, <32 x i64> undef, <16 x i32> diff --git a/llvm/test/Transforms/SLPVectorizer/RISCV/reductions.ll b/llvm/test/Transforms/SLPVectorizer/RISCV/reductions.ll index 5d9975b25c381..443d8aabcf82f 100644 --- a/llvm/test/Transforms/SLPVectorizer/RISCV/reductions.ll +++ b/llvm/test/Transforms/SLPVectorizer/RISCV/reductions.ll @@ -335,57 +335,17 @@ entry: } define void @reduce_or_2() { -; ZVFHMIN-LABEL: @reduce_or_2( -; ZVFHMIN-NEXT: [[TMP1:%.*]] = shl i64 0, 0 -; ZVFHMIN-NEXT: [[TMP2:%.*]] = insertelement <16 x i64> , i64 [[TMP1]], i32 15 -; ZVFHMIN-NEXT: [[TMP3:%.*]] = icmp ult <16 x i64> [[TMP2]], zeroinitializer -; ZVFHMIN-NEXT: [[TMP4:%.*]] = insertelement <16 x i64> , i64 [[TMP1]], i32 6 -; ZVFHMIN-NEXT: [[TMP5:%.*]] = icmp ult <16 x i64> [[TMP4]], zeroinitializer -; ZVFHMIN-NEXT: [[RDX_OP:%.*]] = or <16 x i1> [[TMP3]], [[TMP5]] -; ZVFHMIN-NEXT: [[TMP6:%.*]] = call i1 @llvm.vector.reduce.or.v16i1(<16 x i1> [[RDX_OP]]) -; ZVFHMIN-NEXT: br i1 [[TMP6]], label [[TMP8:%.*]], label [[TMP7:%.*]] -; ZVFHMIN: 7: -; ZVFHMIN-NEXT: ret void -; ZVFHMIN: 8: -; ZVFHMIN-NEXT: ret void -; -; ZVL128-LABEL: @reduce_or_2( -; ZVL128-NEXT: [[TMP1:%.*]] = shl i64 0, 0 -; ZVL128-NEXT: [[TMP2:%.*]] = insertelement <16 x i64> , i64 [[TMP1]], i32 15 -; ZVL128-NEXT: [[TMP3:%.*]] = icmp ult <16 x i64> [[TMP2]], zeroinitializer -; ZVL128-NEXT: [[TMP4:%.*]] = insertelement <16 x i64> , i64 [[TMP1]], i32 6 -; ZVL128-NEXT: [[TMP5:%.*]] = icmp ult <16 x i64> [[TMP4]], zeroinitializer -; ZVL128-NEXT: [[RDX_OP:%.*]] = or <16 x i1> [[TMP3]], [[TMP5]] -; ZVL128-NEXT: [[TMP6:%.*]] = call i1 @llvm.vector.reduce.or.v16i1(<16 x i1> [[RDX_OP]]) -; ZVL128-NEXT: br i1 [[TMP6]], label [[TMP8:%.*]], label [[TMP7:%.*]] -; ZVL128: 7: -; ZVL128-NEXT: ret void -; ZVL128: 8: -; ZVL128-NEXT: ret void -; -; ZVL256-LABEL: @reduce_or_2( -; ZVL256-NEXT: [[TMP1:%.*]] = shl i64 0, 0 -; ZVL256-NEXT: [[TMP2:%.*]] = insertelement <32 x i64> , i64 [[TMP1]], i32 15 -; ZVL256-NEXT: [[TMP3:%.*]] = shufflevector <32 x i64> [[TMP2]], <32 x i64> poison, <32 x i32> -; ZVL256-NEXT: [[TMP4:%.*]] = icmp ult <32 x i64> [[TMP3]], zeroinitializer -; ZVL256-NEXT: [[TMP5:%.*]] = call i1 @llvm.vector.reduce.or.v32i1(<32 x i1> [[TMP4]]) -; ZVL256-NEXT: br i1 [[TMP5]], label [[TMP7:%.*]], label [[TMP6:%.*]] -; ZVL256: 6: -; ZVL256-NEXT: ret void -; ZVL256: 7: -; ZVL256-NEXT: ret void -; -; ZVL512-LABEL: @reduce_or_2( -; ZVL512-NEXT: [[TMP1:%.*]] = shl i64 0, 0 -; ZVL512-NEXT: [[TMP2:%.*]] = insertelement <32 x i64> , i64 [[TMP1]], i32 15 -; ZVL512-NEXT: [[TMP3:%.*]] = shufflevector <32 x i64> [[TMP2]], <32 x i64> poison, <32 x i32> -; ZVL512-NEXT: [[TMP4:%.*]] = icmp ult <32 x i64> [[TMP3]], zeroinitializer -; ZVL512-NEXT: [[TMP5:%.*]] = call i1 @llvm.vector.reduce.or.v32i1(<32 x i1> [[TMP4]]) -; ZVL512-NEXT: br i1 [[TMP5]], label [[TMP7:%.*]], label [[TMP6:%.*]] -; ZVL512: 6: -; ZVL512-NEXT: ret void -; ZVL512: 7: -; ZVL512-NEXT: ret void +; CHECK-LABEL: @reduce_or_2( +; CHECK-NEXT: [[TMP1:%.*]] = shl i64 0, 0 +; CHECK-NEXT: [[TMP2:%.*]] = insertelement <32 x i64> , i64 [[TMP1]], i32 15 +; CHECK-NEXT: [[TMP3:%.*]] = shufflevector <32 x i64> [[TMP2]], <32 x i64> poison, <32 x i32> +; CHECK-NEXT: [[TMP4:%.*]] = icmp ult <32 x i64> [[TMP3]], zeroinitializer +; CHECK-NEXT: [[TMP5:%.*]] = call i1 @llvm.vector.reduce.or.v32i1(<32 x i1> [[TMP4]]) +; CHECK-NEXT: br i1 [[TMP5]], label [[TMP7:%.*]], label [[TMP6:%.*]] +; CHECK: 6: +; CHECK-NEXT: ret void +; CHECK: 7: +; CHECK-NEXT: ret void ; %1 = shl i64 0, 0 %2 = icmp ult i64 0, 0 @@ -1278,3 +1238,7 @@ define half @fmul_4xf16(ptr %p) { ret half %r2 } +;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: +; ZVL128: {{.*}} +; ZVL256: {{.*}} +; ZVL512: {{.*}} From abb3ef508de49436f5a7c5bb758ad130ff8f5db3 Mon Sep 17 00:00:00 2001 From: Philip Reames Date: Thu, 17 Apr 2025 19:53:52 -0700 Subject: [PATCH 2/4] Fix spelling in comment --- llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp index 39b571c358460..efcc28bc0f1df 100644 --- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp +++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp @@ -385,7 +385,7 @@ static VectorType *getVRGatherIndexType(MVT DataVT, const RISCVSubtarget &ST, /// Attempt to approximate the cost of a shuffle which will require splitting /// during legalization. Note that processShuffleMasks is not an exact proxy -/// for the algorithm used in LegalizeVectorTypes, but hopefull it's a +/// for the algorithm used in LegalizeVectorTypes, but hopefully it's a /// reasonably close upperbound. static InstructionCost costShuffleViaSplitting(RISCVTTIImpl &TTI, MVT LegalVT, VectorType *Tp, From 42e3aa5b59e4b473ed85bfb7cc7a6bd6d4e549e1 Mon Sep 17 00:00:00 2001 From: Philip Reames Date: Fri, 18 Apr 2025 09:00:33 -0700 Subject: [PATCH 3/4] Address review comment --- llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp | 2 +- llvm/test/Transforms/SLPVectorizer/RISCV/reductions.ll | 10 +++------- 2 files changed, 4 insertions(+), 8 deletions(-) diff --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp index efcc28bc0f1df..0b0edf27be1d4 100644 --- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp +++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp @@ -391,7 +391,7 @@ static InstructionCost costShuffleViaSplitting(RISCVTTIImpl &TTI, MVT LegalVT, VectorType *Tp, ArrayRef Mask, TTI::TargetCostKind CostKind) { - assert(LegalVT.isFixedLengthVector() && !Mask.empty()); + assert(LegalVT.isFixedLengthVector() && !Mask.empty() && "precondition"); unsigned LegalNumElts = LegalVT.getVectorNumElements(); // Number of destination vectors after legalization: unsigned NumOfDests = divideCeil(Mask.size(), LegalNumElts); diff --git a/llvm/test/Transforms/SLPVectorizer/RISCV/reductions.ll b/llvm/test/Transforms/SLPVectorizer/RISCV/reductions.ll index 443d8aabcf82f..db09843a6ef72 100644 --- a/llvm/test/Transforms/SLPVectorizer/RISCV/reductions.ll +++ b/llvm/test/Transforms/SLPVectorizer/RISCV/reductions.ll @@ -4,13 +4,13 @@ ; RUN: | FileCheck %s --check-prefixes=CHECK,ZVFHMIN ; RUN: opt < %s -passes=slp-vectorizer -mtriple=riscv64 \ ; RUN: -mattr=+v,+zvfh,+zvfbfmin -riscv-v-slp-max-vf=0 -S \ -; RUN: | FileCheck %s --check-prefixes=CHECK,ZVFH,ZVL128 +; RUN: | FileCheck %s --check-prefixes=CHECK,ZVFH ; RUN: opt < %s -passes=slp-vectorizer -mtriple=riscv64 \ ; RUN: -mattr=+v,+zvl256b,+zvfh,+zvfbfmin -riscv-v-slp-max-vf=0 -S \ -; RUN: | FileCheck %s --check-prefixes=CHECK,ZVFH,ZVL256 +; RUN: | FileCheck %s --check-prefixes=CHECK,ZVFH ; RUN: opt < %s -passes=slp-vectorizer -mtriple=riscv64 \ ; RUN: -mattr=+v,+zvl512b,+zvfh,+zvfbfmin -riscv-v-slp-max-vf=0 -S \ -; RUN: | FileCheck %s --check-prefixes=CHECK,ZVFH,ZVL512 +; RUN: | FileCheck %s --check-prefixes=CHECK,ZVFH target datalayout = "e-m:e-p:64:64-i64:64-i128:128-n64-S128" target triple = "riscv64" @@ -1238,7 +1238,3 @@ define half @fmul_4xf16(ptr %p) { ret half %r2 } -;; NOTE: These prefixes are unused and the list is autogenerated. Do not add tests below this line: -; ZVL128: {{.*}} -; ZVL256: {{.*}} -; ZVL512: {{.*}} From b5548e685fe0a2c73798a733006bbb10df63a23f Mon Sep 17 00:00:00 2001 From: Philip Reames Date: Tue, 22 Apr 2025 10:41:21 -0700 Subject: [PATCH 4/4] Address review comment --- llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp index 0b0edf27be1d4..2232e5fd6f164 100644 --- a/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp +++ b/llvm/lib/Target/RISCV/RISCVTargetTransformInfo.cpp @@ -391,7 +391,8 @@ static InstructionCost costShuffleViaSplitting(RISCVTTIImpl &TTI, MVT LegalVT, VectorType *Tp, ArrayRef Mask, TTI::TargetCostKind CostKind) { - assert(LegalVT.isFixedLengthVector() && !Mask.empty() && "precondition"); + assert(LegalVT.isFixedLengthVector() && !Mask.empty() && + "Expected fixed vector type and non-empty mask"); unsigned LegalNumElts = LegalVT.getVectorNumElements(); // Number of destination vectors after legalization: unsigned NumOfDests = divideCeil(Mask.size(), LegalNumElts);