[PATCH] D96253: [BasicTTIImpl] Fix getCastInstrCost for scalable vectors by querying for ElementCount.
Sander de Smalen via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Fri Feb 12 00:29:31 PST 2021
This revision was landed with ongoing or failed builds.
This revision was automatically updated to reflect the committed changes.
Closed by commit rG1d42ba254fa3: [BasicTTIImpl] Fix getCastInstrCost for scalable vectors by querying for… (authored by sdesmalen).
Repository:
rG LLVM Github Monorepo
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D96253/new/
https://reviews.llvm.org/D96253
Files:
llvm/include/llvm/CodeGen/BasicTTIImpl.h
llvm/test/Analysis/CostModel/AArch64/cast.ll
Index: llvm/test/Analysis/CostModel/AArch64/cast.ll
===================================================================
--- llvm/test/Analysis/CostModel/AArch64/cast.ll
+++ 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 <vscale x 2 x i32>, <vscale x 2 x i32>* undef
+; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %loadnxv4i32 = load <vscale x 4 x i32>, <vscale x 4 x i32>* 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 <vscale x 2 x i32> %loadnxv2i32 to <vscale x 2 x i64>
+; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: %v15 = zext <vscale x 2 x i32> %loadnxv2i32 to <vscale x 2 x i64>
+; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v16 = sext <vscale x 4 x i32> %loadnxv4i32 to <vscale x 4 x i64>
+; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %v17 = zext <vscale x 4 x i32> %loadnxv4i32 to <vscale x 4 x i64>
; 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 <vscale x 2 x i32>, <vscale x 2 x i32>* undef
+ %loadnxv4i32 = load <vscale x 4 x i32>, <vscale x 4 x i32>* 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 <vscale x 2 x i32> %loadnxv2i32 to <vscale x 2 x i64>
+ %v15 = zext <vscale x 2 x i32> %loadnxv2i32 to <vscale x 2 x i64>
+ %v16 = sext <vscale x 4 x i32> %loadnxv4i32 to <vscale x 4 x i64>
+ %v17 = zext <vscale x 4 x i32> %loadnxv4i32 to <vscale x 4 x i64>
ret i32 undef
}
@@ -808,3 +820,5 @@
store i8 %r5, i8* undef
ret i32 undef
}
+
+attributes #0 = { "target-features"="+sve" }
Index: llvm/include/llvm/CodeGen/BasicTTIImpl.h
===================================================================
--- llvm/include/llvm/CodeGen/BasicTTIImpl.h
+++ 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<FixedVectorType>(SrcVTy)->getNumElements() > 1 &&
- cast<FixedVectorType>(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<T *>(this);
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D96253.323233.patch
Type: text/x-patch
Size: 4410 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210212/a9d7447e/attachment.bin>
More information about the llvm-commits
mailing list