[PATCH] D97758: [CostModel][SVE] 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 08:44:38 PST 2021


CarolineConcatto updated this revision to Diff 327471.
CarolineConcatto added a comment.

- return file getIntrinsicInstrCost-vector-reverse.ll with the i1 test


Repository:
  rG LLVM Github Monorepo

CHANGES SINCE LAST ACTION
  https://reviews.llvm.org/D97758/new/

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-intrinsics.ll


Index: llvm/test/Analysis/CostModel/AArch64/sve-intrinsics.ll
===================================================================
--- llvm/test/Analysis/CostModel/AArch64/sve-intrinsics.ll
+++ llvm/test/Analysis/CostModel/AArch64/sve-intrinsics.ll
@@ -133,6 +133,11 @@
 ; CHECK-NEXT: Cost Model: Found an estimated cost of 2 for instruction: %reverse_nxv4f64 = 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: %reverse_nxv8bf16 = 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: %reverse_nxv16bf16 = 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:   %reverse_nxv16i1 = 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:   %reverse_nxv8i1 = 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:   %reverse_nxv4i1 = 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:   %reverse_nxv2i1 = call <vscale x 2 x i1> @llvm.experimental.vector.reverse.nxv2i1(<vscale x 2 x i1> undef)
+
   %reverse_nxv16i8 = call <vscale x 16 x i8> @llvm.experimental.vector.reverse.nxv16i8(<vscale x 16 x i8> undef)
   %reverse_nxv32i8 = call <vscale x 32 x i8> @llvm.experimental.vector.reverse.nxv32i8(<vscale x 32 x i8> undef)
   %reverse_nxv8i16 = call <vscale x 8 x i16> @llvm.experimental.vector.reverse.nxv8i16(<vscale x 8 x i16> undef)
@@ -149,6 +154,10 @@
   %reverse_nxv4f64 = call <vscale x 4 x double> @llvm.experimental.vector.reverse.nxv4f64(<vscale x 4 x double> undef)
   %reverse_nxv8bf16 = call <vscale x 8 x bfloat> @llvm.experimental.vector.reverse.nxv8bf16(<vscale x 8 x bfloat> undef)
   %reverse_nxv16bf16 = call <vscale x 16 x bfloat> @llvm.experimental.vector.reverse.nxv16bf16(<vscale x 16 x bfloat> undef)
+  %reverse_nxv16i1 = call <vscale x 16 x i1> @llvm.experimental.vector.reverse.nxv16i1(<vscale x 16 x i1> undef)
+  %reverse_nxv8i1 =  call <vscale x 8 x i1> @llvm.experimental.vector.reverse.nxv8i1(<vscale x 8 x i1> undef)
+  %reverse_nxv4i1 = call <vscale x 4 x i1> @llvm.experimental.vector.reverse.nxv4i1(<vscale x 4 x i1> undef)
+  %reverse_nxv2i1 = call <vscale x 2 x i1> @llvm.experimental.vector.reverse.nxv2i1(<vscale x 2 x i1> undef)
   ret void
 }
 declare <vscale x 16 x i8> @llvm.experimental.vector.reverse.nxv16i8(<vscale x 16 x i8>)
@@ -167,5 +176,9 @@
 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>)
 
 attributes #0 = { "target-features"="+sve,+bf16" }
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.v16i1(<16 x i1> undef)
+  call <8 x i1> @llvm.experimental.vector.reverse.v8i1(<8 x i1> undef)
+  call <4 x i1> @llvm.experimental.vector.reverse.v4i1(<4 x i1> undef)
+  call <2 x i1> @llvm.experimental.vector.reverse.v2i1(<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.v16i1(<16 x i1>)
+declare <8 x i1> @llvm.experimental.vector.reverse.v8i1(<8 x i1>)
+declare <4 x i1> @llvm.experimental.vector.reverse.v4i1(<4 x i1>)
+declare <2 x i1> @llvm.experimental.vector.reverse.v2i1(<2 x i1>)
Index: llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
===================================================================
--- llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
+++ llvm/lib/Target/AArch64/AArch64TargetTransformInfo.cpp
@@ -1279,6 +1279,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.327471.patch
Type: text/x-patch
Size: 7006 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20210302/9c3ce805/attachment.bin>


More information about the llvm-commits mailing list