Add "native" as a valid option value for -march= on aarch64 (PR driver/83193).

Message ID 9c871dac-001a-cc0c-4da1-cfc1770008dc@suse.cz
State New
Headers show
Series
  • Add "native" as a valid option value for -march= on aarch64 (PR driver/83193).
Related show

Commit Message

Martin Liška Feb. 21, 2018, 7:35 a.m.
Hi.

This is equivalent patch for aarch64 target. I've tested that both as cross
compiler and native one.

Ready for trunk?
Thanks,
Martin

Patch

From 4fbe17099f8618ddd6a4de2d269ecb6f99625927 Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Tue, 20 Feb 2018 14:14:25 +0100
Subject: [PATCH 2/3] Add "native" as a valid option value for -march= on
 aarch64 (PR driver/83193).

gcc/ChangeLog:

2018-02-20  Martin Liska  <mliska@suse.cz>

	PR driver/83193
	* config/aarch64/aarch64.c (aarch64_print_hint_for_core_or_arch):
	Add "native" as a possible value.
	* config/aarch64/aarch64.h (HAVE_LOCAL_CPU_DETECT):  Define
	the macro when native cpu detection is available.
---
 gcc/config/aarch64/aarch64.c | 7 +++++++
 gcc/config/aarch64/aarch64.h | 1 +
 2 files changed, 8 insertions(+)

diff --git a/gcc/config/aarch64/aarch64.c b/gcc/config/aarch64/aarch64.c
index e1fb87f047f..33c90ef02dc 100644
--- a/gcc/config/aarch64/aarch64.c
+++ b/gcc/config/aarch64/aarch64.c
@@ -10628,6 +10628,13 @@  aarch64_print_hint_for_core_or_arch (const char *str, bool arch)
   const struct processor *entry = arch ? all_architectures : all_cores;
   for (; entry->name != NULL; entry++)
     candidates.safe_push (entry->name);
+
+#ifdef HAVE_LOCAL_CPU_DETECT
+  /* Add also "native" as possible value.  */
+  if (arch)
+    candidates.safe_push ("native");
+#endif
+
   char *s;
   const char *hint = candidates_list_and_hint (str, s, candidates);
   if (hint)
diff --git a/gcc/config/aarch64/aarch64.h b/gcc/config/aarch64/aarch64.h
index e3c52f63683..976f9afae54 100644
--- a/gcc/config/aarch64/aarch64.h
+++ b/gcc/config/aarch64/aarch64.h
@@ -1002,6 +1002,7 @@  extern const char *aarch64_rewrite_mcpu (int argc, const char **argv);
 
 #if defined(__aarch64__)
 extern const char *host_detect_local_cpu (int argc, const char **argv);
+#define HAVE_LOCAL_CPU_DETECT
 # define EXTRA_SPEC_FUNCTIONS						\
   { "local_cpu_detect", host_detect_local_cpu },			\
   MCPU_TO_MARCH_SPEC_FUNCTIONS
-- 
2.16.1