https://gcc.gnu.org/g:892f4318a3eb42c414386caa67fb32b9c8496902
commit 892f4318a3eb42c414386caa67fb32b9c8496902 Author: Michael Meissner <meiss...@linux.ibm.com> Date: Wed Jul 31 13:14:34 2024 -0400 Revert changes Diff: --- gcc/ChangeLog.meissner | 190 +------------ gcc/config/rs6000/rs6000-arch.def | 48 ---- gcc/config/rs6000/rs6000-c.cc | 25 +- gcc/config/rs6000/rs6000-cpus.def | 8 +- gcc/config/rs6000/rs6000-opts.h | 19 -- gcc/config/rs6000/rs6000-protos.h | 5 +- gcc/config/rs6000/rs6000.cc | 363 ++++++------------------ gcc/config/rs6000/rs6000.h | 6 - gcc/config/rs6000/rs6000.opt | 19 +- gcc/testsuite/gcc.target/powerpc/ppc-target-4.c | 40 +-- gcc/testsuite/gcc.target/powerpc/pr115688.c | 3 +- 11 files changed, 136 insertions(+), 590 deletions(-) diff --git a/gcc/ChangeLog.meissner b/gcc/ChangeLog.meissner index ece220b9bd2c..d9918e29052d 100644 --- a/gcc/ChangeLog.meissner +++ b/gcc/ChangeLog.meissner @@ -1,192 +1,4 @@ -==================== Branch work174, patch #13 was reverted ==================== - -==================== Branch work174, patch #12 ==================== - -Update arch flags. - -2024-07-31 Michael Meissner <meiss...@linux.ibm.com> - -gcc/ - - * config/rs6000/rs6000.cc (get_arch_flags): Rewrite. - -==================== Branch work174, patch #11 ==================== - -Add power5+ to arch flags. - -2024-07-31 Michael Meissner <meiss...@linux.ibm.com> - -gcc/ - - * config/rs6000/rs6000-arch.def (ARCH_MASK_POWER5X): Add power5+ - support. - * config/rs6000/rs6000-c.cc (rs6000_target_modify_macros): Use arch - masks for power4, power5, power5+, and power6. - * config/rs6000/rs6000.cc (get_arch_flags): Add support for setting arch - flags for non power* processors. Add support for power5+. - (report_architecture_mismatch): Improve error message. - -==================== Branch work174, patch #10 ==================== - -Use const HOST_WIDE_INT for arch masks. - -2024-07-30 Michael Meissner <meiss...@linux.ibm.com> - - * config/rs6000/rs6000-opts.h (ARCH_MASK_*): Encode the masks as const - HOST_WIDE_INT and not as an enumeratio. - -==================== Branch work174, patch #9 was reverted ==================== -==================== Branch work174, patch #8 was reverted ==================== -==================== Branch work174, patch #7 was reverted ==================== - -==================== Branch work174, patch #6 ==================== - -Update tests to work with architecture flags changes. - -Two tests used -mvsx to raise the processor level to at least power7. These -tests were rewritten to add cpu=power7 support. - -2024-07-29 Michael Meissner <meiss...@linux.ibm.com> - -gcc/testsuite/ - - * gcc.target/powerpc/ppc-target-4.c: Rewrite the test to add cpu=power7 - when we need to add VSX support. Add test for adding cpu=power7 no-vsx - to generate only Altivec instructions. - * gcc.target/powerpc/pr115688.c: Add cpu=power7 when requesting VSX - instructions. - -==================== Branch work174, patch #5 ==================== - -Do not allow -mvsx to boost processor to power7. - -This patch restructures the code so that -mvsx for example will not silently -convert the processor to power7. The user must now use -mcpu=power7 or higher. -This means if the user does -mvsx and the default processor does not have VSX -support, it will be an error. - -2024-07-29 Michael Meissner <meiss...@linux.ibm.com> - -gcc/ - - * config/rs6000/rs6000.cc (report_architecture_mismatch): New function. - Report an error if the user used an option such as -mvsx when the - default processor would not allow the option. - (rs6000_option_override_internal): Move some ISA checking code into - report_architecture_mismatch. - -==================== Branch work174, patch #4 ==================== - -Use architecture flags for defining _ARCH_PWR macros. - -For the newer architectures, this patch changes GCC to define the _ARCH_PWR<n> -macros using the new architecture flags instead of relying on isa options like --mpower10. - -The -mpower8-internal, -mpower10, and -mpower11 options were removed. The --mpower11 option was removed completely, since it was just added in GCC 15. The -other two options were marked as WarnRemoved, and the various ISA bits were -removed. - -TARGET_POWER8 and TARGET_POWER10 were re-defined to use the architeture bits -instead of the ISA bits. - -There are other internal isa bits that aren't removed with this patch because -the built-in function support uses those bits. - -2024-07-29 Michael Meissner <meiss...@linux.ibm.com> - -gcc/ - - * config/rs6000/rs6000-c.cc (rs6000_target_modify_macros) Add support to - use architecture flags instead of ISA flags for setting most of the - _ARCH_PWR* macros. - (rs6000_cpu_cpp_builtins): Likewise. - * config/rs6000/rs6000-cpus.def (ISA_2_7_MASKS_SERVER): Remove - OPTION_MASK_POWER8. - (ISA_3_1_MASKS_SERVER): Remove OPTION_MASK_POWER10. - (POWER11_MASKS_SERVER): Remove OPTION_MASK_POWER11. - (POWERPC_MASKS): Remove OPTION_MASK_POWER8, OPTION_MASK_POWER10, and - OPTION_MASK_POWER11. - * config/rs6000/rs6000-protos.h (rs6000_target_modify_macros): Update - declaration. - (rs6000_target_modify_macros_ptr): Likewise. - * config/rs6000/rs6000.cc (rs6000_target_modify_macros_ptr): Likewise. - (rs6000_option_override_internal): Use architecture flags instead of ISA - flags. - (rs6000_opt_masks): Remove -mpower10 and -mpower11 support. - (rs6000_pragma_target_parse): Use architecture flags as well as ISA - flags. - * config/rs6000/rs6000.h (TARGET_POWER8): New macro. - (TARGET_POWER10): Likewise. - * config/rs6000/rs6000.opt (-mpower8-internal): No longer make this an - ISA flag. - (-mpower10): Likewise. - (-mpower11): Likewise. - -==================== Branch work174, patch #3 ==================== - -Set .machine from the architecture flags - -This patch switches the handling of .machine to use architecture masks if they -exist (power4 through power11). All of the other PowerPCs will continue to use -the existing code for setting the .machine option. - -2024-07-29 Michael Meissner <meiss...@linux.ibm.com> - -gcc/ - - * config/rs6000/rs6000 (rs6000_machine_from_flags): Set .machine from - the architecture flags. - -==================== Branch work174, patch #2 ==================== - -Make clone_targets use architecture flags. - -This patch expands on the previous patch and changes the target_clones support -to use an architecture mask instead of isa bits. - -2024-07-29 Michael Meissner <meiss...@linux.ibm.com> - -gcc/ - - * config/rs6000/rs6000.cc (struct clone_map): Switch to use architecture - flags instead of ISA flags for target_clone support. - (rs6000_clone_map): Likewise. - (rs6000_clone_priority): Likewise. - -==================== Branch work174, patch #1 ==================== - -Add rs6000 architecture masks. - -This patch begins the journey to move architecture bits that are not user ISA -options from rs6000_isa_flags to a new targt variable rs6000_arch_flags. The -intention is to remove switches that are currently isa options, but the user -should not be using this particular option. For example, we want users to use --mcpu=power10 and not just -mpower10. - -2024-07-29 Michael Meissner <meiss...@linux.ibm.com> - -gcc/ - - * config/rs6000/rs6000-arch.def: New file. - * config/rs6000/rs6000-opts.h: Use rs6000-arch.def to create the - architecture masks needed. - * config/rs6000/rs6000.cc (rs6000_print_isa_options): Add an - architecture flags argument, change all callers. - (get_arch_flag): New function. - (rs6000_debug_reg_global): Update rs6000_print_isa_options calls. - (rs6000_option_override_internal): Likewise. - (struct rs6000_arch_mask): New structure. - (rs6000_arch_masks): New table of architecutre masks and names. - (rs6000_function_specific_save): Save architecture flags. - (rs6000_function_specific_restore): Restore architecture flags. - (rs6000_function_specific_print): Update rs6000_print_isa_options calls. - (rs6000_print_options_internal): Add architecture flags options. - (rs6000_can_inline_p): Don't allow inling if the callee requires a newer - architecture than the caller. - * config/rs6000/rs6000.opt (rs6000_arch_flags): New target variable. - (x_rs6000_arch_flags): New save/restore field for rs6000_arch_flags. +==================== Branch work174, patch #1..13 were reverted ==================== ==================== Branch work174, baseline ==================== diff --git a/gcc/config/rs6000/rs6000-arch.def b/gcc/config/rs6000/rs6000-arch.def deleted file mode 100644 index e5b6e9581331..000000000000 --- a/gcc/config/rs6000/rs6000-arch.def +++ /dev/null @@ -1,48 +0,0 @@ -/* IBM RS/6000 CPU architecture features by processor type. - Copyright (C) 1991-2024 Free Software Foundation, Inc. - Contributed by Richard Kenner (ken...@vlsi1.ultra.nyu.edu) - - This file is part of GCC. - - GCC is free software; you can redistribute it and/or modify it - under the terms of the GNU General Public License as published - by the Free Software Foundation; either version 3, or (at your - option) any later version. - - GCC is distributed in the hope that it will be useful, but WITHOUT - ANY WARRANTY; without even the implied warranty of MERCHANTABILITY - or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public - License for more details. - - You should have received a copy of the GNU General Public License - along with GCC; see the file COPYING3. If not see - <http://www.gnu.org/licenses/>. */ - -/* This file defines architecture features that are based on the -mcpu=<proc> - option, and not on user options that can be turned on or off. The intention - is for newer processors (power7 and above) to not add new ISA bits for the - particular processor, but add these bits. Otherwise we have to add a bunch - of hidden options, just so we have the proper ISA bits. - - For example, in the past we added -mpower8-internal, so that on power8, - power9, and power10 would inherit the option, but we had to mark the option - generate a warning if the user actually used it. These options have been - moved from the ISA flags to the arch flags. - - To use this, define the macro ARCH_EXPAND which takes 2 arguments. The - first argument is the processor name in upper case, and the second argument - is a text name for the processor. - - The function get_arch_flags when passed a processor index number will set up - the appropriate architecture flags based on the actual processor - enumeration. */ - -ARCH_EXPAND(POWER4, "power4") -ARCH_EXPAND(POWER5, "power5") -ARCH_EXPAND(POWER5X, "power5+") -ARCH_EXPAND(POWER6, "power6") -ARCH_EXPAND(POWER7, "power7") -ARCH_EXPAND(POWER8, "power8") -ARCH_EXPAND(POWER9, "power9") -ARCH_EXPAND(POWER10, "power10") -ARCH_EXPAND(POWER11, "power11") diff --git a/gcc/config/rs6000/rs6000-c.cc b/gcc/config/rs6000/rs6000-c.cc index d7b1625f0867..04882c396bfe 100644 --- a/gcc/config/rs6000/rs6000-c.cc +++ b/gcc/config/rs6000/rs6000-c.cc @@ -338,8 +338,7 @@ rs6000_define_or_undefine_macro (bool define_p, const char *name) #pragma GCC target, we need to adjust the macros dynamically. */ void -rs6000_target_modify_macros (bool define_p, HOST_WIDE_INT flags, - HOST_WIDE_INT arch_flags) +rs6000_target_modify_macros (bool define_p, HOST_WIDE_INT flags) { if (TARGET_DEBUG_BUILTIN || TARGET_DEBUG_TARGET) fprintf (stderr, @@ -412,7 +411,7 @@ rs6000_target_modify_macros (bool define_p, HOST_WIDE_INT flags, summary of the flags associated with particular cpu definitions. */ - /* rs6000_isa_flags and rs6000_arch_flags based options. */ + /* rs6000_isa_flags based options. */ rs6000_define_or_undefine_macro (define_p, "_ARCH_PPC"); if ((flags & OPTION_MASK_PPC_GPOPT) != 0) rs6000_define_or_undefine_macro (define_p, "_ARCH_PPCSQ"); @@ -420,23 +419,23 @@ rs6000_target_modify_macros (bool define_p, HOST_WIDE_INT flags, rs6000_define_or_undefine_macro (define_p, "_ARCH_PPCGR"); if ((flags & OPTION_MASK_POWERPC64) != 0) rs6000_define_or_undefine_macro (define_p, "_ARCH_PPC64"); - if ((arch_flags & ARCH_MASK_POWER4) != 0) + if ((flags & OPTION_MASK_MFCRF) != 0) rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR4"); - if ((arch_flags & ARCH_MASK_POWER5) != 0) + if ((flags & OPTION_MASK_POPCNTB) != 0) rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR5"); - if ((arch_flags & ARCH_MASK_POWER5X) != 0) + if ((flags & OPTION_MASK_FPRND) != 0) rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR5X"); - if ((arch_flags & ARCH_MASK_POWER6) != 0) + if ((flags & OPTION_MASK_CMPB) != 0) rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR6"); - if ((arch_flags & ARCH_MASK_POWER7) != 0) + if ((flags & OPTION_MASK_POPCNTD) != 0) rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR7"); - if ((arch_flags & ARCH_MASK_POWER8) != 0) + if ((flags & OPTION_MASK_POWER8) != 0) rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR8"); - if ((arch_flags & ARCH_MASK_POWER9) != 0) + if ((flags & OPTION_MASK_MODULO) != 0) rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR9"); - if ((arch_flags & ARCH_MASK_POWER10) != 0) + if ((flags & OPTION_MASK_POWER10) != 0) rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR10"); - if ((arch_flags & ARCH_MASK_POWER11) != 0) + if ((flags & OPTION_MASK_POWER11) != 0) rs6000_define_or_undefine_macro (define_p, "_ARCH_PWR11"); if ((flags & OPTION_MASK_SOFT_FLOAT) != 0) rs6000_define_or_undefine_macro (define_p, "_SOFT_FLOAT"); @@ -606,7 +605,7 @@ void rs6000_cpu_cpp_builtins (cpp_reader *pfile) { /* Define all of the common macros. */ - rs6000_target_modify_macros (true, rs6000_isa_flags, rs6000_arch_flags); + rs6000_target_modify_macros (true, rs6000_isa_flags); if (TARGET_FRE) builtin_define ("__RECIP__"); diff --git a/gcc/config/rs6000/rs6000-cpus.def b/gcc/config/rs6000/rs6000-cpus.def index a3568898b0b6..84fac8bdac1d 100644 --- a/gcc/config/rs6000/rs6000-cpus.def +++ b/gcc/config/rs6000/rs6000-cpus.def @@ -47,6 +47,7 @@ fusion here, instead set it in rs6000.cc if we are tuning for a power8 system. */ #define ISA_2_7_MASKS_SERVER (ISA_2_6_MASKS_SERVER \ + | OPTION_MASK_POWER8 \ | OPTION_MASK_P8_VECTOR \ | OPTION_MASK_CRYPTO \ | OPTION_MASK_EFFICIENT_UNALIGNED_VSX \ @@ -82,9 +83,11 @@ | OPTION_MASK_PREFIXED) #define ISA_3_1_MASKS_SERVER (ISA_3_0_MASKS_SERVER \ + | OPTION_MASK_POWER10 \ | OTHER_POWER10_MASKS) -#define POWER11_MASKS_SERVER ISA_3_1_MASKS_SERVER +#define POWER11_MASKS_SERVER (ISA_3_1_MASKS_SERVER \ + | OPTION_MASK_POWER11) /* Flags that need to be turned off if -mno-vsx. */ #define OTHER_VSX_VECTOR_MASKS (OPTION_MASK_EFFICIENT_UNALIGNED_VSX \ @@ -122,6 +125,8 @@ | OPTION_MASK_FLOAT128_HW \ | OPTION_MASK_FLOAT128_KEYWORD \ | OPTION_MASK_FPRND \ + | OPTION_MASK_POWER10 \ + | OPTION_MASK_POWER11 \ | OPTION_MASK_P10_FUSION \ | OPTION_MASK_HTM \ | OPTION_MASK_ISEL \ @@ -130,6 +135,7 @@ | OPTION_MASK_MODULO \ | OPTION_MASK_MULHW \ | OPTION_MASK_NO_UPDATE \ + | OPTION_MASK_POWER8 \ | OPTION_MASK_P8_FUSION \ | OPTION_MASK_P8_VECTOR \ | OPTION_MASK_P9_MINMAX \ diff --git a/gcc/config/rs6000/rs6000-opts.h b/gcc/config/rs6000/rs6000-opts.h index c7764e66cd03..88e357835a5c 100644 --- a/gcc/config/rs6000/rs6000-opts.h +++ b/gcc/config/rs6000/rs6000-opts.h @@ -71,25 +71,6 @@ enum processor_type PROCESSOR_TITAN }; -/* Define an enumeration to number the architecture masks. */ -#undef ARCH_EXPAND -#define ARCH_EXPAND(PROC, NAME) ARCH_ENUM_ ## PROC, - -enum { -#include "rs6000-arch.def" - ARCH_ENUM_LAST -}; - -/* Create an architecture mask for the newer architectures (power6 and - up).. */ -#undef ARCH_EXPAND -#define ARCH_EXPAND(PROC, NAME) \ - static const HOST_WIDE_INT ARCH_MASK_ ## PROC \ - = HOST_WIDE_INT_1 << ARCH_ENUM_ ## PROC; - -#include "rs6000-arch.def" - -#undef ARCH_EXPAND /* Types of costly dependences. */ enum rs6000_dependence_cost diff --git a/gcc/config/rs6000/rs6000-protos.h b/gcc/config/rs6000/rs6000-protos.h index da658cd5ab2e..b40557a85577 100644 --- a/gcc/config/rs6000/rs6000-protos.h +++ b/gcc/config/rs6000/rs6000-protos.h @@ -323,9 +323,8 @@ extern void rs6000_cpu_cpp_builtins (struct cpp_reader *); extern bool rs6000_pragma_target_parse (tree, tree); #endif extern void rs6000_activate_target_options (tree new_tree); -extern void rs6000_target_modify_macros (bool, HOST_WIDE_INT, HOST_WIDE_INT); -extern void (*rs6000_target_modify_macros_ptr) (bool, HOST_WIDE_INT, - HOST_WIDE_INT); +extern void rs6000_target_modify_macros (bool, HOST_WIDE_INT); +extern void (*rs6000_target_modify_macros_ptr) (bool, HOST_WIDE_INT); #ifdef NO_DOLLAR_IN_LABEL const char * rs6000_xcoff_strip_dollar (const char *); diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc index c89a6ea8e792..0bcc6a2d0ab6 100644 --- a/gcc/config/rs6000/rs6000.cc +++ b/gcc/config/rs6000/rs6000.cc @@ -251,17 +251,17 @@ enum { /* Map compiler ISA bits into HWCAP names. */ struct clone_map { - HOST_WIDE_INT arch_mask; /* rs6000_arch_mask. */ + HOST_WIDE_INT isa_mask; /* rs6000_isa mask */ const char *name; /* name to use in __builtin_cpu_supports. */ }; static const struct clone_map rs6000_clone_map[CLONE_MAX] = { - { 0, "" }, /* Default options. */ - { ARCH_MASK_POWER6, "arch_2_05" }, /* ISA 2.05 (power6). */ - { ARCH_MASK_POWER7, "arch_2_06" }, /* ISA 2.06 (power7). */ - { ARCH_MASK_POWER8, "arch_2_07" }, /* ISA 2.07 (power8). */ - { ARCH_MASK_POWER9, "arch_3_00" }, /* ISA 3.0 (power9). */ - { ARCH_MASK_POWER10, "arch_3_1" }, /* ISA 3.1 (power10). */ + { 0, "" }, /* Default options. */ + { OPTION_MASK_CMPB, "arch_2_05" }, /* ISA 2.05 (power6). */ + { OPTION_MASK_POPCNTD, "arch_2_06" }, /* ISA 2.06 (power7). */ + { OPTION_MASK_P8_VECTOR, "arch_2_07" }, /* ISA 2.07 (power8). */ + { OPTION_MASK_P9_VECTOR, "arch_3_00" }, /* ISA 3.0 (power9). */ + { OPTION_MASK_POWER10, "arch_3_1" }, /* ISA 3.1 (power10). */ }; @@ -277,7 +277,7 @@ bool cpu_builtin_p = false; /* Pointer to function (in rs6000-c.cc) that can define or undefine target macros that have changed. Languages that don't support the preprocessor don't link in rs6000-c.cc, so we can't call it directly. */ -void (*rs6000_target_modify_macros_ptr) (bool, HOST_WIDE_INT, HOST_WIDE_INT); +void (*rs6000_target_modify_macros_ptr) (bool, HOST_WIDE_INT); /* Simplfy register classes into simpler classifications. We assume GPR_REG_TYPE - FPR_REG_TYPE are ordered so that we can use a simple range @@ -1170,9 +1170,8 @@ enum reg_class (*rs6000_preferred_reload_class_ptr) (rtx, enum reg_class) const int INSN_NOT_AVAILABLE = -1; static void rs6000_print_isa_options (FILE *, int, const char *, - HOST_WIDE_INT, HOST_WIDE_INT); + HOST_WIDE_INT); static HOST_WIDE_INT rs6000_disable_incompatible_switches (void); -static void report_architecture_mismatch (void); static enum rs6000_reg_type register_to_reg_type (rtx, bool *); static bool rs6000_secondary_reload_move (enum rs6000_reg_type, @@ -1818,82 +1817,6 @@ rs6000_cpu_name_lookup (const char *name) return -1; } - -/* Map the processor into the arch bits that are set off of -mcpu=<xxx> instead - of having an internal -m<foo> option. */ - -static HOST_WIDE_INT -get_arch_flags (int cpu_index) -{ - HOST_WIDE_INT ret = 0; - - const HOST_WIDE_INT ARCH_COMBO_POWER4 = ARCH_MASK_POWER4; - const HOST_WIDE_INT ARCH_COMBO_POWER5 = ARCH_MASK_POWER5 | ARCH_COMBO_POWER4; - const HOST_WIDE_INT ARCH_COMBO_POWER5X = ARCH_MASK_POWER5X | ARCH_COMBO_POWER5; - const HOST_WIDE_INT ARCH_COMBO_POWER6 = ARCH_MASK_POWER6 | ARCH_COMBO_POWER5X; - const HOST_WIDE_INT ARCH_COMBO_POWER7 = ARCH_MASK_POWER7 | ARCH_COMBO_POWER6; - const HOST_WIDE_INT ARCH_COMBO_POWER8 = ARCH_MASK_POWER8 | ARCH_COMBO_POWER7; - const HOST_WIDE_INT ARCH_COMBO_POWER9 = ARCH_MASK_POWER9 | ARCH_COMBO_POWER8; - const HOST_WIDE_INT ARCH_COMBO_POWER10 = ARCH_MASK_POWER10 | ARCH_COMBO_POWER9; - const HOST_WIDE_INT ARCH_COMBO_POWER11 = ARCH_MASK_POWER11 | ARCH_COMBO_POWER10; - - if (cpu_index >= 0) - switch (processor_target_table[cpu_index].processor) - { - case PROCESSOR_POWER11: - ret = ARCH_COMBO_POWER11; - break; - - case PROCESSOR_POWER10: - ret = ARCH_COMBO_POWER10; - break; - - case PROCESSOR_POWER9: - ret = ARCH_COMBO_POWER9; - break; - - case PROCESSOR_POWER8: - ret = ARCH_COMBO_POWER8; - break; - - case PROCESSOR_POWER7: - ret = ARCH_COMBO_POWER7; - break; - - case PROCESSOR_PPCA2: - case PROCESSOR_POWER6: - ret = ARCH_COMBO_POWER6; - break; - - case PROCESSOR_POWER5: - ret = ARCH_COMBO_POWER5; - if (TARGET_FPRND) - ret |= ARCH_MASK_POWER5X; - break; - - case PROCESSOR_POWER4: - ret = ARCH_COMBO_POWER4; - break; - - default: - /* For other processors, set the arch flags based on the ISA bits. */ - if (TARGET_MFCRF) - ret |= ARCH_MASK_POWER4; - - if (TARGET_POPCNTB) - ret |= ARCH_MASK_POWER5; - - if (TARGET_FPRND) - ret |= ARCH_MASK_POWER5X; - - if (TARGET_CMPB) - ret |= ARCH_MASK_POWER6; - break; - } - - return ret; -} - /* Return number of consecutive hard regs needed starting at reg REGNO to hold something of mode MODE. @@ -2475,10 +2398,9 @@ rs6000_debug_reg_global (void) const char *name = processor_target_table[rs6000_cpu_index].name; HOST_WIDE_INT flags = processor_target_table[rs6000_cpu_index].target_enable; - HOST_WIDE_INT arch_flags = get_arch_flags (rs6000_cpu_index); sprintf (flags_buffer, "-mcpu=%s flags", name); - rs6000_print_isa_options (stderr, 0, flags_buffer, flags, arch_flags); + rs6000_print_isa_options (stderr, 0, flags_buffer, flags); } else fprintf (stderr, DEBUG_FMT_S, "cpu", "<none>"); @@ -2488,26 +2410,21 @@ rs6000_debug_reg_global (void) const char *name = processor_target_table[rs6000_tune_index].name; HOST_WIDE_INT flags = processor_target_table[rs6000_tune_index].target_enable; - HOST_WIDE_INT arch_flags = get_arch_flags (rs6000_tune_index); sprintf (flags_buffer, "-mtune=%s flags", name); - rs6000_print_isa_options (stderr, 0, flags_buffer, flags, arch_flags); + rs6000_print_isa_options (stderr, 0, flags_buffer, flags); } else fprintf (stderr, DEBUG_FMT_S, "tune", "<none>"); cl_target_option_save (&cl_opts, &global_options, &global_options_set); rs6000_print_isa_options (stderr, 0, "rs6000_isa_flags", - rs6000_isa_flags, 0); + rs6000_isa_flags); rs6000_print_isa_options (stderr, 0, "rs6000_isa_flags_explicit", - rs6000_isa_flags_explicit, 0); - - if (rs6000_arch_flags) - rs6000_print_isa_options (stderr, 0, "rs6000_arch_flags", 0, - rs6000_arch_flags); + rs6000_isa_flags_explicit); - rs6000_print_isa_options (stderr, 0, "TARGET_DEFAULT", TARGET_DEFAULT, 0); + rs6000_print_isa_options (stderr, 0, "TARGET_DEFAULT", TARGET_DEFAULT); fprintf (stderr, DEBUG_FMT_S, "--with-cpu default", OPTION_TARGET_CPU_DEFAULT ? OPTION_TARGET_CPU_DEFAULT : "<none>"); @@ -3699,6 +3616,7 @@ rs6000_option_override_internal (bool global_init_p) bool ret = true; HOST_WIDE_INT set_masks; + HOST_WIDE_INT ignore_masks; int cpu_index = -1; int tune_index; struct cl_target_option *main_target_opt @@ -3707,7 +3625,7 @@ rs6000_option_override_internal (bool global_init_p) /* Print defaults. */ if ((TARGET_DEBUG_REG || TARGET_DEBUG_TARGET) && global_init_p) - rs6000_print_isa_options (stderr, 0, "TARGET_DEFAULT", TARGET_DEFAULT, 0); + rs6000_print_isa_options (stderr, 0, "TARGET_DEFAULT", TARGET_DEFAULT); /* Remember the explicit arguments. */ if (global_init_p) @@ -3838,8 +3756,6 @@ rs6000_option_override_internal (bool global_init_p) rs6000_isa_flags |= (flags & ~rs6000_isa_flags_explicit); } - rs6000_arch_flags = get_arch_flags (cpu_index); - /* Don't expect powerpc64 enabled on those OSes with OS_MISSING_POWERPC64, since they do not save and restore the high half of the GPRs correctly in all cases. If the user explicitly specifies it, we won't interfere @@ -3907,7 +3823,8 @@ rs6000_option_override_internal (bool global_init_p) /* If little-endian, default to -mstrict-align on older processors. */ if (!BYTES_BIG_ENDIAN - && (get_arch_flags (tune_index) & ARCH_MASK_POWER8) == 0) + && !(processor_target_table[tune_index].target_enable + & OPTION_MASK_POWER8)) rs6000_isa_flags |= ~rs6000_isa_flags_explicit & OPTION_MASK_STRICT_ALIGN; /* Add some warnings for VSX. */ @@ -3958,8 +3875,7 @@ rs6000_option_override_internal (bool global_init_p) & ~rs6000_isa_flags_explicit); if (TARGET_DEBUG_REG || TARGET_DEBUG_TARGET) - rs6000_print_isa_options (stderr, 0, "before defaults", rs6000_isa_flags, - rs6000_arch_flags); + rs6000_print_isa_options (stderr, 0, "before defaults", rs6000_isa_flags); #ifdef XCOFF_DEBUGGING_INFO /* For AIX default to 64-bit DWARF. */ @@ -3967,13 +3883,59 @@ rs6000_option_override_internal (bool global_init_p) dwarf_offset_size = POINTER_SIZE_UNITS; #endif - /* Report trying to use things like -mmodulo to imply -mcpu=power9. */ - report_architecture_mismatch (); + /* Handle explicit -mno-{altivec,vsx} and turn off all of + the options that depend on those flags. */ + ignore_masks = rs6000_disable_incompatible_switches (); + + /* For the newer switches (vsx, dfp, etc.) set some of the older options, + unless the user explicitly used the -mno-<option> to disable the code. */ + if (TARGET_P9_VECTOR || TARGET_MODULO || TARGET_P9_MISC) + rs6000_isa_flags |= (ISA_3_0_MASKS_SERVER & ~ignore_masks); + else if (TARGET_P9_MINMAX) + { + if (cpu_index >= 0) + { + if (cpu_index == PROCESSOR_POWER9) + { + /* legacy behavior: allow -mcpu=power9 with certain + capabilities explicitly disabled. */ + rs6000_isa_flags |= (ISA_3_0_MASKS_SERVER & ~ignore_masks); + } + else + error ("power9 target option is incompatible with %<%s=<xxx>%> " + "for <xxx> less than power9", "-mcpu"); + } + else if ((ISA_3_0_MASKS_SERVER & rs6000_isa_flags_explicit) + != (ISA_3_0_MASKS_SERVER & rs6000_isa_flags + & rs6000_isa_flags_explicit)) + /* Enforce that none of the ISA_3_0_MASKS_SERVER flags + were explicitly cleared. */ + error ("%qs incompatible with explicitly disabled options", + "-mpower9-minmax"); + else + rs6000_isa_flags |= ISA_3_0_MASKS_SERVER; + } + else if (TARGET_P8_VECTOR || TARGET_POWER8 || TARGET_CRYPTO) + rs6000_isa_flags |= (ISA_2_7_MASKS_SERVER & ~ignore_masks); + else if (TARGET_VSX) + rs6000_isa_flags |= (ISA_2_6_MASKS_SERVER & ~ignore_masks); + else if (TARGET_POPCNTD) + rs6000_isa_flags |= (ISA_2_6_MASKS_EMBEDDED & ~ignore_masks); + else if (TARGET_DFP) + rs6000_isa_flags |= (ISA_2_5_MASKS_SERVER & ~ignore_masks); + else if (TARGET_CMPB) + rs6000_isa_flags |= (ISA_2_5_MASKS_EMBEDDED & ~ignore_masks); + else if (TARGET_FPRND) + rs6000_isa_flags |= (ISA_2_4_MASKS & ~ignore_masks); + else if (TARGET_POPCNTB) + rs6000_isa_flags |= (ISA_2_2_MASKS & ~ignore_masks); + 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 report_architecture_mismatch + 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 && !main_target_opt->x_rs6000_altivec_abi) { @@ -4275,8 +4237,7 @@ rs6000_option_override_internal (bool global_init_p) /* Print the options after updating the defaults. */ if (TARGET_DEBUG_REG || TARGET_DEBUG_TARGET) - rs6000_print_isa_options (stderr, 0, "after defaults", rs6000_isa_flags, - rs6000_arch_flags); + rs6000_print_isa_options (stderr, 0, "after defaults", rs6000_isa_flags); /* E500mc does "better" if we inline more aggressively. Respect the user's opinion, though. */ @@ -4383,8 +4344,7 @@ rs6000_option_override_internal (bool global_init_p) TARGET_NO_FP_IN_TOC = 1; if (TARGET_DEBUG_REG || TARGET_DEBUG_TARGET) - rs6000_print_isa_options (stderr, 0, "before subtarget", rs6000_isa_flags, - rs6000_arch_flags); + rs6000_print_isa_options (stderr, 0, "before subtarget", rs6000_isa_flags); #ifdef SUBTARGET_OVERRIDE_OPTIONS SUBTARGET_OVERRIDE_OPTIONS; @@ -4451,8 +4411,7 @@ rs6000_option_override_internal (bool global_init_p) rs6000_isa_flags &= ~OPTION_MASK_PCREL_OPT; if (TARGET_DEBUG_REG || TARGET_DEBUG_TARGET) - rs6000_print_isa_options (stderr, 0, "after subtarget", rs6000_isa_flags, - rs6000_arch_flags); + rs6000_print_isa_options (stderr, 0, "after subtarget", rs6000_isa_flags); rs6000_always_hint = (rs6000_tune != PROCESSOR_POWER4 && rs6000_tune != PROCESSOR_POWER5 @@ -5943,28 +5902,27 @@ rs6000_machine_from_flags (void) return "ppc64"; #endif - HOST_WIDE_INT arch_flags = rs6000_arch_flags; HOST_WIDE_INT flags = rs6000_isa_flags; /* Disable the flags that should never influence the .machine selection. */ flags &= ~(OPTION_MASK_PPC_GFXOPT | OPTION_MASK_PPC_GPOPT | OPTION_MASK_ISEL | OPTION_MASK_ALTIVEC); - if ((arch_flags & ARCH_MASK_POWER11) != 0) + if ((flags & (POWER11_MASKS_SERVER & ~ISA_3_1_MASKS_SERVER)) != 0) return "power11"; - if ((arch_flags & ARCH_MASK_POWER10) != 0) + if ((flags & (ISA_3_1_MASKS_SERVER & ~ISA_3_0_MASKS_SERVER)) != 0) return "power10"; - if ((arch_flags & ARCH_MASK_POWER9) != 0) + if ((flags & (ISA_3_0_MASKS_SERVER & ~ISA_2_7_MASKS_SERVER)) != 0) return "power9"; - if ((arch_flags & ARCH_MASK_POWER8) != 0) + if ((flags & (ISA_2_7_MASKS_SERVER & ~ISA_2_6_MASKS_SERVER)) != 0) return "power8"; - if ((arch_flags & ARCH_MASK_POWER7) != 0) + if ((flags & (ISA_2_6_MASKS_SERVER & ~ISA_2_5_MASKS_SERVER)) != 0) return "power7"; - if ((arch_flags & ARCH_MASK_POWER6) != 0) + if ((flags & (ISA_2_5_MASKS_SERVER & ~ISA_2_4_MASKS)) != 0) return "power6"; - if ((arch_flags & ARCH_MASK_POWER5) != 0) + if ((flags & (ISA_2_4_MASKS & ~ISA_2_1_MASKS)) != 0) return "power5"; - if ((arch_flags & ARCH_MASK_POWER4) != 0) + if ((flags & ISA_2_1_MASKS) != 0) return "power4"; if ((flags & OPTION_MASK_POWERPC64) != 0) return "ppc64"; @@ -24536,6 +24494,8 @@ static struct rs6000_opt_mask const rs6000_opt_masks[] = { "float128", OPTION_MASK_FLOAT128_KEYWORD, false, true }, { "float128-hardware", OPTION_MASK_FLOAT128_HW, false, true }, { "fprnd", OPTION_MASK_FPRND, false, true }, + { "power10", OPTION_MASK_POWER10, false, true }, + { "power11", OPTION_MASK_POWER11, false, false }, { "hard-dfp", OPTION_MASK_DFP, false, true }, { "htm", OPTION_MASK_HTM, false, true }, { "isel", OPTION_MASK_ISEL, false, true }, @@ -24592,23 +24552,6 @@ static struct rs6000_opt_mask const rs6000_opt_masks[] = { "string", 0, false, false }, }; -/* Similar structure for the arch bits that are set via -mcpu=<xxx> and not via - a separate -m<yyy> option. */ -struct rs6000_arch_mask { - const char *name; /* option name */ - const HOST_WIDE_INT mask; /* mask to set */ -}; - -#undef ARCH_EXPAND -#define ARCH_EXPAND(PROC, NAME) { NAME, ARCH_MASK_ ## PROC }, - -static struct rs6000_arch_mask const rs6000_arch_masks[] = -{ -#include "rs6000-arch.def" -}; - -#undef ARCH_EXPAND - /* Option variables that we want to support inside attribute((target)) and #pragma GCC target operations. */ @@ -24967,7 +24910,6 @@ rs6000_pragma_target_parse (tree args, tree pop_target) tree cur_tree; struct cl_target_option *prev_opt, *cur_opt; HOST_WIDE_INT prev_flags, cur_flags, diff_flags; - HOST_WIDE_INT prev_arch, cur_arch, diff_arch; if (TARGET_DEBUG_TARGET) { @@ -25020,26 +24962,21 @@ rs6000_pragma_target_parse (tree args, tree pop_target) { prev_opt = TREE_TARGET_OPTION (prev_tree); prev_flags = prev_opt->x_rs6000_isa_flags; - prev_arch = prev_opt->x_rs6000_arch_flags; cur_opt = TREE_TARGET_OPTION (cur_tree); cur_flags = cur_opt->x_rs6000_isa_flags; - cur_arch = cur_opt->x_rs6000_arch_flags; diff_flags = (prev_flags ^ cur_flags); - diff_arch = (prev_arch ^ cur_arch); - if (diff_flags != 0 || diff_arch != 0) + if (diff_flags != 0) { /* Delete old macros. */ rs6000_target_modify_macros_ptr (false, - prev_flags & diff_flags, - prev_arch & diff_arch); + prev_flags & diff_flags); /* Define new macros. */ rs6000_target_modify_macros_ptr (true, - cur_flags & diff_flags, - cur_arch & diff_arch); + cur_flags & diff_flags); } } @@ -25153,7 +25090,6 @@ rs6000_function_specific_save (struct cl_target_option *ptr, { ptr->x_rs6000_isa_flags = opts->x_rs6000_isa_flags; ptr->x_rs6000_isa_flags_explicit = opts->x_rs6000_isa_flags_explicit; - ptr->x_rs6000_arch_flags = opts->x_rs6000_arch_flags; } /* Restore the current options */ @@ -25166,7 +25102,6 @@ rs6000_function_specific_restore (struct gcc_options *opts, { opts->x_rs6000_isa_flags = ptr->x_rs6000_isa_flags; opts->x_rs6000_isa_flags_explicit = ptr->x_rs6000_isa_flags_explicit; - opts->x_rs6000_arch_flags = ptr->x_rs6000_arch_flags; (void) rs6000_option_override_internal (false); } @@ -25177,12 +25112,10 @@ rs6000_function_specific_print (FILE *file, int indent, struct cl_target_option *ptr) { rs6000_print_isa_options (file, indent, "Isa options set", - ptr->x_rs6000_isa_flags, - ptr->x_rs6000_arch_flags); + ptr->x_rs6000_isa_flags); rs6000_print_isa_options (file, indent, "Isa options explicit", - ptr->x_rs6000_isa_flags_explicit, - ptr->x_rs6000_arch_flags); + ptr->x_rs6000_isa_flags_explicit); } /* Helper function to print the current isa or misc options on a line. */ @@ -25194,18 +25127,13 @@ rs6000_print_options_internal (FILE *file, HOST_WIDE_INT flags, const char *prefix, const struct rs6000_opt_mask *opts, - size_t num_elements, - HOST_WIDE_INT arch_flags, - const char *arch_prefix, - const struct rs6000_arch_mask *arch_masks, - size_t num_arch) + size_t num_elements) { size_t i; size_t start_column = 0; size_t cur_column; size_t max_column = 120; size_t prefix_len = strlen (prefix); - size_t arch_prefix_len = strlen (arch_prefix); size_t comma_len = 0; const char *comma = ""; @@ -25265,29 +25193,6 @@ rs6000_print_options_internal (FILE *file, comma_len = strlen (", "); } - /* Put out the architecture flag bits that are set via -mcpu=<xxx> and that - don't have a -m option. */ - for (i = 0; i < num_arch; i++) - { - if ((arch_flags & arch_masks[i].mask) != 0) - { - const char *name = arch_masks[i].name; - size_t len = comma_len + arch_prefix_len + strlen (name); - - cur_column += len; - if (cur_column > max_column) - { - fprintf (stderr, ", \\\n%*s", (int)start_column, ""); - cur_column = start_column + len; - comma = ""; - } - - fprintf (file, "%s%s%s", comma, arch_prefix, name); - comma = ", "; - comma_len = strlen (", "); - } - } - fputs ("\n", file); } @@ -25295,13 +25200,11 @@ rs6000_print_options_internal (FILE *file, static void rs6000_print_isa_options (FILE *file, int indent, const char *string, - HOST_WIDE_INT flags, HOST_WIDE_INT arch_flags) + HOST_WIDE_INT flags) { rs6000_print_options_internal (file, indent, string, flags, "-m", &rs6000_opt_masks[0], - ARRAY_SIZE (rs6000_opt_masks), - arch_flags, "arch=", &rs6000_arch_masks[0], - ARRAY_SIZE (rs6000_arch_masks)); + ARRAY_SIZE (rs6000_opt_masks)); } /* If the user used -mno-vsx, we need turn off all of the implicit ISA 2.06, @@ -25364,81 +25267,6 @@ rs6000_disable_incompatible_switches (void) return ignore_masks; } -/* In the past, we would boost up the ISA if you selected an -m<foo> option but - did not specify the correct -mcpu=<bar> option. I.e. if you added -mvsx, - GCC implictly would assume that you were building for at least power7. Now, - don't allow the -m<foo> option to boost up the ISA level. But you can still - do -mcpu=power7 -mno-vsx or -mcpu=power5 -mno-vsx. */ - -static void -report_architecture_mismatch (void) -{ - HOST_WIDE_INT ignore_masks = rs6000_disable_incompatible_switches (); - - static const struct { - const HOST_WIDE_INT isa_flags; /* -m<foo> optiona. */ - const HOST_WIDE_INT arch_flags; /* -mcpu=<proc> level. */ - const char *const arch_name; /* architecture needed. */ - } mismatches[] = { - { - OPTION_MASK_P9_VECTOR | OPTION_MASK_P9_MISC | OPTION_MASK_P9_MINMAX - | OPTION_MASK_MODULO, - ARCH_MASK_POWER9, - "-mcpu=power9" - }, - - { - OPTION_MASK_P8_VECTOR | OPTION_MASK_CRYPTO, - ARCH_MASK_POWER8, - "-mcpu=power8" - }, - - { - OPTION_MASK_VSX | OPTION_MASK_POPCNTD, - ARCH_MASK_POWER7, - "-mcpu=power7" - }, - }; - - HOST_WIDE_INT isa_flags = rs6000_isa_flags; - HOST_WIDE_INT arch_flags = rs6000_arch_flags; - - for (size_t i = 0; i < ARRAY_SIZE (mismatches); i++) - { - HOST_WIDE_INT mismatch_isa_flags = mismatches[i].isa_flags & isa_flags; - HOST_WIDE_INT mismatch_arch_flags = mismatches[i].arch_flags & arch_flags; - - if (mismatch_isa_flags != 0 && mismatch_arch_flags == 0) - { - for (size_t j = 0; j < ARRAY_SIZE (rs6000_opt_masks); j++) - { - HOST_WIDE_INT mask = rs6000_opt_masks[j].mask; - - if ((mask & mismatch_isa_flags) != 0 - && (mask & rs6000_isa_flags_explicit) != 0) - error ("%qs needs at least %qs", - rs6000_opt_masks[j].name, - mismatches[i].arch_name); - } - - rs6000_isa_flags &= ~mismatch_isa_flags; - } - } - - /* The following old options are used in multiple processors, so silently - enable the appropriate ISA options as previous GCC revisions did. */ - if (TARGET_DFP) - rs6000_isa_flags |= (ISA_2_5_MASKS_SERVER & ~ignore_masks); - else if (TARGET_CMPB) - rs6000_isa_flags |= (ISA_2_5_MASKS_EMBEDDED & ~ignore_masks); - else if (TARGET_FPRND) - rs6000_isa_flags |= (ISA_2_4_MASKS & ~ignore_masks); - else if (TARGET_POPCNTB) - rs6000_isa_flags |= (ISA_2_2_MASKS & ~ignore_masks); - else if (TARGET_ALTIVEC) - rs6000_isa_flags |= (OPTION_MASK_PPC_GFXOPT & ~ignore_masks); -} - /* Helper function for printing the function name when debugging. */ @@ -25466,7 +25294,7 @@ static int rs6000_clone_priority (tree fndecl) { tree fn_opts = DECL_FUNCTION_SPECIFIC_TARGET (fndecl); - HOST_WIDE_INT arch_masks; + HOST_WIDE_INT isa_masks; int ret = CLONE_DEFAULT; tree attrs = lookup_attribute ("target", DECL_ATTRIBUTES (fndecl)); const char *attrs_str = NULL; @@ -25482,12 +25310,12 @@ rs6000_clone_priority (tree fndecl) fn_opts = target_option_default_node; if (!fn_opts || !TREE_TARGET_OPTION (fn_opts)) - arch_masks = rs6000_arch_flags; + isa_masks = rs6000_isa_flags; else - arch_masks = TREE_TARGET_OPTION (fn_opts)->x_rs6000_arch_flags; + isa_masks = TREE_TARGET_OPTION (fn_opts)->x_rs6000_isa_flags; for (ret = CLONE_MAX - 1; ret != 0; ret--) - if ((rs6000_clone_map[ret].arch_mask & arch_masks) != 0) + if ((rs6000_clone_map[ret].isa_mask & isa_masks) != 0) break; } @@ -25967,8 +25795,6 @@ rs6000_can_inline_p (tree caller, tree callee) HOST_WIDE_INT callee_isa = callee_opts->x_rs6000_isa_flags; HOST_WIDE_INT caller_isa = caller_opts->x_rs6000_isa_flags; HOST_WIDE_INT explicit_isa = callee_opts->x_rs6000_isa_flags_explicit; - HOST_WIDE_INT callee_arch = callee_opts->x_rs6000_arch_flags; - HOST_WIDE_INT caller_arch = caller_opts->x_rs6000_arch_flags; cgraph_node *callee_node = cgraph_node::get (callee); if (ipa_fn_summaries && ipa_fn_summaries->get (callee_node) != NULL) @@ -25992,8 +25818,7 @@ rs6000_can_inline_p (tree caller, tree callee) callee has explicitly enabled or disabled, then we must enforce that the callee's and caller's options match exactly; see PR70010. */ if (((caller_isa & callee_isa) == callee_isa) - && (caller_isa & explicit_isa) == (callee_isa & explicit_isa) - && (caller_arch & callee_arch) == callee_arch) + && (caller_isa & explicit_isa) == (callee_isa & explicit_isa)) ret = true; if (TARGET_DEBUG_TARGET) diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index ccf6a4201542..703be908d944 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -520,12 +520,6 @@ extern int rs6000_vector_align[]; #define MASK_LITTLE_ENDIAN OPTION_MASK_LITTLE_ENDIAN #endif -/* In the past we represented power8, power10 as an ISA bit and used internal - switches the user was not supposed to use for -mpower8-internal and - -mpower10. Now we use architecture flags for this. */ -#define TARGET_POWER8 ((rs6000_arch_flags & ARCH_MASK_POWER8) != 0) -#define TARGET_POWER10 ((rs6000_arch_flags & ARCH_MASK_POWER10) != 0) - /* For power systems, we want to enable Altivec and VSX builtins even if the user did not use -maltivec or -mvsx to allow the builtins to be used inside of #pragma GCC target or the target attribute to change the code level for a diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt index 0d71dbaf2fc1..94323bd1db26 100644 --- a/gcc/config/rs6000/rs6000.opt +++ b/gcc/config/rs6000/rs6000.opt @@ -36,14 +36,6 @@ HOST_WIDE_INT rs6000_isa_flags_explicit TargetSave HOST_WIDE_INT x_rs6000_isa_flags_explicit -;; Arch bits that are set via -mcpu=<xxx> but don't have a user -m<processor> -;; option -Variable -HOST_WIDE_INT rs6000_arch_flags = 0 - -TargetSave -HOST_WIDE_INT x_rs6000_arch_flags - ;; Current processor TargetVariable enum processor_type rs6000_cpu = PROCESSOR_PPC603 @@ -478,8 +470,9 @@ Save the TOC in the prologue for indirect calls rather than inline. mvsx-timode Target RejectNegative Undocumented Ignore +;; This option exists only to create its MASK. It is not intended for users. mpower8-internal -Target Undocumented WarnRemoved +Target Undocumented Mask(POWER8) Var(rs6000_isa_flags) Warn(Do not use %<-mpower8-internal%>; use %<-mcpu=power8%> instead) mpower8-fusion Target Mask(P8_FUSION) Var(rs6000_isa_flags) @@ -590,7 +583,13 @@ mspeculate-indirect-jumps Target Undocumented Var(rs6000_speculate_indirect_jumps) Init(1) Save mpower10 -Target Undocumented WarnRemoved +Target Undocumented Mask(POWER10) Var(rs6000_isa_flags) WarnRemoved + +;; Users should not use -mpower11, but we need to use a bit to identify when +;; the user changes the default cpu via #pragma GCC target("cpu=power11") +;; and then resets it later. +mpower11 +Target Undocumented Mask(POWER11) Var(rs6000_isa_flags) WarnRemoved mprefixed Target Mask(PREFIXED) Var(rs6000_isa_flags) diff --git a/gcc/testsuite/gcc.target/powerpc/ppc-target-4.c b/gcc/testsuite/gcc.target/powerpc/ppc-target-4.c index 42f5aa354d0a..db9ba500e0e1 100644 --- a/gcc/testsuite/gcc.target/powerpc/ppc-target-4.c +++ b/gcc/testsuite/gcc.target/powerpc/ppc-target-4.c @@ -1,8 +1,8 @@ /* { dg-do compile { target { powerpc*-*-* } } } */ /* { dg-skip-if "" { powerpc*-*-darwin* } } */ /* { dg-require-effective-target powerpc_vsx_ok } */ -/* { dg-options "-O3 -ffast-math -mdejagnu-cpu=power5 -mno-altivec -mabi=altivec -fno-unroll-loops" } */ -/* { dg-final { scan-assembler-times "vaddfp" 2 } } */ +/* { dg-options "-O2 -ffast-math -mdejagnu-cpu=power5 -mno-altivec -mabi=altivec -fno-unroll-loops" } */ +/* { dg-final { scan-assembler-times "vaddfp" 1 } } */ /* { dg-final { scan-assembler-times "xvaddsp" 1 } } */ /* { dg-final { scan-assembler-times "fadds" 1 } } */ @@ -18,6 +18,10 @@ #error "__VSX__ should not be defined." #endif +#pragma GCC target("altivec,vsx") +#include <altivec.h> +#pragma GCC reset_options + #pragma GCC push_options #pragma GCC target("altivec,no-vsx") @@ -29,7 +33,6 @@ #error "__VSX__ should not be defined." #endif -/* Altivec build, generate vaddfp. */ void av_add (vector float *a, vector float *b, vector float *c) { @@ -37,11 +40,10 @@ av_add (vector float *a, vector float *b, vector float *c) unsigned long n = SIZE / 4; for (i = 0; i < n; i++) - a[i] = b[i] + c[i]; + a[i] = vec_add (b[i], c[i]); } -/* cpu=power7 must be used to enable VSX. */ -#pragma GCC target("cpu=power7,vsx") +#pragma GCC target("vsx") #ifndef __ALTIVEC__ #error "__ALTIVEC__ should be defined." @@ -51,7 +53,6 @@ av_add (vector float *a, vector float *b, vector float *c) #error "__VSX__ should be defined." #endif -/* VSX build on power7, generate xsaddsp. */ void vsx_add (vector float *a, vector float *b, vector float *c) { @@ -59,31 +60,11 @@ vsx_add (vector float *a, vector float *b, vector float *c) unsigned long n = SIZE / 4; for (i = 0; i < n; i++) - a[i] = b[i] + c[i]; -} - -#pragma GCC target("cpu=power7,no-vsx") - -#ifndef __ALTIVEC__ -#error "__ALTIVEC__ should be defined." -#endif - -#ifdef __VSX__ -#error "__VSX__ should not be defined." -#endif - -/* Altivec build on power7 with no VSX, generate vaddfp. */ -void -av2_add (vector float *a, vector float *b, vector float *c) -{ - unsigned long i; - unsigned long n = SIZE / 4; - - for (i = 0; i < n; i++) - a[i] = b[i] + c[i]; + a[i] = vec_add (b[i], c[i]); } #pragma GCC pop_options +#pragma GCC target("no-vsx,no-altivec") #ifdef __ALTIVEC__ #error "__ALTIVEC__ should not be defined." @@ -93,7 +74,6 @@ av2_add (vector float *a, vector float *b, vector float *c) #error "__VSX__ should not be defined." #endif -/* Default power5 build, generate scalar fadds. */ void norm_add (float *a, float *b, float *c) { diff --git a/gcc/testsuite/gcc.target/powerpc/pr115688.c b/gcc/testsuite/gcc.target/powerpc/pr115688.c index 00c7c301436a..5222e66ef170 100644 --- a/gcc/testsuite/gcc.target/powerpc/pr115688.c +++ b/gcc/testsuite/gcc.target/powerpc/pr115688.c @@ -7,8 +7,7 @@ /* Verify there is no ICE under 32 bit env. */ -/* cpu=power7 must be used to enable VSX. */ -__attribute__((target("cpu=power7,vsx"))) +__attribute__((target("vsx"))) int test (void) { return 0;