This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: [PATCH] Fix option values for -march.
- From: Uros Bizjak <ubizjak at gmail dot com>
- To: Martin Liska <mliska at suse dot cz>
- Cc: "gcc-patches at gcc dot gnu dot org" <gcc-patches at gcc dot gnu dot org>, Jan Hubicka <hubicka at ucw dot cz>
- Date: Thu, 22 Nov 2018 14:51:18 +0100
- Subject: Re: [PATCH] Fix option values for -march.
- References: <0c782751-8793-08ab-2ae7-d0ac15f502ab@suse.cz>
On Thu, Nov 22, 2018 at 2:43 PM Martin Liška <mliska@suse.cz> wrote:
> The patch makes clear we'll not diverge number of elements in
> processor_names and the corresponding enum. Plus I fixed
> -march=znver2 native as valid options that were not listed.
>
> Patch survives tests and bootstrap on x86_64-linux-gnu.
>
> Ready for trunk?
> Martin
>
> gcc/ChangeLog:
>
> 2018-11-22 Martin Liska <mliska@suse.cz>
>
> * common/config/i386/i386-common.c (processor_names): Add
> static assert and add missing "znver2".
> (ix86_get_valid_option_values): Add checking assert for null
> values and add "native" value if feasible.
> * config/i386/i386.h: Do not declare size of processor_names.
> ---
> gcc/common/config/i386/i386-common.c | 26 ++++++++++++++++++++++----
> gcc/config/i386/i386.h | 2 +-
> 2 files changed, 23 insertions(+), 5 deletions(-)
+/* Guarantee that the array is aligned with henum processor_type. */
+STATIC_ASSERT ((sizeof (processor_names) / sizeof (processor_names[0])
+ == PROCESSOR_max));
Please use ARRAY_SIZE macro here.
+#ifdef HAVE_LOCAL_CPU_DETECT
+ /* Add also "native" as possible value. */
+ v.safe_push ("native");
+#endif
"native" is processed by the driver and this option is never passed to cc1.
Uros.