[llvm] [AArch64] Enable software pipelining for the Cortex-A320 (PR #206072)
William Huynh via llvm-commits
llvm-commits at lists.llvm.org
Fri Jun 26 07:06:11 PDT 2026
https://github.com/saturn691 created https://github.com/llvm/llvm-project/pull/206072
Software pipelining gives mostly positive performance improvements for the Cortex-A320. This enables MachinePipeliner for default for the Cortex-A320 and keeps the behaviour of -aarch64-enable-pipeliner for other CPUs.
>From 81b7f4252cbdbefc2a8a598407f85d4a5058d6ab Mon Sep 17 00:00:00 2001
From: William Huynh <William.Huynh at arm.com>
Date: Fri, 26 Jun 2026 14:55:42 +0100
Subject: [PATCH] [AArch64] Enable software pipelining for the Cortex-A320
Software pipelining gives mostly positive performance improvements
for the Cortex-A320. This enables MachinePipeliner for default for
the Cortex-A320 and keeps the behaviour of -aarch64-enable-pipeliner
for other CPUs.
---
llvm/lib/Target/AArch64/AArch64Features.td | 4 ++++
llvm/lib/Target/AArch64/AArch64Processors.td | 1 +
llvm/lib/Target/AArch64/AArch64Subtarget.cpp | 8 +++++++-
llvm/lib/Target/AArch64/AArch64TargetMachine.cpp | 5 -----
4 files changed, 12 insertions(+), 6 deletions(-)
diff --git a/llvm/lib/Target/AArch64/AArch64Features.td b/llvm/lib/Target/AArch64/AArch64Features.td
index c351a92f2f673..35247e6b8825f 100644
--- a/llvm/lib/Target/AArch64/AArch64Features.td
+++ b/llvm/lib/Target/AArch64/AArch64Features.td
@@ -839,6 +839,10 @@ def FeatureNoNegativeImmediates : SubtargetFeature<"no-neg-immediates",
"equivalent when the immediate does "
"not fit in the encoding.">;
+// Use the MachinePipeliner for instruction scheduling for the subtarget.
+def FeatureUseMIPipeliner: SubtargetFeature<"use-mipipeliner", "UseMIPipeliner", "true",
+ "Use the MachinePipeliner">;
+
// Address operands with shift amount 2 or 3 are fast on all Arm chips except
// some old Apple cores (A7-A10?) which handle all shifts slowly. Cortex-A57
// and derived designs through Cortex-X1 take an extra micro-op for shifts
diff --git a/llvm/lib/Target/AArch64/AArch64Processors.td b/llvm/lib/Target/AArch64/AArch64Processors.td
index dfa2bd46c8e56..e19bafb55aaff 100644
--- a/llvm/lib/Target/AArch64/AArch64Processors.td
+++ b/llvm/lib/Target/AArch64/AArch64Processors.td
@@ -22,6 +22,7 @@ def TuneA320 : SubtargetFeature<"a320", "ARMProcFamily", "CortexA320",
FeatureFuseAES,
FeatureFuseAdrpAdd,
FeaturePostRAScheduler,
+ FeatureUseMIPipeliner,
FeatureUseWzrToVecMove,
FeatureUseFixedOverScalableIfEqualCost,
FeatureAggressiveInterleaving]>;
diff --git a/llvm/lib/Target/AArch64/AArch64Subtarget.cpp b/llvm/lib/Target/AArch64/AArch64Subtarget.cpp
index f4b0af0333f4e..48760bd72c975 100644
--- a/llvm/lib/Target/AArch64/AArch64Subtarget.cpp
+++ b/llvm/lib/Target/AArch64/AArch64Subtarget.cpp
@@ -97,6 +97,11 @@ static cl::opt<bool>
cl::init(false), cl::Hidden,
cl::desc("Enable subreg liveness tracking"));
+static cl::opt<bool>
+ EnableMachinePipeliner("aarch64-enable-pipeliner",
+ cl::desc("Enable Machine Pipeliner for AArch64"),
+ cl::init(false), cl::Hidden);
+
static cl::opt<bool>
UseScalarIncVL("sve-use-scalar-inc-vl", cl::init(false), cl::Hidden,
cl::desc("Prefer add+cnt over addvl/inc/dec"));
@@ -648,5 +653,6 @@ bool AArch64Subtarget::isX16X17Safer() const {
}
bool AArch64Subtarget::enableMachinePipeliner() const {
- return getSchedModel().hasInstrSchedModel();
+ return getSchedModel().hasInstrSchedModel() &&
+ (UseMIPipeliner || EnableMachinePipeliner);
}
diff --git a/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp b/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
index 898d92e74c85c..0235f62bd6077 100644
--- a/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
+++ b/llvm/lib/Target/AArch64/AArch64TargetMachine.cpp
@@ -218,11 +218,6 @@ static cl::opt<bool>
cl::desc("Enable sinking and folding of instruction copies"),
cl::init(true), cl::Hidden);
-static cl::opt<bool>
- EnableMachinePipeliner("aarch64-enable-pipeliner",
- cl::desc("Enable Machine Pipeliner for AArch64"),
- cl::init(false), cl::Hidden);
-
static cl::opt<bool> EnableSRLTSubregToRegMitigation(
"aarch64-srlt-mitigate-sr2r",
cl::desc("Enable SUBREG_TO_REG mitigation by adding 'implicit-def' for "
More information about the llvm-commits
mailing list