[PATCH 3/4] Overhaul in isa_flags and handling it.
gcc/ChangeLog: * config/i386/i386-options.c (TARGET_EXPLICIT_NO_SAHF_P): Define. (SET_TARGET_NO_SAHF): Likewise. (TARGET_EXPLICIT_PREFETCH_SSE_P): Likewise. (SET_TARGET_PREFETCH_SSE): Likewise. (TARGET_EXPLICIT_NO_TUNE_P): Likewise. (SET_TARGET_NO_TUNE): Likewise. (TARGET_EXPLICIT_NO_80387_P): Likewise. (SET_TARGET_NO_80387): Likewise. (DEF_PTA): New. * config/i386/i386.h (TARGET_*): Remove. * opth-gen.awk: Generate new used macros. --- gcc/config/i386/i386-options.c | 303 - gcc/config/i386/i386.h | 192 + gcc/opth-gen.awk | 11 +- 3 files changed, 45 insertions(+), 461 deletions(-) diff --git a/gcc/config/i386/i386-options.c b/gcc/config/i386/i386-options.c index 154234a6a44..2aef59d962c 100644 --- a/gcc/config/i386/i386-options.c +++ b/gcc/config/i386/i386-options.c @@ -2094,285 +2094,40 @@ ix86_option_override_internal (bool main_args_p, else ix86_tune = PROCESSOR_GENERIC; - if (((processor_alias_table[i].flags & PTA_MMX) != 0) - && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_MMX)) - opts->x_ix86_isa_flags |= OPTION_MASK_ISA_MMX; - if (((processor_alias_table[i].flags & PTA_3DNOW) != 0) - && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_3DNOW)) - opts->x_ix86_isa_flags |= OPTION_MASK_ISA_3DNOW; - if (((processor_alias_table[i].flags & PTA_3DNOW_A) != 0) - && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_3DNOW_A)) - opts->x_ix86_isa_flags |= OPTION_MASK_ISA_3DNOW_A; - if (((processor_alias_table[i].flags & PTA_SSE) != 0) - && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_SSE)) - opts->x_ix86_isa_flags |= OPTION_MASK_ISA_SSE; - if (((processor_alias_table[i].flags & PTA_SSE2) != 0) - && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_SSE2)) - opts->x_ix86_isa_flags |= OPTION_MASK_ISA_SSE2; - if (((processor_alias_table[i].flags & PTA_SSE3) != 0) - && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_SSE3)) - opts->x_ix86_isa_flags |= OPTION_MASK_ISA_SSE3; - if (((processor_alias_table[i].flags & PTA_SSSE3) != 0) - && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_SSSE3)) - opts->x_ix86_isa_flags |= OPTION_MASK_ISA_SSSE3; - if (((processor_alias_table[i].flags & PTA_SSE4_1) != 0) - && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_SSE4_1)) - opts->x_ix86_isa_flags |= OPTION_MASK_ISA_SSE4_1; - if (((processor_alias_table[i].flags & PTA_SSE4_2) != 0) - && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_SSE4_2)) - opts->x_ix86_isa_flags |= OPTION_MASK_ISA_SSE4_2; - if (((processor_alias_table[i].flags & PTA_AVX) != 0) - && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_AVX)) - opts->x_ix86_isa_flags |= OPTION_MASK_ISA_AVX; - if (((processor_alias_table[i].flags & PTA_AVX2) != 0) - && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_AVX2)) - opts->x_ix86_isa_flags |= OPTION_MASK_ISA_AVX2; - if (((processor_alias_table[i].flags & PTA_FMA) != 0) - && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_FMA)) - opts->x_ix86_isa_flags |= OPTION_MASK_ISA_FMA; - if (((processor_alias_table[i].flags & PTA_SSE4A) != 0) - && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_SSE4A)) - opts->x_ix86_isa_flags |= OPTION_MASK_ISA_SSE4A; - if (((processor_alias_table[i].flags & PTA_FMA4) != 0) - && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_FMA4)) - opts->x_ix86_isa_flags |= OPTION_MASK_ISA_FMA4; - if (((processor_alias_table[i].flags & PTA_XOP) != 0) - && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_XOP)) - opts->x_ix86_isa_flags |= OPTION_MASK_ISA_XOP; - if (((processor_alias_table[i].flags & PTA_LWP) != 0) - && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_LWP)) - opts->x_ix86_isa_flags |= OPTION_MASK_ISA_LWP; + /* Enable PTA flags that are enabled by default by a -march option. */ +#define TARGET_EXPLICIT_NO_SAHF_P(opts) (false) +#define SET_TARGET_NO_SAHF(opts) {} +#define TARGET_EXPLICIT_PREFETCH_SSE_P(opts) (false) +#define SET_TARGET_PREFETCH_SSE(opts) {} +#define TARGET_EXPLICIT_NO_TUNE_P(opts) (false) +#define SET_TARGET_NO_TUNE(opts) {} +#define TARGET_EXPLICIT_NO_80387_P(opts) (false) +#define SET_TARGET_NO_80387(opts) {} + +#define DEF_PTA(NAME) \ + if (((processor_alias_table[i].flags & PTA_ ## NAME) != 0) \ + && PTA_ ## NAME != PTA_64BIT \ + && !TARGET_EXPLICIT_ ## NAME ## _P (opts)) \ + SET_TARGET_ ## NAME (opts); +#include "i386.def" +#undef DEF_PTA + + + if (!(TARGET_64BIT_P (opts->x_ix86_isa_flags) + && ((processor_alias_table[i].flags & PTA_NO_SAHF) != 0)) + && !TARGET_EXPLICIT_SAHF_P (opts)) + SET_TARGET_SAHF (opts); + if (((processor_alias_table[i].flags & PTA_ABM) != 0) - && !(opts->x_ix86_isa_flags_explicit & OPTION_MASK_ISA_ABM)) - opts->x_ix86_isa_flags |= OPTION_MASK_ISA_ABM; - if (((processor_alias_table[i
Re: [PATCH 3/4] Overhaul in isa_flags and handling it.
On Wed, Apr 21, 2021 at 10:28 AM Martin Liska wrote: > > > gcc/ChangeLog: > > * config/i386/i386-options.c (TARGET_EXPLICIT_NO_SAHF_P): > Define. > (SET_TARGET_NO_SAHF): Likewise. > (TARGET_EXPLICIT_PREFETCH_SSE_P): Likewise. > (SET_TARGET_PREFETCH_SSE): Likewise. > (TARGET_EXPLICIT_NO_TUNE_P): Likewise. > (SET_TARGET_NO_TUNE): Likewise. > (TARGET_EXPLICIT_NO_80387_P): Likewise. > (SET_TARGET_NO_80387): Likewise. > (DEF_PTA): New. > * config/i386/i386.h (TARGET_*): Remove. > * opth-gen.awk: Generate new used macros. LGTM, but please coordinate the commit with HJ, he has a couple of patches in this area. Thanks, Uros. > --- > gcc/config/i386/i386-options.c | 303 - > gcc/config/i386/i386.h | 192 + > gcc/opth-gen.awk | 11 +- > 3 files changed, 45 insertions(+), 461 deletions(-) >
Re: [PATCH 3/4] Overhaul in isa_flags and handling it.
On Wed, Apr 21, 2021 at 3:58 AM Uros Bizjak wrote: > > On Wed, Apr 21, 2021 at 10:28 AM Martin Liska wrote: > > > > > > gcc/ChangeLog: > > > > * config/i386/i386-options.c (TARGET_EXPLICIT_NO_SAHF_P): > > Define. > > (SET_TARGET_NO_SAHF): Likewise. > > (TARGET_EXPLICIT_PREFETCH_SSE_P): Likewise. > > (SET_TARGET_PREFETCH_SSE): Likewise. > > (TARGET_EXPLICIT_NO_TUNE_P): Likewise. > > (SET_TARGET_NO_TUNE): Likewise. > > (TARGET_EXPLICIT_NO_80387_P): Likewise. > > (SET_TARGET_NO_80387): Likewise. > > (DEF_PTA): New. > > * config/i386/i386.h (TARGET_*): Remove. > > * opth-gen.awk: Generate new used macros. > > LGTM, but please coordinate the commit with HJ, he has a couple of > patches in this area. > Rebase is needed since my -mwait patch has been checked in. -- H.J.
Re: [PATCH 3/4] Overhaul in isa_flags and handling it.
On 4/21/21 3:34 PM, H.J. Lu wrote: > On Wed, Apr 21, 2021 at 3:58 AM Uros Bizjak wrote: >> >> On Wed, Apr 21, 2021 at 10:28 AM Martin Liska wrote: >>> >>> >>> gcc/ChangeLog: >>> >>> * config/i386/i386-options.c (TARGET_EXPLICIT_NO_SAHF_P): >>> Define. >>> (SET_TARGET_NO_SAHF): Likewise. >>> (TARGET_EXPLICIT_PREFETCH_SSE_P): Likewise. >>> (SET_TARGET_PREFETCH_SSE): Likewise. >>> (TARGET_EXPLICIT_NO_TUNE_P): Likewise. >>> (SET_TARGET_NO_TUNE): Likewise. >>> (TARGET_EXPLICIT_NO_80387_P): Likewise. >>> (SET_TARGET_NO_80387): Likewise. >>> (DEF_PTA): New. >>> * config/i386/i386.h (TARGET_*): Remove. >>> * opth-gen.awk: Generate new used macros. >> >> LGTM, but please coordinate the commit with HJ, he has a couple of >> patches in this area. >> > > Rebase is needed since my -mwait patch has been checked in. > I've just done that and pushed all patches in the series. Thank you Uroš for review. Martin