Blame SOURCES/gcc8-aarch64-mtune-neoverse-512tvb.patch

c89b6d
From 9c108bb84d3a2447dac730c455df658be0a2c751 Mon Sep 17 00:00:00 2001
c89b6d
From: Richard Sandiford <richard.sandiford@arm.com>
c89b6d
Date: Tue, 17 Aug 2021 15:15:27 +0100
c89b6d
Subject: [PATCH] aarch64: Add -mtune=neoverse-512tvb
c89b6d
To: gcc-patches@gcc.gnu.org
c89b6d
c89b6d
This patch adds an option to tune for Neoverse cores that have
c89b6d
a total vector bandwidth of 512 bits (4x128 for Advanced SIMD
c89b6d
and a vector-length-dependent equivalent for SVE).  This is intended
c89b6d
to be a compromise between tuning aggressively for a single core like
c89b6d
Neoverse V1 (which can be too narrow) and tuning for AArch64 cores
c89b6d
in general (which can be too wide).
c89b6d
c89b6d
-mcpu=neoverse-512tvb is equivalent to -mcpu=neoverse-v1
c89b6d
-mtune=neoverse-512tvb.
c89b6d
c89b6d
gcc/
c89b6d
	* doc/invoke.texi: Document -mtune=neoverse-512tvb and
c89b6d
	-mcpu=neoverse-512tvb.
c89b6d
	* config/aarch64/aarch64-cores.def (neoverse-512tvb): New entry.
c89b6d
	* config/aarch64/aarch64-tune.md: Regenerate.
c89b6d
c89b6d
(cherry picked from commit 048039c49b96875144f67e7789fdea54abf7710b)
c89b6d
---
c89b6d
 gcc/config/aarch64/aarch64-cores.def |  1 +
c89b6d
 gcc/config/aarch64/aarch64-tune.md   |  2 +-
c89b6d
 gcc/doc/invoke.texi                  | 25 ++++++++++++++++++++++---
c89b6d
 3 files changed, 24 insertions(+), 4 deletions(-)
c89b6d
c89b6d
diff --git a/gcc/config/aarch64/aarch64-cores.def b/gcc/config/aarch64/aarch64-cores.def
c89b6d
index dfb839c01cc..f348d31e22e 100644
c89b6d
--- a/gcc/config/aarch64/aarch64-cores.def
c89b6d
+++ b/gcc/config/aarch64/aarch64-cores.def
c89b6d
@@ -99,6 +99,7 @@ AARCH64_CORE("saphira",     saphira,    falkor,    8_3A,  AARCH64_FL_FOR_ARCH8_3
c89b6d
 /* ARM ('A') cores. */
c89b6d
 AARCH64_CORE("zeus", zeus, cortexa57, 8_4A,  AARCH64_FL_FOR_ARCH8_4 | AARCH64_FL_F16 | AARCH64_FL_RCPC | AARCH64_FL_SVE | AARCH64_FL_RNG, neoversev1, 0x41, 0xd40, -1)
c89b6d
 AARCH64_CORE("neoverse-v1", neoversev1, cortexa57, 8_4A,  AARCH64_FL_FOR_ARCH8_4 | AARCH64_FL_F16 | AARCH64_FL_RCPC | AARCH64_FL_SVE | AARCH64_FL_RNG, neoversev1, 0x41, 0xd40, -1)
c89b6d
+AARCH64_CORE("neoverse-512tvb", neoverse512tvb, cortexa57, 8_4A,  AARCH64_FL_FOR_ARCH8_4 | AARCH64_FL_F16 | AARCH64_FL_RCPC | AARCH64_FL_SVE | AARCH64_FL_RNG, neoversev1, INVALID_IMP, INVALID_CORE, -1)
c89b6d
 
c89b6d
 /* Armv8.5-A Architecture Processors.  */
c89b6d
 AARCH64_CORE("neoverse-n2", neoversen2, cortexa57, 8_4A,  AARCH64_FL_FOR_ARCH8_4 | AARCH64_FL_F16 | AARCH64_FL_SVE | AARCH64_FL_RNG, neoversen2, 0x41, 0xd49, -1)
c89b6d
diff --git a/gcc/config/aarch64/aarch64-tune.md b/gcc/config/aarch64/aarch64-tune.md
c89b6d
index 2d7c9aa4740..09b76480f0b 100644
c89b6d
--- a/gcc/config/aarch64/aarch64-tune.md
c89b6d
+++ b/gcc/config/aarch64/aarch64-tune.md
c89b6d
@@ -1,5 +1,5 @@
c89b6d
 ;; -*- buffer-read-only: t -*-
c89b6d
 ;; Generated automatically by gentune.sh from aarch64-cores.def
c89b6d
 (define_attr "tune"
c89b6d
-	"cortexa35,cortexa53,cortexa57,cortexa72,cortexa73,thunderx,thunderxt88p1,thunderxt88,thunderxt81,thunderxt83,xgene1,falkor,qdf24xx,exynosm1,thunderx2t99p1,vulcan,thunderx2t99,cortexa55,cortexa75,cortexa76,ares,neoversen1,saphira,zeus,neoversev1,neoversen2,cortexa57cortexa53,cortexa72cortexa53,cortexa73cortexa35,cortexa73cortexa53,cortexa75cortexa55"
c89b6d
+	"cortexa35,cortexa53,cortexa57,cortexa72,cortexa73,thunderx,thunderxt88p1,thunderxt88,thunderxt81,thunderxt83,xgene1,falkor,qdf24xx,exynosm1,thunderx2t99p1,vulcan,thunderx2t99,cortexa55,cortexa75,cortexa76,ares,neoversen1,saphira,zeus,neoversev1,neoverse512tvb,neoversen2,cortexa57cortexa53,cortexa72cortexa53,cortexa73cortexa35,cortexa73cortexa53,cortexa75cortexa55"
c89b6d
 	(const (symbol_ref "((enum attr_tune) aarch64_tune)")))
c89b6d
diff --git a/gcc/doc/invoke.texi b/gcc/doc/invoke.texi
c89b6d
index 78ca7738df2..68fda03281a 100644
c89b6d
--- a/gcc/doc/invoke.texi
c89b6d
+++ b/gcc/doc/invoke.texi
c89b6d
@@ -14772,9 +14772,9 @@ performance of the code.  Permissible values for this option are:
c89b6d
 @samp{generic}, @samp{cortex-a35}, @samp{cortex-a53}, @samp{cortex-a55},
c89b6d
 @samp{cortex-a57}, @samp{cortex-a72}, @samp{cortex-a73}, @samp{cortex-a75},
c89b6d
 @samp{cortex-a76}, @samp{ares}, @samp{neoverse-n1}, @samp{neoverse-n2},
c89b6d
-@samp{neoverse-v1}, @samp{zeus}, @samp{exynos-m1}, @samp{falkor},
c89b6d
-@samp{qdf24xx}, @samp{saphira}, @samp{xgene1}, @samp{vulcan}, @samp{thunderx},
c89b6d
-@samp{thunderxt88}, @samp{thunderxt88p1}, @samp{thunderxt81},
c89b6d
+@samp{neoverse-v1}, @samp{zeus}, @samp{neoverse-512tvb}, @samp{exynos-m1},
c89b6d
+@samp{falkor}, @samp{qdf24xx}, @samp{saphira}, @samp{xgene1}, @samp{vulcan},
c89b6d
+@samp{thunderx}, @samp{thunderxt88}, @samp{thunderxt88p1}, @samp{thunderxt81},
c89b6d
 @samp{thunderxt83}, @samp{thunderx2t99}, @samp{cortex-a57.cortex-a53},
c89b6d
 @samp{cortex-a72.cortex-a53}, @samp{cortex-a73.cortex-a35},
c89b6d
 @samp{cortex-a73.cortex-a53}, @samp{cortex-a75.cortex-a55},
c89b6d
@@ -14785,6 +14785,15 @@ The values @samp{cortex-a57.cortex-a53}, @samp{cortex-a72.cortex-a53},
c89b6d
 @samp{cortex-a75.cortex-a55} specify that GCC should tune for a
c89b6d
 big.LITTLE system.
c89b6d
 
c89b6d
+The value @samp{neoverse-512tvb} specifies that GCC should tune
c89b6d
+for Neoverse cores that (a) implement SVE and (b) have a total vector
c89b6d
+bandwidth of 512 bits per cycle.  In other words, the option tells GCC to
c89b6d
+tune for Neoverse cores that can execute 4 128-bit Advanced SIMD arithmetic
c89b6d
+instructions a cycle and that can execute an equivalent number of SVE
c89b6d
+arithmetic instructions per cycle (2 for 256-bit SVE, 4 for 128-bit SVE).
c89b6d
+This is more general than tuning for a specific core like Neoverse V1
c89b6d
+but is more specific than the default tuning described below.
c89b6d
+
c89b6d
 Additionally on native AArch64 GNU/Linux systems the value
c89b6d
 @samp{native} tunes performance to the host system.  This option has no effect
c89b6d
 if the compiler is unable to recognize the processor of the host system.
c89b6d
@@ -14814,6 +14823,16 @@ by @option{-mtune}).  Where this option is used in conjunction
c89b6d
 with @option{-march} or @option{-mtune}, those options take precedence
c89b6d
 over the appropriate part of this option.
c89b6d
 
c89b6d
+@option{-mcpu=neoverse-512tvb} is special in that it does not refer
c89b6d
+to a specific core, but instead refers to all Neoverse cores that
c89b6d
+(a) implement SVE and (b) have a total vector bandwidth of 512 bits
c89b6d
+a cycle.  Unless overridden by @option{-march},
c89b6d
+@option{-mcpu=neoverse-512tvb} generates code that can run on a
c89b6d
+Neoverse V1 core, since Neoverse V1 is the first Neoverse core with
c89b6d
+these properties.  Unless overridden by @option{-mtune},
c89b6d
+@option{-mcpu=neoverse-512tvb} tunes code in the same way as for
c89b6d
+@option{-mtune=neoverse-512tvb}.
c89b6d
+
c89b6d
 @item -moverride=@var{string}
c89b6d
 @opindex moverride
c89b6d
 Override tuning decisions made by the back-end in response to a
c89b6d
-- 
c89b6d
2.25.1
c89b6d