Hi! On Tue, May 21, 2019 at 10:22:26PM +0930, Alan Modra wrote: > This is a repost of > https://gcc.gnu.org/ml/gcc-patches/2018-12/msg00911.html with a small > tweak to rs6000_machine_from_flags (&~ instead of ^). > > Bootstrapped and regression tested powerpc64le-linux power8 and > power9. OK to apply now that we're in stage1? > > * config/rs6000/rs6000.h (ASM_OPT_ANY): Define. > (ASM_CPU_SPEC): Conditionally add -many. > * config/rs6000/rs6000.c (rs6000_machine): New static var. > (rs6000_machine_from_flags, emit_asm_machine): New functions.. > (rs6000_file_start): ..extracted from here, and modified to > test all ISA bits. > (rs6000_output_function_prologue): Emit .machine as necessary. > * testsuite/gcc.target/powerpc/ppc32-abi-dfp-1.c: Don't use > power mnemonics. > * testsuite/gcc.dg/vect/O3-pr70130.c: Disable default options > added by check_vect_support_and_set_flags. > * testsuite/gcc.dg/vect/pr48765.c: Likewise. > * testsuite/gfortran.dg/vect/pr45714-b.f: Likewise.
> +static const char * > +rs6000_machine_from_flags (void) > +{ > + if ((rs6000_isa_flags & (ISA_3_0_MASKS_SERVER & ~ISA_2_7_MASKS_SERVER)) != > 0) > + return "power9"; > + if ((rs6000_isa_flags & (ISA_2_7_MASKS_SERVER & ~ISA_2_6_MASKS_SERVER)) != > 0) > + return "power8"; > + if ((rs6000_isa_flags & (ISA_2_6_MASKS_SERVER & ~ISA_2_5_MASKS_SERVER)) != > 0) > + return "power7"; > + if ((rs6000_isa_flags & (ISA_2_5_MASKS_SERVER & ~ISA_2_4_MASKS)) != 0) > + return "power6"; > + if ((rs6000_isa_flags & (ISA_2_4_MASKS & ~ISA_2_1_MASKS)) != 0) > + return "power5"; > + if ((rs6000_isa_flags & ISA_2_1_MASKS) != 0) > + return "power4"; > + if ((rs6000_isa_flags & OPTION_MASK_POWERPC64) != 0) > + return "ppc64"; > + return "ppc"; > +} As you know I'm trying to get rid of most of the separate user-selectable features we have currently. I think I'll steal this code :-) (Is Power5 2.4? Not 2.2?) > + { > + rs6000_output_savres_externs (file); > +#ifdef USING_ELFOS_H > + const char *curr_machine = rs6000_machine_from_flags (); > + if (rs6000_machine != curr_machine) > + { > + rs6000_machine = curr_machine; > + emit_asm_machine (); > + } > +#endif > + } Comparing fixed strings using ==... Not great. I'll change things to use an enum soon, so it's okay for now. > diff --git a/gcc/testsuite/gcc.dg/vect/O3-pr70130.c > b/gcc/testsuite/gcc.dg/vect/O3-pr70130.c > index 18a295c83f0..f8b84405140 100644 > --- a/gcc/testsuite/gcc.dg/vect/O3-pr70130.c > +++ b/gcc/testsuite/gcc.dg/vect/O3-pr70130.c > @@ -1,5 +1,5 @@ > /* { dg-require-effective-target vsx_hw { target powerpc*-*-* } } */ > -/* { dg-additional-options "-mcpu=power7" { target powerpc*-*-* } } */ > +/* { dg-additional-options "-mcpu=power7 -mno-power9-vector > -mno-power8-vector" { target powerpc*-*-* } } */ -mdejagnu-cpu=power7 should make the -mno-* things unnecessary I think? Hrm, I missed the few testcases outside gcc.target/powerpc/ when I did that. Please try that? Okay for trunk with that. Thanks! Segher