public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] rs6000: Add undocumented switch -mprefixed-addr
@ 2019-05-29 12:53 Bill Schmidt
  2019-05-29 13:21 ` Segher Boessenkool
  0 siblings, 1 reply; 8+ messages in thread
From: Bill Schmidt @ 2019-05-29 12:53 UTC (permalink / raw)
  To: GCC Patches; +Cc: Segher Boessenkool

Hi,

This patch adds the undocumented switch -mprefixed-addr and a little of the basic
infrastructure around it.  It also includes a couple of lines in the same code
regions to disable P8 fusion for -mcpu=future.

Bootstrapped and tested on powerpc64le-unknown-linux-gnu with no regressions.
Is this okay for trunk?

Thanks,
Bill


2019-05-28  Bill Schmidt  <wschmidt@linux.ibm.com>
	    Michael Meissner  <meissner@linux.ibm.com>

	* rs6000-cpus.def (OTHER_FUSION_MASKS): New #define.
	(ISA_FUTURE_MASKS_SERVER): Add OPTION_MASK_PREFIXED_ADDR. Mask off
	OTHER_FUSION_MASKS.
	(OTHER_FUTURE_MASKS): Add OPTION_MASK_PREFIXED_ADDR.
	(POWERPC_MASKS): Likewise.
	* rs6000.c (rs6000_option_override_internal): Error if
	-mprefixed-addr is specified without -mcpu=future. Error if
	-mpcrel is specified without -mprefixed-addr.
	(rs6000_opt_masks): Add entry for prefixed-addr.
	* rs6000.opt (mprefixed-addr): New option.


diff --git a/gcc/config/rs6000/rs6000-cpus.def b/gcc/config/rs6000/rs6000-cpus.def
index 5337382bdcf..2fb612a8401 100644
--- a/gcc/config/rs6000/rs6000-cpus.def
+++ b/gcc/config/rs6000/rs6000-cpus.def
@@ -72,13 +72,20 @@
 				 | OPTION_MASK_P9_VECTOR		\
 				 | OPTION_MASK_DIRECT_MOVE)
 
+/* ISA masks setting fusion options.  */
+#define OTHER_FUSION_MASKS	(OPTION_MASK_P8_FUSION			\
+				 | OPTION_MASK_P8_FUSION_SIGN)
+
 /* Support for a future processor's features.  */
-#define ISA_FUTURE_MASKS_SERVER	(ISA_3_0_MASKS_SERVER			\
-				 | OPTION_MASK_FUTURE			\
-				 | OPTION_MASK_PCREL)
+#define ISA_FUTURE_MASKS_SERVER	((ISA_3_0_MASKS_SERVER			\
+				  | OPTION_MASK_FUTURE			\
+				  | OPTION_MASK_PCREL			\
+				  | OPTION_MASK_PREFIXED_ADDR)		\
+				 & ~OTHER_FUSION_MASKS)
 
 /* Flags that need to be turned off if -mno-future.  */
-#define OTHER_FUTURE_MASKS	(OPTION_MASK_PCREL)
+#define OTHER_FUTURE_MASKS	(OPTION_MASK_PCREL			\
+				 | OPTION_MASK_PREFIXED_ADDR)
 
 /* Flags that need to be turned off if -mno-power9-vector.  */
 #define OTHER_P9_VECTOR_MASKS	(OPTION_MASK_FLOAT128_HW		\
@@ -139,6 +146,7 @@
 				 | OPTION_MASK_POWERPC64		\
 				 | OPTION_MASK_PPC_GFXOPT		\
 				 | OPTION_MASK_PPC_GPOPT		\
+				 | OPTION_MASK_PREFIXED_ADDR		\
 				 | OPTION_MASK_QUAD_MEMORY		\
 				 | OPTION_MASK_QUAD_MEMORY_ATOMIC	\
 				 | OPTION_MASK_RECIP_PRECISION		\
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index 9229bad6acc..1860b344c3a 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -4296,12 +4296,24 @@ rs6000_option_override_internal (bool global_init_p)
       rs6000_isa_flags &= ~OPTION_MASK_FLOAT128_HW;
     }
 
-  /* -mpcrel requires the prefixed load/store support on FUTURE systems.  */
-  if (!TARGET_FUTURE && TARGET_PCREL)
+  /* -mprefixed-addr and -mpcrel require the prefixed load/store support on
+     FUTURE systems.  */
+  if (!TARGET_FUTURE && (TARGET_PCREL || TARGET_PREFIXED_ADDR))
     {
       if ((rs6000_isa_flags_explicit & OPTION_MASK_PCREL) != 0)
 	error ("%qs requires %qs", "-mpcrel", "-mcpu=future");
 
+      else if ((rs6000_isa_flags_explicit & OPTION_MASK_PREFIXED_ADDR) != 0)
+	error ("%qs requires %qs", "-mprefixed-addr", "-mcpu=future");
+
+      rs6000_isa_flags &= ~(OPTION_MASK_PCREL | OPTION_MASK_PREFIXED_ADDR);
+    }
+
+  if (TARGET_PCREL && !TARGET_PREFIXED_ADDR)
+    {
+      if ((rs6000_isa_flags_explicit & OPTION_MASK_PCREL) != 0)
+	error ("%qs requires %qs", "-mpcrel", "-mprefixed-addr");
+
       rs6000_isa_flags &= ~OPTION_MASK_PCREL;
     }
 
@@ -36379,6 +36391,7 @@ static struct rs6000_opt_mask const rs6000_opt_masks[] =
   { "power9-vector",		OPTION_MASK_P9_VECTOR,		false, true  },
   { "powerpc-gfxopt",		OPTION_MASK_PPC_GFXOPT,		false, true  },
   { "powerpc-gpopt",		OPTION_MASK_PPC_GPOPT,		false, true  },
+  { "prefixed-addr",		OPTION_MASK_PREFIXED_ADDR,	false, true  },
   { "quad-memory",		OPTION_MASK_QUAD_MEMORY,	false, true  },
   { "quad-memory-atomic",	OPTION_MASK_QUAD_MEMORY_ATOMIC,	false, true  },
   { "recip-precision",		OPTION_MASK_RECIP_PRECISION,	false, true  },
diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt
index 43b04834746..3a4353674b8 100644
--- a/gcc/config/rs6000/rs6000.opt
+++ b/gcc/config/rs6000/rs6000.opt
@@ -574,6 +574,10 @@ mfuture
 Target Report Mask(FUTURE) Var(rs6000_isa_flags)
 Use instructions for a future architecture.
 
+mprefixed-addr
+Target Undocumented Mask(PREFIXED_ADDR) Var(rs6000_isa_flags)
+Generate (do not generate) prefixed memory instructions.
+
 mpcrel
 Target Report Mask(PCREL) Var(rs6000_isa_flags)
 Generate (do not generate) pc-relative memory addressing.

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

end of thread, other threads:[~2019-06-02 23:01 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-05-29 12:53 [PATCH] rs6000: Add undocumented switch -mprefixed-addr Bill Schmidt
2019-05-29 13:21 ` Segher Boessenkool
2019-05-29 21:25   ` Bill Schmidt
2019-05-29 22:00     ` Segher Boessenkool
2019-05-30  0:57       ` [PATCH v2] " Bill Schmidt
2019-05-30 15:14         ` Segher Boessenkool
2019-05-30 16:16     ` [PATCH] " Michael Meissner
2019-06-02 23:01       ` Segher Boessenkool

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).