On 7/26/19 9:28 AM, Iain Sandoe wrote:
> The patch needs one small amendment  to succeed in bootstrap.
> I applied the amended to i686, x86_64 and powerpc Darwin with no apparent
> new problems.  From the Darwin perspective, the patch is OK with the 
> amendment.

Ok, thanks.  For completeness, I have included the final patch that I
committed below, incorporating your and Uros' suggested changes.
Thank you both!



>>> +#define DRIVER_SELF_SPECS \
>>> +  "%{mdejagnu-cpu=*: %<mcpu=* -mcpu=%*} \
>>> +   %{mdejagnu-tune=*: %<mtune=* -mtune=%*} \
>>> +   %{mdejagnu-*: %<mdejagnu-*}" \
>>> +   SUBTARGET_DRIVER_SELF_SPECS
> 
> NOTE (only a note): most of the driver self-specs that are more than a single 
> line
> seem to be written as comma-separated strings each containing a single spec.
> I am not sure what material difference that makes, and it doesn’t seem to 
> affect
> the functionality of your patch.  I also  asked Joseph on IRC yesterday and 
> he had
> no specific advice.

I see them used both ways, with and without the ','.  Playing around a little,
I see if you use ',' between clauses, then you also need to have each clause 
within
its own set of '"'s.  So "foo", "bar", "baz" etc. is fine, as is "foo bar baz", 
but
"foo, bar, baz" is not ok.  I guess it must have something to do with how we
scan the spec string.  Anyway, since the darwin SUBTARGET_DRIVER_SELF_SPECS
code uses ','s, I rewrote the rs6000.h DRIVER_SELF_SPECS that way too, so that
they're similar.

Peter

        PR target/91050
        * config/rs6000/rs6000.opt (mdejagnu-cpu=): Delete option.
        * config/rs6000/rs6000.c (rs6000_option_override_internal): Remove
        use of deleted rs6000_dejagnu_cpu_index variable.
        * config/rs6000/rs6000.h (DRIVER_SELF_SPECS): Define.
        (SUBTARGET_DRIVER_SELF_SPECS): Likewise.
        * config/darwin.h (DRIVER_SELF_SPECS): Rename from this ...
        (SUBTARGET_DRIVER_SELF_SPECS): ...to this.
        * config/i386/i386.h (DRIVER_SELF_SPECS): Define.
        (SUBTARGET_DRIVER_SELF_SPECS): Likewise.

Index: gcc/config/rs6000/rs6000.opt
===================================================================
--- gcc/config/rs6000/rs6000.opt        (revision 273940)
+++ gcc/config/rs6000/rs6000.opt        (revision 273941)
@@ -388,13 +388,6 @@ mtune=
 Target RejectNegative Joined Var(rs6000_tune_index) Init(-1) 
Enum(rs6000_cpu_opt_value) Save
 -mtune=        Schedule code for given CPU.
 
-; Only for use in the testsuite.  This simply overrides -mcpu=.  With older
-; versions of Dejagnu the command line arguments you set in RUNTESTFLAGS
-; override those set in the testcases; with this option, the testcase will
-; always win.
-mdejagnu-cpu=
-Target Undocumented RejectNegative Joined Var(rs6000_dejagnu_cpu_index) 
Init(-1) Enum(rs6000_cpu_opt_value) Save
-
 mtraceback=
 Target RejectNegative Joined Enum(rs6000_traceback_type) Var(rs6000_traceback)
 -mtraceback=[full,part,no]     Select type of traceback table.
Index: gcc/config/rs6000/rs6000.c
===================================================================
--- gcc/config/rs6000/rs6000.c  (revision 273940)
+++ gcc/config/rs6000/rs6000.c  (revision 273941)
@@ -3489,9 +3489,6 @@ rs6000_option_override_internal (bool gl
   /* Don't override by the processor default if given explicitly.  */
   set_masks &= ~rs6000_isa_flags_explicit;
 
-  if (global_init_p && rs6000_dejagnu_cpu_index >= 0)
-    rs6000_cpu_index = rs6000_dejagnu_cpu_index;
-
   /* Process the -mcpu=<xxx> and -mtune=<xxx> argument.  If the user changed
      the cpu in a target attribute or pragma, but did not specify a tuning
      option, use the cpu for the tuning option rather than the option specified
Index: gcc/config/rs6000/rs6000.h
===================================================================
--- gcc/config/rs6000/rs6000.h  (revision 273940)
+++ gcc/config/rs6000/rs6000.h  (revision 273941)
@@ -77,6 +77,20 @@
 #define PPC405_ERRATUM77 0
 #endif
 
+#ifndef SUBTARGET_DRIVER_SELF_SPECS
+# define SUBTARGET_DRIVER_SELF_SPECS ""
+#endif
+
+/* Only for use in the testsuite: -mdejagnu-cpu= simply overrides -mcpu=.
+   With older versions of Dejagnu the command line arguments you set in
+   RUNTESTFLAGS override those set in the testcases; with this option,
+   the testcase will always win.  Ditto for -mdejagnu-tune=.  */
+#define DRIVER_SELF_SPECS \
+  "%{mdejagnu-cpu=*: %<mcpu=* -mcpu=%*}", \
+  "%{mdejagnu-tune=*: %<mtune=* -mtune=%*}", \
+  "%{mdejagnu-*: %<mdejagnu-*}", \
+   SUBTARGET_DRIVER_SELF_SPECS
+
 #if CHECKING_P
 #define ASM_OPT_ANY ""
 #else
Index: gcc/config/darwin.h
===================================================================
--- gcc/config/darwin.h (revision 273940)
+++ gcc/config/darwin.h (revision 273941)
@@ -125,7 +125,8 @@ extern GTY(()) int darwin_ms_struct;
 
    However, a few can be handled and we can elide options that are silently-
    ignored defaults, plus warn on obsolete ones that no longer function.  */
-#define DRIVER_SELF_SPECS                                              \
+#undef SUBTARGET_DRIVER_SELF_SPECS
+#define SUBTARGET_DRIVER_SELF_SPECS                                    \
 "%{fapple-kext|mkernel:-static}",                                      \
 "%{gfull:-g -fno-eliminate-unused-debug-symbols} %<gfull",             \
 "%{gsplit-dwarf:%ngsplit-dwarf is not supported on this platform} \
Index: gcc/config/i386/i386.h
===================================================================
--- gcc/config/i386/i386.h      (revision 273940)
+++ gcc/config/i386/i386.h      (revision 273941)
@@ -677,6 +677,12 @@ extern tree x86_mfence;
    with the rounding mode forced to 53 bits.  */
 #define TARGET_96_ROUND_53_LONG_DOUBLE 0
 
+#ifndef SUBTARGET_DRIVER_SELF_SPECS
+# define SUBTARGET_DRIVER_SELF_SPECS ""
+#endif
+
+#define DRIVER_SELF_SPECS SUBTARGET_DRIVER_SELF_SPECS
+
 /* -march=native handling only makes sense with compiler running on
    an x86 or x86_64 chip.  If changing this condition, also change
    the condition in driver-i386.c.  */

Reply via email to