This patch will enable prefixed addressing and PC-relative addressing if the OS
target support indicates that the OS supports either prefixed addressing and
whether it supports PC-relative addressing when the user uses -mcpu=future. At
the moment, 64-bit Linux is the only system that enables both prefixed
addressing and PC-relative addressing.
I have built bootstrap compilers with this patch and there were no regressions
in the testsuite. In addition, during development, I set each of the two
options, and built a copiler with it, and I observed that the expected behavior
for the default of whether prefixed addressing an PC-relative support is
enabled. Can I check this into the FSF trunk?
2019-11-14 Michael Meissner
* config/rs6000/linux64.h (TARGET_PREFIXED_ADDR_DEFAULT): Enable
prefixed addressing by default.
(TARGET_PCREL_DEFAULT): Enable pc-relative addressing by default.
* config/rs6000/rs6000-cpus.def (ISA_FUTURE_MASKS_SERVER): Only
enable -mprefixed-addr and -mpcrel if the OS tm.h says to enable
it.
(ADDRESSING_FUTURE_MASKS): New mask macro.
(OTHER_FUTURE_MASKS): Use ADDRESSING_FUTURE_MASKS.
* config/rs6000/rs6000.c (TARGET_PREFIXED_ADDR_DEFAULT): Do not
enable -mprefixed-addr unless the OS tm.h says to.
(TARGET_PCREL_DEFAULT): Do not enable -mpcrel unless the OS tm.h
says to.
(rs6000_option_override_internal): Do not enable -mprefixed-addr
or -mpcrel unless the OS tm.h says to enable it. Add more checks
for -mcpu=future.
Index: gcc/config/rs6000/linux64.h
===
--- gcc/config/rs6000/linux64.h (revision 278173)
+++ gcc/config/rs6000/linux64.h (working copy)
@@ -640,3 +640,11 @@ extern int dot_symbols;
enabling the __float128 keyword. */
#undef TARGET_FLOAT128_ENABLE_TYPE
#define TARGET_FLOAT128_ENABLE_TYPE 1
+
+/* Enable support for pc-relative and numeric prefixed addressing on the
+ 'future' system. */
+#undef TARGET_PREFIXED_ADDR_DEFAULT
+#define TARGET_PREFIXED_ADDR_DEFAULT 1
+
+#undef TARGET_PCREL_DEFAULT
+#define TARGET_PCREL_DEFAULT 1
Index: gcc/config/rs6000/rs6000-cpus.def
===
--- gcc/config/rs6000/rs6000-cpus.def (revision 278173)
+++ gcc/config/rs6000/rs6000-cpus.def (working copy)
@@ -75,15 +75,21 @@
| OPTION_MASK_P8_VECTOR\
| OPTION_MASK_P9_VECTOR)
-/* Support for a future processor's features. Do not enable -mpcrel until it
- is fully functional. */
+/* Support for a future processor's features. The prefixed and pc-relative
+ addressing bits are not added here. Instead, rs6000.c adds them if the OS
+ tm.h says that it supports the addressing modes. */
#define ISA_FUTURE_MASKS_SERVER(ISA_3_0_MASKS_SERVER
\
-| OPTION_MASK_FUTURE \
+| OPTION_MASK_FUTURE)
+
+/* Addressing related flags on a future processor. These flags are broken out
+ because not all targets will support either pc-relative addressing, or even
+ prefixed addressing, and we want to clear all of the addressing bits
+ on targets that cannot support prefixed/pcrel addressing. */
+#define ADDRESSING_FUTURE_MASKS(OPTION_MASK_PCREL
\
| OPTION_MASK_PREFIXED_ADDR)
/* Flags that need to be turned off if -mno-future. */
-#define OTHER_FUTURE_MASKS (OPTION_MASK_PCREL \
-| OPTION_MASK_PREFIXED_ADDR)
+#define OTHER_FUTURE_MASKS ADDRESSING_FUTURE_MASKS
/* Flags that need to be turned off if -mno-power9-vector. */
#define OTHER_P9_VECTOR_MASKS (OPTION_MASK_FLOAT128_HW\
Index: gcc/config/rs6000/rs6000.c
===
--- gcc/config/rs6000/rs6000.c (revision 278181)
+++ gcc/config/rs6000/rs6000.c (working copy)
@@ -98,6 +98,16 @@
#endif
#endif
+/* Set up the defaults for whether prefixed addressing is used, and if it is
+ used, whether we want to turn on pc-relative support by default. */
+#ifndef TARGET_PREFIXED_ADDR_DEFAULT
+#define TARGET_PREFIXED_ADDR_DEFAULT 0
+#endif
+
+#ifndef TARGET_PCREL_DEFAULT
+#define TARGET_PCREL_DEFAULT 0
+#endif
+
/* Support targetm.vectorize.builtin_mask_for_load. */
GTY(()) tree altivec_builtin_mask_for_load;
@@ -2535,6 +2545,14 @@ rs6000_debug_reg_global (void)
if (TARGET_DIRECT_MOVE_128)
fprintf (stderr, DEBUG_FMT_D, "VSX easy 64-bit mfvsrld element",
(int)VECTOR_ELEMENT_MFVSRLD_64BIT);
+
+ if (TARGET_FUTURE)
+{
+ fprintf (stderr, DEBUG_FMT_D, "TARGET_PREFIXED_ADDR_DEFAULT",
+ TARGET_PREFIXED_ADDR_DEFAULT);
+ fprintf (stderr, DEBUG_FMT_D, "TAR