From 31a07c8102fa4a7e44118bdacda5f8577ca7218e Mon Sep 17 00:00:00 2001 From: Michael Meissner Date: Fri, 14 Apr 2017 20:27:18 +0000 Subject: [PATCH] re PR target/80098 (ICE in curr_insn_transform, at lra-constraints.c:3816 on ppc64le) [gcc] 2017-04-14 Michael Meissner PR target/80098 * config/rs6000/rs6000-cpus.def (OTHER_P9_VECTOR_MASKS): Define masks of options that should be turned off if the VSX vector options are turned off. (OTHER_P8_VECTOR_MASKS): Likewise. (OTHER_VSX_VECTOR_MASKS): Likewise. * config/rs6000/rs6000.c (rs6000_option_override_internal): Call rs6000_disable_incompatible_switches to validate no type switches like -mvsx. (rs6000_incompatible_switch): New function to disallow turning on other vector options if -mno-vsx, -mno-power8-vector, or -mno-power9-vector are specified. [gcc/testsuite] 2017-04-14 Michael Meissner PR target/80098 * gcc.target/powerpc/pr80098-1.c: New test. * gcc.target/powerpc/pr80098-2.c: Likewise. * gcc.target/powerpc/pr80098-3.c: Likewise. * gcc.target/powerpc/pr80098-4.c: Likewise. From-SVN: r246930 --- gcc/ChangeLog | 15 +++ gcc/config/rs6000/rs6000-cpus.def | 24 +++++ gcc/config/rs6000/rs6000.c | 107 ++++++++++++++++--- gcc/testsuite/ChangeLog | 8 ++ gcc/testsuite/gcc.target/powerpc/pr80098-1.c | 9 ++ gcc/testsuite/gcc.target/powerpc/pr80098-2.c | 9 ++ gcc/testsuite/gcc.target/powerpc/pr80098-3.c | 9 ++ gcc/testsuite/gcc.target/powerpc/pr80098-4.c | 8 ++ 8 files changed, 176 insertions(+), 13 deletions(-) create mode 100644 gcc/testsuite/gcc.target/powerpc/pr80098-1.c create mode 100644 gcc/testsuite/gcc.target/powerpc/pr80098-2.c create mode 100644 gcc/testsuite/gcc.target/powerpc/pr80098-3.c create mode 100644 gcc/testsuite/gcc.target/powerpc/pr80098-4.c diff --git a/gcc/ChangeLog b/gcc/ChangeLog index 5cf927dac7b..719974bb742 100644 --- a/gcc/ChangeLog +++ b/gcc/ChangeLog @@ -1,3 +1,18 @@ +2017-04-14 Michael Meissner + + PR target/80098 + * config/rs6000/rs6000-cpus.def (OTHER_P9_VECTOR_MASKS): Define + masks of options that should be turned off if the VSX vector + options are turned off. + (OTHER_P8_VECTOR_MASKS): Likewise. + (OTHER_VSX_VECTOR_MASKS): Likewise. + * config/rs6000/rs6000.c (rs6000_option_override_internal): Call + rs6000_disable_incompatible_switches to validate no type switches + like -mvsx. + (rs6000_incompatible_switch): New function to disallow turning on + other vector options if -mno-vsx, -mno-power8-vector, or + -mno-power9-vector are specified. + 2017-04-14 Claudiu Zissulescu * config/arc/arc.h (CRT_CALL_STATIC_FUNCTION): Use long calls. diff --git a/gcc/config/rs6000/rs6000-cpus.def b/gcc/config/rs6000/rs6000-cpus.def index 8ce91473470..cd5c70688d8 100644 --- a/gcc/config/rs6000/rs6000-cpus.def +++ b/gcc/config/rs6000/rs6000-cpus.def @@ -84,6 +84,30 @@ | OPTION_MASK_UPPER_REGS_SF \ | OPTION_MASK_VSX_SMALL_INTEGER) +/* Flags that need to be turned off if -mno-power9-vector. */ +#define OTHER_P9_VECTOR_MASKS (OPTION_MASK_FLOAT128_HW \ + | OPTION_MASK_P9_DFORM_SCALAR \ + | OPTION_MASK_P9_DFORM_VECTOR \ + | OPTION_MASK_P9_MINMAX) + +/* Flags that need to be turned off if -mno-power8-vector. */ +#define OTHER_P8_VECTOR_MASKS (OTHER_P9_VECTOR_MASKS \ + | OPTION_MASK_P9_VECTOR \ + | OPTION_MASK_DIRECT_MOVE \ + | OPTION_MASK_CRYPTO \ + | OPTION_MASK_UPPER_REGS_SF) \ + +/* Flags that need to be turned off if -mno-vsx. */ +#define OTHER_VSX_VECTOR_MASKS (OTHER_P8_VECTOR_MASKS \ + | OPTION_MASK_EFFICIENT_UNALIGNED_VSX \ + | OPTION_MASK_FLOAT128_KEYWORD \ + | OPTION_MASK_FLOAT128_TYPE \ + | OPTION_MASK_P8_VECTOR \ + | OPTION_MASK_UPPER_REGS_DI \ + | OPTION_MASK_UPPER_REGS_DF \ + | OPTION_MASK_VSX_SMALL_INTEGER \ + | OPTION_MASK_VSX_TIMODE) + #define POWERPC_7400_MASK (OPTION_MASK_PPC_GFXOPT | OPTION_MASK_ALTIVEC) /* Deal with ports that do not have -mstrict-align. */ diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index d34c19d71f2..0fd2365ecf3 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -1335,6 +1335,7 @@ static void rs6000_print_isa_options (FILE *, int, const char *, HOST_WIDE_INT); static void rs6000_print_builtin_options (FILE *, int, const char *, HOST_WIDE_INT); +static HOST_WIDE_INT rs6000_disable_incompatible_switches (void); static enum rs6000_reg_type register_to_reg_type (rtx, bool *); static bool rs6000_secondary_reload_move (enum rs6000_reg_type, @@ -3902,6 +3903,7 @@ rs6000_option_override_internal (bool global_init_p) const char *implicit_cpu = OPTION_TARGET_CPU_DEFAULT; HOST_WIDE_INT set_masks; + HOST_WIDE_INT ignore_masks; int cpu_index; int tune_index; struct cl_target_option *main_target_opt @@ -3967,7 +3969,8 @@ rs6000_option_override_internal (bool global_init_p) #endif #ifdef OS_MISSING_ALTIVEC if (OS_MISSING_ALTIVEC) - set_masks &= ~(OPTION_MASK_ALTIVEC | OPTION_MASK_VSX); + set_masks &= ~(OPTION_MASK_ALTIVEC | OPTION_MASK_VSX + | OTHER_VSX_VECTOR_MASKS); #endif /* Don't override by the processor default if given explicitly. */ @@ -4270,11 +4273,15 @@ rs6000_option_override_internal (bool global_init_p) if (TARGET_DEBUG_REG || TARGET_DEBUG_TARGET) rs6000_print_isa_options (stderr, 0, "before defaults", rs6000_isa_flags); + /* Handle explicit -mno-{altivec,vsx,power8-vector,power9-vector} 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-