[PATCH] D97758: [AArch64] Add cost model for shuffle reverse with i1 and scalable vector
Caroline via Phabricator via llvm-commits
llvm-commits at lists.llvm.org
Tue Mar 2 01:36:09 PST 2021
CarolineConcatto created this revision.
Herald added subscribers: danielkiss, hiraditya, kristof.beyls.
CarolineConcatto requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.
This patch adds the cost model for experimental.vector.reverse
with scalable vector types: nxv16i1, nxv8i1, nxv4i1 and nxv2i1.
These types are missing from the previous cost model patch D95603 <https://reviews.llvm.org/D95603>.
The cost model for experimental.vector.reverse with 1 bit mask is used by
loop vectorization in the patch D95363 <https://reviews.llvm.org/D95363>
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D97758
Files:
llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
llvm/test/Analysis/CostModel/AArch64/getIntrinsicInstrCost-vector-reverse.ll
llvm/test/Analysis/CostModel/AArch64/sve-getIntrinsicInstrCost-vector-reverse.ll
Index: llvm/test/Analysis/CostModel/AArch64/sve-getIntrinsicInstrCost-vector-reverse.ll
===================================================================
--- llvm/test/Analysis/CostModel/AArch64/sve-getIntrinsicInstrCost-vector-reverse.ll
+++ llvm/test/Analysis/CostModel/AArch64/sve-getIntrinsicInstrCost-vector-reverse.ll
@@ -25,6 +25,10 @@
; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %14 = call <vscale x 4 x double> @llvm.experimental.vector.reverse.nxv4f64(<vscale x 4 x double> undef)
; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %15 = call <vscale x 8 x bfloat> @llvm.experimental.vector.reverse.nxv8bf16(<vscale x 8 x bfloat> undef)
; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %16 = call <vscale x 16 x bfloat> @llvm.experimental.vector.reverse.nxv16bf16(<vscale x 16 x bfloat> undef)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %17 = call <vscale x 16 x i1> @llvm.experimental.vector.reverse.nxv16i1(<vscale x 16 x i1> undef)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %18 = call <vscale x 8 x i1> @llvm.experimental.vector.reverse.nxv8i1(<vscale x 8 x i1> undef)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %19 = call <vscale x 4 x i1> @llvm.experimental.vector.reverse.nxv4i1(<vscale x 4 x i1> undef)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 1 for instruction: %20 = call <vscale x 2 x i1> @llvm.experimental.vector.reverse.nxv2i1(<vscale x 2 x i1> undef)
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
call <vscale x 16 x i8> @llvm.experimental.vector.reverse.nxv16i8(<vscale x 16 x i8> undef)
@@ -43,6 +47,10 @@
call <vscale x 4 x double> @llvm.experimental.vector.reverse.nxv4f64(<vscale x 4 x double> undef)
call <vscale x 8 x bfloat> @llvm.experimental.vector.reverse.nxv8bf16(<vscale x 8 x bfloat> undef)
call <vscale x 16 x bfloat> @llvm.experimental.vector.reverse.nxv16bf16(<vscale x 16 x bfloat> undef)
+ call <vscale x 16 x i1> @llvm.experimental.vector.reverse.nxv16i1(<vscale x 16 x i1> undef)
+ call <vscale x 8 x i1> @llvm.experimental.vector.reverse.nxv8i1(<vscale x 8 x i1> undef)
+ call <vscale x 4 x i1> @llvm.experimental.vector.reverse.nxv4i1(<vscale x 4 x i1> undef)
+ call <vscale x 2 x i1> @llvm.experimental.vector.reverse.nxv2i1(<vscale x 2 x i1> undef)
ret void
}
@@ -64,3 +72,7 @@
declare <vscale x 4 x double> @llvm.experimental.vector.reverse.nxv4f64(<vscale x 4 x double>)
declare <vscale x 8 x bfloat> @llvm.experimental.vector.reverse.nxv8bf16(<vscale x 8 x bfloat>)
declare <vscale x 16 x bfloat> @llvm.experimental.vector.reverse.nxv16bf16(<vscale x 16 x bfloat>)
+declare <vscale x 16 x i1> @llvm.experimental.vector.reverse.nxv16i1(<vscale x 16 x i1>)
+declare <vscale x 8 x i1> @llvm.experimental.vector.reverse.nxv8i1(<vscale x 8 x i1>)
+declare <vscale x 4 x i1> @llvm.experimental.vector.reverse.nxv4i1(<vscale x 4 x i1>)
+declare <vscale x 2 x i1> @llvm.experimental.vector.reverse.nxv2i1(<vscale x 2 x i1>)
Index: llvm/test/Analysis/CostModel/AArch64/getIntrinsicInstrCost-vector-reverse.ll
===================================================================
--- llvm/test/Analysis/CostModel/AArch64/getIntrinsicInstrCost-vector-reverse.ll
+++ llvm/test/Analysis/CostModel/AArch64/getIntrinsicInstrCost-vector-reverse.ll
@@ -25,6 +25,10 @@
; CHECK-NEXT: Cost Model: Found an estimated cost of 12 for instruction: %14 = call <4 x double> @llvm.experimental.vector.reverse.v4f64(<4 x double> undef)
; CHECK-NEXT: Cost Model: Found an estimated cost of 42 for instruction: %15 = call <8 x bfloat> @llvm.experimental.vector.reverse.v8bf16(<8 x bfloat> undef)
; CHECK-NEXT: Cost Model: Found an estimated cost of 84 for instruction: %16 = call <16 x bfloat> @llvm.experimental.vector.reverse.v16bf16(<16 x bfloat> undef)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 90 for instruction: %17 = call <16 x i1> @llvm.experimental.vector.reverse.v16i1(<16 x i1> undef)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 42 for instruction: %18 = call <8 x i1> @llvm.experimental.vector.reverse.v8i1(<8 x i1> undef)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 18 for instruction: %19 = call <4 x i1> @llvm.experimental.vector.reverse.v4i1(<4 x i1> undef)
+; CHECK-NEXT: Cost Model: Found an estimated cost of 6 for instruction: %20 = call <2 x i1> @llvm.experimental.vector.reverse.v2i1(<2 x i1> undef)
; CHECK-NEXT: Cost Model: Found an estimated cost of 0 for instruction: ret void
call <16 x i8> @llvm.experimental.vector.reverse.v16i8(<16 x i8> undef)
@@ -43,6 +47,10 @@
call <4 x double> @llvm.experimental.vector.reverse.v4f64(<4 x double> undef)
call <8 x bfloat> @llvm.experimental.vector.reverse.v8bf16(<8 x bfloat> undef)
call <16 x bfloat> @llvm.experimental.vector.reverse.v16bf16(<16 x bfloat> undef)
+ call <16 x i1> @llvm.experimental.vector.reverse.nxv16i1(<16 x i1> undef)
+ call <8 x i1> @llvm.experimental.vector.reverse.nxv8i1(<8 x i1> undef)
+ call <4 x i1> @llvm.experimental.vector.reverse.nxv4i1(<4 x i1> undef)
+ call <2 x i1> @llvm.experimental.vector.reverse.nxv2i1(<2 x i1> undef)
ret void
}
@@ -63,3 +71,7 @@
declare <4 x double> @llvm.experimental.vector.reverse.v4f64(<4 x double>)
declare <8 x bfloat> @llvm.experimental.vector.reverse.v8bf16(<8 x bfloat>)
declare <16 x bfloat> @llvm.experimental.vector.reverse.v16bf16(<16 x bfloat>)
+declare < 16 x i1> @llvm.experimental.vector.reverse.nxv16i1(<16 x i1>)
+declare <8 x i1> @llvm.experimental.vector.reverse.nxv8i1(<8 x i1>)
+declare <4 x i1> @llvm.experimental.vector.reverse.nxv4i1(<4 x i1>)
+declare <2 x i1> @llvm.experimental.vector.reverse.nxv2i1(<2 x i1>)
Index: llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
===================================================================
--- llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
+++ llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
@@ -1243,6 +1243,10 @@
{ TTI::SK_Reverse, MVT::nxv8bf16, 1 },
{ TTI::SK_Reverse, MVT::nxv4f32, 1 },
{ TTI::SK_Reverse, MVT::nxv2f64, 1 },
+ { TTI::SK_Reverse, MVT::nxv16i1, 1 },
+ { TTI::SK_Reverse, MVT::nxv8i1, 1 },
+ { TTI::SK_Reverse, MVT::nxv4i1, 1 },
+ { TTI::SK_Reverse, MVT::nxv2i1, 1 },
};
std::pair<int, MVT> LT = TLI->getTypeLegalizationCost(DL, Tp);
if (const auto *Entry = CostTableLookup(ShuffleTbl, Kind, LT.second))
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D97758.327385.patch
Type: text/x-patch
Size: 6571 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210302/17d6a808/attachment.bin>
More information about the llvm-commits
mailing list