public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH, rs6000] Fix PR91050 by adding a DRIVER_SELF_SPECS spec
@ 2019-07-25  5:08 Peter Bergner
  2019-07-25  7:59 ` Iain Sandoe
  0 siblings, 1 reply; 11+ messages in thread
From: Peter Bergner @ 2019-07-25  5:08 UTC (permalink / raw)
  To: GCC Patches; +Cc: Segher Boessenkool

The -mdejagnu-cpu= option was added as a way for a test case to ensure a
particular -mcpu= option is used to compile the test, regardless of whether
the user attempts to override it (purposely or accidentally) via RUNTESTFLAGS.
This was well and good, but the ASM_CPU_SPEC was not updated to handle
-mdejagnu-cpu=, so the option passed to the assembler is only determined
by -mcpu=, even if that is overridden by -mdejagnu-cpu=.  This can cause
cases of using the wrong assembler option.

We could just add -mdejagnu-cpu= support to ASM_CPU_SPEC, but that spec entry
is already WAY too huge and ugly and to add support for -mdejagnu-cpu=, we'd
have to essentially double the size of that spec.  The patch below takes
a different approach and removes Segher's original patch altogether and
instead implements -mdejagnu-cpu= using a DRIVER_SELF_SPECS spec which
simplifies things by not even needing to touch ASM_CPU_SPEC.  I also added
support for -mdejagnu-tune=, even though we don't have any test cases
at the moment that use it, since it was easy to add.

Segher, I tried your suggestion of writing the spec more generically
(ie, %{mdejagnu-*: ... -m*}), which worked in that it did the correct
replacement.  However, the %<m... hunk to strip the overridden -mcpu=
option(s) would need to be written like %<m%* and that does not work
at all.

This passed bootstrap and regtesting with no errors on powerpc64le-linux.
Ok for trunk?

Peter

gcc/
	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.

Index: gcc/config/rs6000/rs6000.opt
===================================================================
--- gcc/config/rs6000/rs6000.opt	(revision 273707)
+++ gcc/config/rs6000/rs6000.opt	(working copy)
@@ -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 273707)
+++ gcc/config/rs6000/rs6000.c	(working copy)
@@ -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 273707)
+++ gcc/config/rs6000/rs6000.h	(working copy)
@@ -77,6 +77,15 @@
 #define PPC405_ERRATUM77 0
 #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-*}"
+
 #if CHECKING_P
 #define ASM_OPT_ANY ""
 #else

^ permalink raw reply	[flat|nested] 11+ messages in thread

end of thread, other threads:[~2019-07-31 17:34 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-07-25  5:08 [PATCH, rs6000] Fix PR91050 by adding a DRIVER_SELF_SPECS spec Peter Bergner
2019-07-25  7:59 ` Iain Sandoe
2019-07-25 14:42   ` Peter Bergner
2019-07-25 14:52     ` Iain Sandoe
2019-07-25 15:27     ` Segher Boessenkool
2019-07-25 18:08     ` Peter Bergner
2019-07-26 14:32       ` Iain Sandoe
2019-07-31 17:56         ` Peter Bergner
2019-07-30 13:10       ` Uros Bizjak
2019-07-30 16:19         ` Peter Bergner
2019-07-30 18:17           ` Uros Bizjak

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).