public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/vendors/AWS/heads/Arm64/gcc-7-branch)] AArch64: Add support for --with-tune
@ 2020-12-14 19:50 Sebastian Pop
  0 siblings, 0 replies; only message in thread
From: Sebastian Pop @ 2020-12-14 19:50 UTC (permalink / raw)
  To: gcc-cvs

https://gcc.gnu.org/g:8cf899c2a2a3baa9db0731831db929781e7da6c9

commit 8cf899c2a2a3baa9db0731831db929781e7da6c9
Author: Wilco Dijkstra <wdijkstr@arm.com>
Date:   Thu Dec 3 18:40:34 2020 +0000

    AArch64: Add support for --with-tune
    
    Add support for --with-tune. Like --with-cpu and --with-arch, the argument is
    validated and transformed into a -mtune option to be processed like any other
    command-line option.  --with-tune has no effect if a -mcpu or -mtune option
    is used. The validating code didn't allow --with-cpu=native, so explicitly
    allow that.
    
    Co-authored-by:  Delia Burduv  <delia.burduv@arm.com>
    
    Bootstrap OK, regress pass, OK to commit?
    
    2020-09-03  Wilco Dijkstra  <wdijkstr@arm.com>
    
    gcc/
            * config.gcc (aarch64*-*-*): Add --with-tune. Support --with-cpu=native.
            * config/aarch64/aarch64.h (OPTION_DEFAULT_SPECS): Add --with-tune.
    
    gcc/testsuite/
            * lib/target-supports.exp (check_effective_target_tune_cortex_a76): New
            effective target test.
            * gcc.target/aarch64/with-tune-config.c: New test.
            * gcc.target/aarch64/with-tune-march.c: Likewise.
            * gcc.target/aarch64/with-tune-mcpu.c: Likewise.
            * gcc.target/aarch64/with-tune-mtune.c: Likewise.

Diff:
---
 gcc/config.gcc                                      | 15 +++++++++++++--
 gcc/config/aarch64/aarch64.h                        | 10 ++++++----
 gcc/testsuite/gcc.target/aarch64/with-tune-config.c |  7 +++++++
 gcc/testsuite/gcc.target/aarch64/with-tune-march.c  |  8 ++++++++
 gcc/testsuite/gcc.target/aarch64/with-tune-mcpu.c   |  8 ++++++++
 gcc/testsuite/gcc.target/aarch64/with-tune-mtune.c  |  7 +++++++
 gcc/testsuite/lib/target-supports.exp               |  5 +++++
 7 files changed, 54 insertions(+), 6 deletions(-)

diff --git a/gcc/config.gcc b/gcc/config.gcc
index e37c05491ce..878b10321e3 100644
--- a/gcc/config.gcc
+++ b/gcc/config.gcc
@@ -3656,6 +3656,12 @@ case "${target}" in
 				  sed -e 's/,.*$//'`
 			  fi
 
+			  # Disallow extensions in --with-tune=cortex-a53+crc.
+			  if [ $which = tune ] && [ x"$ext_val" != x ]; then
+			    echo "Architecture extensions not supported in --with-$which=$val" 1>&2
+			    exit 1
+			  fi
+
 			  while [ x"$ext_val" != x ]
 			  do
 				ext_val=`echo $ext_val | sed -e 's/\+//'`
@@ -3705,8 +3711,13 @@ case "${target}" in
 			  fi
 			  true
 			else
-			  echo "Unknown $which used in --with-$which=$val" 1>&2
-			  exit 1
+			  # Allow --with-$which=native.
+			  if [ "$val" = native ]; then
+			    true
+			  else
+			    echo "Unknown $which used in --with-$which=$val" 1>&2
+			    exit 1
+			  fi
 			fi
 		done
 		;;
diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
index c64f28c7091..82c1901467b 100644
--- a/gcc/config/aarch64/aarch64.h
+++ b/gcc/config/aarch64/aarch64.h
@@ -926,12 +926,14 @@ extern enum aarch64_code_model aarch64_cmodel;
 #define ENDIAN_LANE_N(mode, n)  \
   (BYTES_BIG_ENDIAN ? GET_MODE_NUNITS (mode) - 1 - n : n)
 
-/* Support for a configure-time default CPU, etc.  We currently support
-   --with-arch and --with-cpu.  Both are ignored if either is specified
-   explicitly on the command line at run time.  */
+/* Support for configure-time --with-arch, --with-cpu and --with-tune.
+   --with-arch and --with-cpu are ignored if either -mcpu or -march is used.
+   --with-tune is ignored if either -mtune or -mcpu is used (but is not
+   affected by -march).  */
 #define OPTION_DEFAULT_SPECS				\
   {"arch", "%{!march=*:%{!mcpu=*:-march=%(VALUE)}}" },	\
-  {"cpu",  "%{!march=*:%{!mcpu=*:-mcpu=%(VALUE)}}" },
+  {"cpu",  "%{!march=*:%{!mcpu=*:-mcpu=%(VALUE)}}" },   \
+  {"tune", "%{!mcpu=*:%{!mtune=*:-mtune=%(VALUE)}}"},
 
 #define MCPU_TO_MARCH_SPEC \
    " %{mcpu=*:-march=%:rewrite_mcpu(%{mcpu=*:%*})}"
diff --git a/gcc/testsuite/gcc.target/aarch64/with-tune-config.c b/gcc/testsuite/gcc.target/aarch64/with-tune-config.c
new file mode 100644
index 00000000000..0940e9eea89
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/with-tune-config.c
@@ -0,0 +1,7 @@
+/* { dg-do compile { target { tune_cortex_a76 } } } */
+/* { dg-additional-options " -dA " } */
+
+void foo ()
+{}
+
+/* { dg-final { scan-assembler "//.tune cortex-a76" } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/with-tune-march.c b/gcc/testsuite/gcc.target/aarch64/with-tune-march.c
new file mode 100644
index 00000000000..61039adea71
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/with-tune-march.c
@@ -0,0 +1,8 @@
+/* { dg-do compile { target { tune_cortex_a76 } } } */
+/* { dg-additional-options " -dA -march=armv8.6-a " } */
+
+void foo ()
+{}
+
+/* { dg-final { scan-assembler "//.tune cortex-a76" } } */
+/* { dg-final { scan-assembler ".arch armv8.6-a" } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/with-tune-mcpu.c b/gcc/testsuite/gcc.target/aarch64/with-tune-mcpu.c
new file mode 100644
index 00000000000..4f8267a5c16
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/with-tune-mcpu.c
@@ -0,0 +1,8 @@
+/* { dg-do compile { target { tune_cortex_a76 } } } */
+/* { dg-additional-options " -dA -mcpu=cortex-a73" } */
+
+void foo ()
+{}
+
+/* { dg-final { scan-assembler "//.tune cortex-a73" } } */
+/* { dg-final { scan-assembler ".arch armv8-a" } } */
diff --git a/gcc/testsuite/gcc.target/aarch64/with-tune-mtune.c b/gcc/testsuite/gcc.target/aarch64/with-tune-mtune.c
new file mode 100644
index 00000000000..60f795a3919
--- /dev/null
+++ b/gcc/testsuite/gcc.target/aarch64/with-tune-mtune.c
@@ -0,0 +1,7 @@
+/* { dg-do compile { target { tune_cortex_a76 } } } */
+/* { dg-additional-options " -dA -mtune=cortex-a73" } */
+
+void foo ()
+{}
+
+/* { dg-final { scan-assembler "//.tune cortex-a73" } } */
diff --git a/gcc/testsuite/lib/target-supports.exp b/gcc/testsuite/lib/target-supports.exp
index d33136f7aa4..0fa54f01ba4 100644
--- a/gcc/testsuite/lib/target-supports.exp
+++ b/gcc/testsuite/lib/target-supports.exp
@@ -8445,3 +8445,8 @@ proc check_effective_target_arm_coproc4_ok { } {
     return [check_cached_effective_target arm_coproc4_ok \
 		check_effective_target_arm_coproc4_ok_nocache]
 }
+
+# Return 1 if GCC was configured with --with-tune=cortex-a76
+proc check_effective_target_tune_cortex_a76 { } {
+    return [check_configured_with "with-tune=cortex-a76"]
+}


^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2020-12-14 19:50 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-12-14 19:50 [gcc(refs/vendors/AWS/heads/Arm64/gcc-7-branch)] AArch64: Add support for --with-tune Sebastian Pop

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).