aboutsummaryrefslogtreecommitdiff
path: root/gcc
diff options
context:
space:
mode:
authorKyrylo Tkachov <kyrylo.tkachov@arm.com>2018-12-07 17:05:21 +0000
committerKyrylo Tkachov <ktkachov@gcc.gnu.org>2018-12-07 17:05:21 +0000
commit886f092f59d8a903fb5b99e757df5e4523dae825 (patch)
treef915a21954bebd42a5981532532d5398d1a2354a /gcc
parentc844c4028f5e8e1370f889db18042caeb83518fc (diff)
downloadgcc-886f092f59d8a903fb5b99e757df5e4523dae825.zip
gcc-886f092f59d8a903fb5b99e757df5e4523dae825.tar.gz
gcc-886f092f59d8a903fb5b99e757df5e4523dae825.tar.bz2
[AArch64][2/2] Add sve_width -moverride tunable
On top of the previous patch that implements TARGET_ESTIMATED_POLY_VALUE and adds an sve_width tuning field to the CPU structs, this patch implements an -moverride knob to adjust this sve_width field to allow for experimentation. Again, reminder that this only has an effect when compiling for VLA-SVE that is, without msve-vector-bits=<foo>. This just adjusts tuning heuristics in the compiler,, like profitability thresholds for vectorised versioned loops, and others. It can be used, for example like -moverride=sve_width=256 to set the sve_width tuning field to 256. Widths outside of the accepted SVE widths [128 - 2048] are rejected as you'd expect. * config/aarch64/aarch64.c (aarch64_tuning_override_functions): Add sve_width entry. (aarch64_parse_sve_width_string): Define. * gcc.target/aarch64/sve/override_sve_width_1.c: New test. From-SVN: r266898
Diffstat (limited to 'gcc')
-rw-r--r--gcc/ChangeLog6
-rw-r--r--gcc/config/aarch64/aarch64.c33
-rw-r--r--gcc/testsuite/ChangeLog4
-rw-r--r--gcc/testsuite/gcc.target/aarch64/sve/override_sve_width_1.c9
4 files changed, 52 insertions, 0 deletions
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 9ee432d..41fb2da 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,9 @@
+2018-12-07 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ * config/aarch64/aarch64.c (aarch64_tuning_override_functions): Add
+ sve_width entry.
+ (aarch64_parse_sve_width_string): Define.
+
2018-12-07 Jeff Law <law@redhat.com>
PR middle-end/87813
diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index ba9b5ad..ea7e79f 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -1086,12 +1086,14 @@ struct aarch64_tuning_override_function
static void aarch64_parse_fuse_string (const char*, struct tune_params*);
static void aarch64_parse_tune_string (const char*, struct tune_params*);
+static void aarch64_parse_sve_width_string (const char*, struct tune_params*);
static const struct aarch64_tuning_override_function
aarch64_tuning_override_functions[] =
{
{ "fuse", aarch64_parse_fuse_string },
{ "tune", aarch64_parse_tune_string },
+ { "sve_width", aarch64_parse_sve_width_string },
{ NULL, NULL }
};
@@ -10834,6 +10836,37 @@ aarch64_parse_tune_string (const char *tune_string,
"tune=");
}
+/* Parse the sve_width tuning moverride string in TUNE_STRING.
+ Accept the valid SVE vector widths allowed by
+ aarch64_sve_vector_bits_enum and use it to override sve_width
+ in TUNE. */
+
+static void
+aarch64_parse_sve_width_string (const char *tune_string,
+ struct tune_params *tune)
+{
+ int width = -1;
+
+ int n = sscanf (tune_string, "%d", &width);
+ if (n == EOF)
+ {
+ error ("invalid format for sve_width");
+ return;
+ }
+ switch (width)
+ {
+ case SVE_128:
+ case SVE_256:
+ case SVE_512:
+ case SVE_1024:
+ case SVE_2048:
+ break;
+ default:
+ error ("invalid sve_width value: %d", width);
+ }
+ tune->sve_width = (enum aarch64_sve_vector_bits_enum) width;
+}
+
/* Parse TOKEN, which has length LENGTH to see if it is a tuning option
we understand. If it is, extract the option string and handoff to
the appropriate function. */
diff --git a/gcc/testsuite/ChangeLog b/gcc/testsuite/ChangeLog
index 8f63e81..698a744 100644
--- a/gcc/testsuite/ChangeLog
+++ b/gcc/testsuite/ChangeLog
@@ -1,3 +1,7 @@
+2018-12-07 Kyrylo Tkachov <kyrylo.tkachov@arm.com>
+
+ * gcc.target/aarch64/sve/override_sve_width_1.c: New test.
+
2018-12-07 Jeff Law <law@redhat.com>
PR middle-end/87813
diff --git a/gcc/testsuite/gcc.target/aarch64/sve/override_sve_width_1.c b/gcc/testsuite/gcc.target/aarch64/sve/override_sve_width_1.c
new file mode 100644
index 0000000..3752fdc
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/sve/override_sve_width_1.c
@@ -0,0 +1,9 @@
+/* { dg-do compile } */
+/* { dg-options "-O3 -moverride=sve_width=512" } */
+
+void __attribute__((noinline, noclone))
+vadd (int *dst, int *op1, int *op2, int count)
+{
+ for (int i = 0; i < count; ++i)
+ dst[i] = op1[i] + op2[i];
+}