[PATCH] D124835: [AArch64] Add -aarch64-insert-extract-cost-adjustment

Peter Waller via Phabricator via llvm-commits llvm-commits at lists.llvm.org
Tue May 3 02:48:08 PDT 2022


peterwaller-arm created this revision.
peterwaller-arm added reviewers: bsmith, paulwalker-arm.
Herald added subscribers: hiraditya, kristof.beyls.
Herald added a project: All.
peterwaller-arm requested review of this revision.
Herald added a project: LLVM.
Herald added a subscriber: llvm-commits.

The new flag -aarch64-insert-extract-cost-adjustment can be used to
adjust the value of AArch64Subtarget::getVectorInsertExtractBaseCost(),
for the purposes of experimentation. It can be adjusted up or down and
is clamped at zero.


Repository:
  rG LLVM Github Monorepo

https://reviews.llvm.org/D124835

Files:
  llvm/lib/Target/AArch64/AArch64Subtarget.cpp
  llvm/lib/Target/AArch64/AArch64Subtarget.h


Index: llvm/lib/Target/AArch64/AArch64Subtarget.h
===================================================================
--- llvm/lib/Target/AArch64/AArch64Subtarget.h
+++ llvm/lib/Target/AArch64/AArch64Subtarget.h
@@ -209,9 +209,7 @@
   }
 
   unsigned getMaxInterleaveFactor() const { return MaxInterleaveFactor; }
-  unsigned getVectorInsertExtractBaseCost() const {
-    return VectorInsertExtractBaseCost;
-  }
+  unsigned getVectorInsertExtractBaseCost() const;
   unsigned getCacheLineSize() const override { return CacheLineSize; }
   unsigned getPrefetchDistance() const override { return PrefetchDistance; }
   unsigned getMinPrefetchStride(unsigned NumMemAccesses,
Index: llvm/lib/Target/AArch64/AArch64Subtarget.cpp
===================================================================
--- llvm/lib/Target/AArch64/AArch64Subtarget.cpp
+++ llvm/lib/Target/AArch64/AArch64Subtarget.cpp
@@ -52,6 +52,15 @@
 static cl::opt<bool> UseAA("aarch64-use-aa", cl::init(true),
                            cl::desc("Enable the use of AA during codegen."));
 
+static cl::opt<int> VectorInsertExtractCostAdjustment(
+    "aarch64-insert-extract-cost-adjustment", cl::init(0),
+    cl::desc("Adjustment to base cost of vector insert/extract"), cl::Hidden);
+
+unsigned AArch64Subtarget::getVectorInsertExtractBaseCost() const {
+  return std::max(0, static_cast<int>(VectorInsertExtractBaseCost) +
+                         VectorInsertExtractCostAdjustment);
+}
+
 AArch64Subtarget &AArch64Subtarget::initializeSubtargetDependencies(
     StringRef FS, StringRef CPUString, StringRef TuneCPUString) {
   // Determine default and user-specified characteristics


-------------- next part --------------
A non-text attachment was scrubbed...
Name: D124835.426624.patch
Type: text/x-patch
Size: 1653 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20220503/937a1ce1/attachment.bin>


More information about the llvm-commits mailing list