diff mbox series

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

Message ID 12f28b57-c526-c85e-5c9b-05fa5724cf17@suse.cz
State New
Headers show
Series Add "native" as a valid option value for -march= on arm (PR driver/83193). | expand

Commit Message

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

This is equivalent patch for ARM target.

Ready for trunk?
Thanks,
Martin

Comments

Kyrill Tkachov Feb. 21, 2018, 9:23 a.m. UTC | #1
Hi Martin,

On 21/02/18 07:34, Martin Liška wrote:
> Hi.
>
> This is equivalent patch for ARM target.

Thanks for fixing this!

> Ready for trunk?

Have you tested this with a native and a cross-compiler like the aarch64 version?

> Thanks,
> Martin

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

gcc/ChangeLog:

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

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

diff --git a/gcc/common/config/arm/arm-common.c b/gcc/common/config/arm/arm-common.c
index fc585e0b0ee..50f0bad3e36 100644
--- a/gcc/common/config/arm/arm-common.c
+++ b/gcc/common/config/arm/arm-common.c
@@ -353,6 +353,12 @@ arm_print_hint_for_arch_option (const char *target,
    auto_vec<const char*> candidates;
    for (; list->common.name != NULL; list++)
      candidates.safe_push (list->common.name);
+
+#ifdef HAVE_LOCAL_CPU_DETECT
+  /* Add also "native" as possible value.  */
+  candidates.safe_push ("native");
+#endif
+


On arm we also support "native" as a value for -mcpu and -mtune. These are both handled by
the arm_print_hint_for_cpu_option function in the same file. Can you please add this snippet
to them as well?

Thanks,
Kyrill
Martin Liška Feb. 21, 2018, 9:53 a.m. UTC | #2
On 02/21/2018 10:23 AM, Kyrill Tkachov wrote:
> Have you tested this with a native and a cross-compiler like the aarch64 version?

No, I don't have a machine. Can you please do that?

Thanks,
Martin
Kyrill Tkachov Feb. 21, 2018, 12:26 p.m. UTC | #3
On 21/02/18 09:53, Martin Liška wrote:
> On 02/21/2018 10:23 AM, Kyrill Tkachov wrote:
>> Have you tested this with a native and a cross-compiler like the aarch64 version?
> No, I don't have a machine. Can you please do that?

Sure, I've bootstrapped and tested it on arm-none-linux-gnueabihf
and an arm-none-eabi cross-compiler. Confirmed that "native" comes up
as a suggestion for a native compiler and not for a cross-compiler.
So the approach looks good. Please address the comment in my previous reply
and this will be ok for trunk.

Thanks,
Kyrill

> Thanks,
> Martin
Martin Liška Feb. 21, 2018, 2:03 p.m. UTC | #4
On 02/21/2018 10:23 AM, Kyrill Tkachov wrote:
> Have you tested this with a native and a cross-compiler like the aarch64 version?

Yes, you tested that ;) I'm going to install the patch.

Martin
Martin Liška Feb. 22, 2018, 8:51 a.m. UTC | #5
On 02/21/2018 10:23 AM, Kyrill Tkachov wrote:
> 
> On arm we also support "native" as a value for -mcpu and -mtune. These are both handled by
> the arm_print_hint_for_cpu_option function in the same file. Can you please add this snippet
> to them as well?

Hi.

Can you please test for me attached follow up patch?
Thanks,
Martin
From 3a40e8a873461f9f06a18539cfb7c366dd6efafb Mon Sep 17 00:00:00 2001
From: marxin <mliska@suse.cz>
Date: Wed, 21 Feb 2018 15:38:32 +0100
Subject: [PATCH] Add "native" as a valid option value for -mcpu/-mtune= on arm
 (PR driver/83193).

gcc/ChangeLog:

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

	PR driver/83193
	* common/config/arm/arm-common.c (arm_print_hint_for_cpu_option):
	Add "native" as a possible value.
---
 gcc/common/config/arm/arm-common.c | 6 ++++++
 1 file changed, 6 insertions(+)

diff --git a/gcc/common/config/arm/arm-common.c b/gcc/common/config/arm/arm-common.c
index 50f0bad3e36..a404d4b1562 100644
--- a/gcc/common/config/arm/arm-common.c
+++ b/gcc/common/config/arm/arm-common.c
@@ -309,6 +309,12 @@ arm_print_hint_for_cpu_option (const char *target,
   auto_vec<const char*> candidates;
   for (; list->common.name != NULL; list++)
     candidates.safe_push (list->common.name);
+
+#ifdef HAVE_LOCAL_CPU_DETECT
+  /* Add also "native" as possible value.  */
+  candidates.safe_push ("native");
+#endif
+
   char *s;
   const char *hint = candidates_list_and_hint (target, s, candidates);
   if (hint)
Kyrill Tkachov Feb. 22, 2018, 10:59 a.m. UTC | #6
Hi Martin,

On 22/02/18 08:51, Martin Liška wrote:
> On 02/21/2018 10:23 AM, Kyrill Tkachov wrote:
>> On arm we also support "native" as a value for -mcpu and -mtune. These are both handled by
>> the arm_print_hint_for_cpu_option function in the same file. Can you please add this snippet
>> to them as well?
> Hi.
>
> Can you please test for me attached follow up patch?

I've bootstrapped and tested this patch on a native and a cross compiler and confirmed
the help string for -mcpu behaves as intended.

This patch is ok for trunk.
Thanks,
Kyrill

> Thanks,
> Martin
Martin Liška Feb. 22, 2018, 12:15 p.m. UTC | #7
On 02/22/2018 11:59 AM, Kyrill Tkachov wrote:
> Hi Martin,
> 
> On 22/02/18 08:51, Martin Liška wrote:
>> On 02/21/2018 10:23 AM, Kyrill Tkachov wrote:
>>> On arm we also support "native" as a value for -mcpu and -mtune. These are both handled by
>>> the arm_print_hint_for_cpu_option function in the same file. Can you please add this snippet
>>> to them as well?
>> Hi.
>>
>> Can you please test for me attached follow up patch?
> 
> I've bootstrapped and tested this patch on a native and a cross compiler and confirmed
> the help string for -mcpu behaves as intended.
> 
> This patch is ok for trunk.
> Thanks,
> Kyrill

Thanks for review. May I please ask you for taking look at:
2b) point in:
https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83193#c6

We should fix it (if possible) for GCC 8 as it's regression.

Thanks,
Martin

> 
>> Thanks,
>> Martin
>
Martin Liška March 8, 2018, 9:02 a.m. UTC | #8
PING^1

On 02/22/2018 01:15 PM, Martin Liška wrote:
> On 02/22/2018 11:59 AM, Kyrill Tkachov wrote:
>> Hi Martin,
>>
>> On 22/02/18 08:51, Martin Liška wrote:
>>> On 02/21/2018 10:23 AM, Kyrill Tkachov wrote:
>>>> On arm we also support "native" as a value for -mcpu and -mtune. These are both handled by
>>>> the arm_print_hint_for_cpu_option function in the same file. Can you please add this snippet
>>>> to them as well?
>>> Hi.
>>>
>>> Can you please test for me attached follow up patch?
>>
>> I've bootstrapped and tested this patch on a native and a cross compiler and confirmed
>> the help string for -mcpu behaves as intended.
>>
>> This patch is ok for trunk.
>> Thanks,
>> Kyrill
> 
> Thanks for review. May I please ask you for taking look at:
> 2b) point in:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83193#c6
> 
> We should fix it (if possible) for GCC 8 as it's regression.
> 
> Thanks,
> Martin
> 
>>
>>> Thanks,
>>> Martin
>>
>
Kyrill Tkachov March 9, 2018, 3:43 p.m. UTC | #9
On 22/02/18 12:15, Martin Liška wrote:
> On 02/22/2018 11:59 AM, Kyrill Tkachov wrote:
>> Hi Martin,
>>
>> On 22/02/18 08:51, Martin Liška wrote:
>>> On 02/21/2018 10:23 AM, Kyrill Tkachov wrote:
>>>> On arm we also support "native" as a value for -mcpu and -mtune. These are both handled by
>>>> the arm_print_hint_for_cpu_option function in the same file. Can you please add this snippet
>>>> to them as well?
>>> Hi.
>>>
>>> Can you please test for me attached follow up patch?
>> I've bootstrapped and tested this patch on a native and a cross compiler and confirmed
>> the help string for -mcpu behaves as intended.
>>
>> This patch is ok for trunk.
>> Thanks,
>> Kyrill
> Thanks for review. May I please ask you for taking look at:
> 2b) point in:
> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83193#c6
>
> We should fix it (if possible) for GCC 8 as it's regression.

Thanks for the reminders Martin.
I've committed a patch to fix it with r258389.

Kyrill

> Thanks,
> Martin
>
>>> Thanks,
>>> Martin
Martin Liška March 9, 2018, 3:45 p.m. UTC | #10
On 03/09/2018 04:43 PM, Kyrill Tkachov wrote:
> 
> On 22/02/18 12:15, Martin Liška wrote:
>> On 02/22/2018 11:59 AM, Kyrill Tkachov wrote:
>>> Hi Martin,
>>>
>>> On 22/02/18 08:51, Martin Liška wrote:
>>>> On 02/21/2018 10:23 AM, Kyrill Tkachov wrote:
>>>>> On arm we also support "native" as a value for -mcpu and -mtune. These are both handled by
>>>>> the arm_print_hint_for_cpu_option function in the same file. Can you please add this snippet
>>>>> to them as well?
>>>> Hi.
>>>>
>>>> Can you please test for me attached follow up patch?
>>> I've bootstrapped and tested this patch on a native and a cross compiler and confirmed
>>> the help string for -mcpu behaves as intended.
>>>
>>> This patch is ok for trunk.
>>> Thanks,
>>> Kyrill
>> Thanks for review. May I please ask you for taking look at:
>> 2b) point in:
>> https://gcc.gnu.org/bugzilla/show_bug.cgi?id=83193#c6
>>
>> We should fix it (if possible) for GCC 8 as it's regression.
> 
> Thanks for the reminders Martin.
> I've committed a patch to fix it with r258389.

I thank you for taking care of the ARM-specific issue. Let me adjust milestone
of the PR to 9. The rest of issue seen can't be fixed now.

Martin

> 
> Kyrill
> 
>> Thanks,
>> Martin
>>
>>>> Thanks,
>>>> Martin
>
diff mbox series

Patch

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

gcc/ChangeLog:

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

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

diff --git a/gcc/common/config/arm/arm-common.c b/gcc/common/config/arm/arm-common.c
index fc585e0b0ee..50f0bad3e36 100644
--- a/gcc/common/config/arm/arm-common.c
+++ b/gcc/common/config/arm/arm-common.c
@@ -353,6 +353,12 @@  arm_print_hint_for_arch_option (const char *target,
   auto_vec<const char*> candidates;
   for (; list->common.name != NULL; list++)
     candidates.safe_push (list->common.name);
+
+#ifdef HAVE_LOCAL_CPU_DETECT
+  /* Add also "native" as possible value.  */
+  candidates.safe_push ("native");
+#endif
+
   char *s;
   const char *hint = candidates_list_and_hint (target, s, candidates);
   if (hint)
diff --git a/gcc/config/arm/arm.h b/gcc/config/arm/arm.h
index 6f3c4f461b9..bbf3937a592 100644
--- a/gcc/config/arm/arm.h
+++ b/gcc/config/arm/arm.h
@@ -2194,6 +2194,7 @@  extern const char *arm_target_thumb_only (int argc, const char **argv);
    an ARM chip.  */
 #if defined(__arm__)
 extern const char *host_detect_local_cpu (int argc, const char **argv);
+#define HAVE_LOCAL_CPU_DETECT
 # define MCPU_MTUNE_NATIVE_FUNCTIONS			\
   { "local_cpu_detect", host_detect_local_cpu },
 # define MCPU_MTUNE_NATIVE_SPECS				\
-- 
2.16.1