https://gcc.gnu.org/bugzilla/show_bug.cgi?id=115713
Kewen Lin <linkw at gcc dot gnu.org> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |jakub at gcc dot gnu.org, | |rguenth at gcc dot gnu.org, | |rsandifo at gcc dot gnu.org --- Comment #4 from Kewen Lin <linkw at gcc dot gnu.org> --- > diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc > index 76bbb3a28ea..4638c34cc24 100644 > --- a/gcc/config/rs6000/rs6000.cc > +++ b/gcc/config/rs6000/rs6000.cc > @@ -24638,8 +24638,11 @@ rs6000_inner_target_options (tree args, bool attr_p) > { > if (mask == OPTION_MASK_VSX) > { > - mask |= OPTION_MASK_ALTIVEC; > - TARGET_AVOID_XFORM = 0; > + if (!(rs6000_isa_flags_explicit > + & OPTION_MASK_ALTIVEC)) > + mask |= OPTION_MASK_ALTIVEC; > + if (!OPTION_SET_P (TARGET_AVOID_XFORM)) > + TARGET_AVOID_XFORM = 0; > } > } Testing this patch and found one regression failure: gcc/testsuite/gcc.target/powerpc/ppc-target-4.c It fails due to that the command line (dg-options) specifies -mno-altivec /* { dg-options "-O2 -ffast-math -mdejagnu-cpu=power5 -mno-altivec -mabi=altivec -fno-unroll-loops" } */ meanwhile #pragma target just specifies "vsx" #pragma GCC target("vsx") #include <altivec.h> ---- w/o this patch, "vsx" would enable altivec implicitly no matter that command line option specifying -mno-altivec, while w/ this patch "vsx" won't enable altivec any more. It's like the case in #c0, the difference is -mno-altivec is from command line or target attribute itself. It can be fixed by explicitly specifying "-maltivec" in target attribute. But by checking the manual, I noticed the documentation on target attribute says "The original target command-line options are ignored.", I think it contradicts with what we implemented for target attribute parsing now? It seems the other targets don't conform with this very well, target_option_default_node has considered all command line options? I wonder if the documentation is intentional to define like this.