diff --git a/llvm/include/llvm/CodeGen/BasicTTIImpl.h b/llvm/include/llvm/CodeGen/BasicTTIImpl.h --- a/llvm/include/llvm/CodeGen/BasicTTIImpl.h +++ b/llvm/include/llvm/CodeGen/BasicTTIImpl.h @@ -852,9 +852,8 @@ bool SplitDst = TLI->getTypeAction(Dst->getContext(), TLI->getValueType(DL, Dst)) == TargetLowering::TypeSplitVector; - if ((SplitSrc || SplitDst) && - cast(SrcVTy)->getNumElements() > 1 && - cast(DstVTy)->getNumElements() > 1) { + if ((SplitSrc || SplitDst) && SrcVTy->getElementCount().isVector() && + DstVTy->getElementCount().isVector()) { Type *SplitDstTy = VectorType::getHalfElementsVectorType(DstVTy); Type *SplitSrcTy = VectorType::getHalfElementsVectorType(SrcVTy); T *TTI = static_cast(this); diff --git a/llvm/test/Analysis/CostModel/AArch64/cast.ll b/llvm/test/Analysis/CostModel/AArch64/cast.ll --- a/llvm/test/Analysis/CostModel/AArch64/cast.ll +++ b/llvm/test/Analysis/CostModel/AArch64/cast.ll @@ -696,7 +696,7 @@ ret i32 undef } -define i32 @load_extends() { +define i32 @load_extends() #0 { ; CHECK-LABEL: 'load_extends' ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %loadi8 = load i8, i8* undef ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %loadi16 = load i16, i16* undef @@ -708,6 +708,8 @@ ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %loadv4i16 = load <4 x i16>, <4 x i16>* undef ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %loadv2i32 = load <2 x i32>, <2 x i32>* undef ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %loadv4i32 = load <4 x i32>, <4 x i32>* undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %loadnxv2i32 = load , * undef +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %loadnxv4i32 = load , * undef ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r0 = sext i8 %loadi8 to i16 ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r1 = zext i8 %loadi8 to i16 ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %r2 = sext i8 %loadi8 to i32 @@ -734,6 +736,10 @@ ; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v11 = zext <2 x i32> %loadv2i32 to <2 x i64> ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %v12 = sext <4 x i32> %loadv4i32 to <4 x i64> ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %v13 = zext <4 x i32> %loadv4i32 to <4 x i64> +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v14 = sext %loadnxv2i32 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v15 = zext %loadnxv2i32 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v16 = sext %loadnxv4i32 to +; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v17 = zext %loadnxv4i32 to ; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret i32 undef ; %loadi8 = load i8, i8* undef @@ -746,6 +752,8 @@ %loadv4i16 = load <4 x i16>, <4 x i16>* undef %loadv2i32 = load <2 x i32>, <2 x i32>* undef %loadv4i32 = load <4 x i32>, <4 x i32>* undef + %loadnxv2i32 = load , * undef + %loadnxv4i32 = load , * undef %r0 = sext i8 %loadi8 to i16 %r1 = zext i8 %loadi8 to i16 @@ -774,6 +782,10 @@ %v11 = zext <2 x i32> %loadv2i32 to <2 x i64> %v12 = sext <4 x i32> %loadv4i32 to <4 x i64> %v13 = zext <4 x i32> %loadv4i32 to <4 x i64> + %v14 = sext %loadnxv2i32 to + %v15 = zext %loadnxv2i32 to + %v16 = sext %loadnxv4i32 to + %v17 = zext %loadnxv4i32 to ret i32 undef } @@ -808,3 +820,5 @@ store i8 %r5, i8* undef ret i32 undef } + +attributes #0 = { "target-features"="+sve" }