https://gcc.gnu.org/bugzilla/show_bug.cgi?id=107304
--- Comment #7 from H.J. Lu <hjl.tools at gmail dot com> --- (In reply to Hongtao.liu from comment #6) > (In reply to Hongtao.liu from comment #5) > > (In reply to H.J. Lu from comment #4) > > > Since the default is -march=tigerlake, it enables AVX512 in the middle > > > end. > > > When "arch=alderlake" disables AVX512, we fails to expand AVX512 to > > > non-AVX512 > > > ISAs. It means that target_clones can't be more restrictive than the > > > default. We > > > should provide better diagnostics. > > > > Is there any place checking ISA difference for target_clones? > > ix86_valid_target_attribute_inner_p? It may not have all ISA infos. Will this diff --git a/gcc/config/i386/i386-options.cc b/gcc/config/i386/i386-options.cc index acb2291e70f..1efaae132e9 100644 --- a/gcc/config/i386/i386-options.cc +++ b/gcc/config/i386/i386-options.cc @@ -2953,6 +2953,14 @@ ix86_option_override_internal (bool main_args_p, fine grained control & costing. */ SET_OPTION_IF_UNSET (opts, opts_set, param_vect_partial_vector_usage, 0); + if (!main_args_p + && &global_options != opts + && (((opts->x_ix86_isa_flags & global_options.x_ix86_isa_flags) + != global_options.x_ix86_isa_flags) + || ((opts->x_ix86_isa_flags2 & global_options.x_ix86_isa_flags2) + != global_options.x_ix86_isa_flags2))) + error ("Target ISAs are more restrictive than the default"); + return true; } work?