Hi! On Thu, Dec 23, 2021 at 10:12:19AM +0800, Kewen.Lin wrote: > PR target/103627 > * config/rs6000/rs6000.c (rs6000_option_override_internal): Move the > hunk affecting VSX and ALTIVEC to the appropriate place. > > gcc/testsuite/ChangeLog: > > PR target/103627 > * gcc.target/powerpc/pr103627-3.c: New test.
> --- a/gcc/config/rs6000/rs6000.c > +++ b/gcc/config/rs6000/rs6000.c > @@ -3955,6 +3955,15 @@ rs6000_option_override_internal (bool global_init_p) > else if (TARGET_ALTIVEC) > rs6000_isa_flags |= (OPTION_MASK_PPC_GFXOPT & ~ignore_masks); > > + /* Disable VSX and Altivec silently if the user switched cpus to power7 in > a > + target attribute or pragma which automatically enables both options, > + unless the altivec ABI was set. This is set by default for 64-bit, but > + not for 32-bit. Don't move this before the above code using > ignore_masks, > + since it can reset the cleared VSX/ALTIVEC flag again. */ > + if (main_target_opt != NULL && !main_target_opt->x_rs6000_altivec_abi) > + rs6000_isa_flags &= ~((OPTION_MASK_VSX | OPTION_MASK_ALTIVEC) > + & ~rs6000_isa_flags_explicit); Could you at the same time get rid of the != NULL please? if (bla != NULL) is sillier than if (bla != 0) which is about the same as if (!!bla) but that is certainly better than if (bla != 0 != 0) although I am not sure about the more stylish if (bla != 0 != 0 != 0 != 0 != 0) but what is wrong with if (bla) ? :-) > +/* There are no error messages for either LE or BE 64bit. */ > +/* { dg-require-effective-target be }*/ (space before */) > +/* { dg-require-effective-target ilp32 } */ > +/* We don't have one powerpc.*_ok for Power6, use altivec_ok conservatively. > */ > +/* { dg-require-effective-target powerpc_altivec_ok } */ > +/* { dg-options "-mdejagnu-cpu=power6" } */ It is okay always, no _ok at all please. Okay for trunk with those things (but do test of course). Thanks! Segher