https://gcc.gnu.org/bugzilla/show_bug.cgi?id=80108

--- Comment #10 from kelvin at gcc dot gnu.org ---
FWIW, I tried another variant on the patch, which is shown below.  This variant
handles all of the p9-specific target options the same, as seen below:

Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c  (revision 246573)
+++ gcc/config/rs6000/rs6000.c  (working copy)
@@ -4273,8 +4273,32 @@ rs6000_option_override_internal (bool global_init_
   /* 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_DFORM_SCALAR
-      || TARGET_P9_DFORM_VECTOR || TARGET_P9_DFORM_BOTH > 0 ||
TARGET_P9_MINMAX)
-    rs6000_isa_flags |= (ISA_3_0_MASKS_SERVER & ~rs6000_isa_flags_explicit);
+      || TARGET_P9_DFORM_VECTOR || TARGET_P9_DFORM_BOTH > 0
+      || TARGET_P9_MINMAX)
+    {
+      if (have_cpu)
+       {
+         if (cpu_index == PROCESSOR_POWER9)
+           /* legacy behavior: allow -mcpu-power9 with certain capabilities
+              (eg -mno-vsx) explicitly disabled.  */
+           rs6000_isa_flags |=
+             (ISA_3_0_MASKS_SERVER & ~rs6000_isa_flags_explicit);
+         else
+           error ("Power9 target option is incompatible with -mcpu=<xxx> for "
+                  "<xxx> less than power9");
+       }
+#ifdef KELVIN_REMOVE
+      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 ("-mpower9-minmax incompatible with explicitly disabled
options");
+#endif
+      else
+       rs6000_isa_flags |= 
+         (ISA_3_0_MASKS_SERVER & ~rs6000_isa_flags_explicit);
+    }
   else if (TARGET_P8_VECTOR || TARGET_DIRECT_MOVE || TARGET_CRYPTO)
     rs6000_isa_flags |= (ISA_2_7_MASKS_SERVER & ~rs6000_isa_flags_explicit);
   else if (TARGET_VSX)

This variant also results in numerous regressions: 942 new fewer "expected
passes", 4 more "unexpected failures", 339 more "unsupported tests".

Reply via email to