From: Michael Meissner <meissner@linux.ibm.com>
To: Michael Meissner <meissner@linux.ibm.com>,
gcc-patches@gcc.gnu.org,
Segher Boessenkool <segher@kernel.crashing.org>,
David Edelsohn <dje.gcc@gmail.com>
Subject: [PATCH] V11 patch #6 of 15, Make -mpcrel the default for -mcpu=future on Linux 64-bit
Date: Sat, 21 Dec 2019 00:03:00 -0000 [thread overview]
Message-ID: <20191221000117.GF28993@ibm-toto.the-meissners.org> (raw)
In-Reply-To: <20191220231507.GA18386@ibm-toto.the-meissners.org>
This is the same as V10 patch #8. Once the vector extract patches are
committed, this patch flips the default to use PC-relative addressing on 64-bit
Linux systems when the uses -mcpu=future.
https://gcc.gnu.org/ml/gcc-patches/2019-12/msg00841.html
I have bootstrapped the compiler on a little endian power8 system and ran the
testsuite with no regressions. Once the preceeding V11 patches have been
checked in, can I check these patches into the trunk?
2019-12-20 Michael Meissner <meissner@linux.ibm.com>
* config/rs6000/linux64.h (PREFIXED_ADDR_SUPPORTED_BY_OS): Set to
1 to enable prefixed addressing if -mcpu=future.
(PCREL_SUPPORTED_BY_OS): Set to 1 to enable PC-relative addressing
if -mcpu=future.
* config/rs6000/rs6000-cpus.h (ISA_FUTURE_MASKS_SERVER): Do not
enable -mprefixed-addr or -mpcrel by default.
(ADDRESSING_FUTURE_MASKS): New macro.
(OTHER_FUTURE_MASKS): Use ADDRESSING_FUTURE_MASKS.
* config/rs6000/rs6000.c (PREFIXED_ADDR_SUPPORTED_BY_OS): Disable
prefixed addressing unless the target OS tm.h says we should
enable it.
(PCREL_SUPPORTED_BY_OS): Disable PC-relative addressing unless the
target OS tm.h says we should enable it.
(rs6000_debug_reg_global): Print whether prefixed addressing and
PC-relative addressing is enabled by default if -mcpu=future.
(rs6000_option_override_internal): Move setting prefixed
addressing and PC-relative addressing after the sub-target option
handling is done. Only enable prefixed addressing or PC-relative
address on -mcpu=future system if the target OS says to enable
it. Disallow prefixed addressing on 32-bit systems or if the
target object file is not ELF v2.
Index: gcc/config/rs6000/linux64.h
===================================================================
--- gcc/config/rs6000/linux64.h (revision 279141)
+++ 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 PREFIXED_ADDR_SUPPORTED_BY_OS
+#define PREFIXED_ADDR_SUPPORTED_BY_OS 1
+
+#undef PCREL_SUPPORTED_BY_OS
+#define PCREL_SUPPORTED_BY_OS 1
Index: gcc/config/rs6000/rs6000-cpus.def
===================================================================
--- gcc/config/rs6000/rs6000-cpus.def (revision 279141)
+++ gcc/config/rs6000/rs6000-cpus.def (working copy)
@@ -75,15 +75,22 @@
| 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, they are added if the target
+ OS tm.h says that it supports the addressing modes by default when
+ -mcpu=future is used. */
#define ISA_FUTURE_MASKS_SERVER (ISA_3_0_MASKS_SERVER \
- | OPTION_MASK_FUTURE \
+ | OPTION_MASK_FUTURE)
+
+/* Addressing related flags on a future processor. These are options that need
+ to be cleared if the target OS is not capable of supporting prefixed
+ addressing at all (such as 32-bit mode or if the object file format is not
+ ELF v2). */
+#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 279202)
+++ 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 PREFIXED_ADDR_SUPPORTED_BY_OS
+#define PREFIXED_ADDR_SUPPORTED_BY_OS 0
+#endif
+
+#ifndef PCREL_SUPPORTED_BY_OS
+#define PCREL_SUPPORTED_BY_OS 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, "PREFIXED_ADDR_SUPPORTED_BY_OS",
+ PREFIXED_ADDR_SUPPORTED_BY_OS);
+ fprintf (stderr, DEBUG_FMT_D, "PCREL_SUPPORTED_BY_OS",
+ PCREL_SUPPORTED_BY_OS);
+ }
}
\f
@@ -4015,26 +4033,6 @@ rs6000_option_override_internal (bool gl
rs6000_isa_flags &= ~OPTION_MASK_FLOAT128_HW;
}
- /* -mprefixed-addr (and hence -mpcrel) requires -mcpu=future. */
- if (TARGET_PREFIXED_ADDR && !TARGET_FUTURE)
- {
- 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);
- }
-
- /* -mpcrel requires prefixed load/store addressing. */
- 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;
- }
-
/* Print the options after updating the defaults. */
if (TARGET_DEBUG_REG || TARGET_DEBUG_TARGET)
rs6000_print_isa_options (stderr, 0, "after defaults", rs6000_isa_flags);
@@ -4166,12 +4164,91 @@ rs6000_option_override_internal (bool gl
SUB3TARGET_OVERRIDE_OPTIONS;
#endif
- /* -mpcrel requires -mcmodel=medium, but we can't check TARGET_CMODEL until
- after the subtarget override options are done. */
- if (TARGET_PCREL && TARGET_CMODEL != CMODEL_MEDIUM)
+ /* Enable prefixed addressing and PC-relative addressing if the target OS
+ tm.h file says that it is supported and the user did not explicitly use
+ -mprefixed-addr or -mpcrel. At the present time, only 64-bit Linux
+ enables this.
+
+ PC-relative support also requires the medium code model.
+
+ We can't check for ELFv2 or -mcmodel=medium until after the subtarget
+ macros are run.
+
+ If prefixed addressing is disabled by default, and the user does -mpcrel,
+ don't force them to also specify -mprefixed-addr. */
+ if (TARGET_FUTURE)
+ {
+ bool explicit_prefixed = ((rs6000_isa_flags_explicit
+ & OPTION_MASK_PREFIXED_ADDR) != 0);
+ bool explicit_pcrel = ((rs6000_isa_flags_explicit
+ & OPTION_MASK_PCREL) != 0);
+
+ /* Prefixed addressing requires 64-bit registers. */
+ if (!TARGET_POWERPC64)
+ {
+ if (TARGET_PCREL && explicit_pcrel)
+ error ("%qs requires %qs", "-mpcrel", "-m64");
+
+ else if (TARGET_PREFIXED_ADDR && explicit_prefixed)
+ error ("%qs requires %qs", "-mprefixed-addr", "-m64");
+
+ rs6000_isa_flags &= ~ADDRESSING_FUTURE_MASKS;
+ }
+
+ /* Only ELFv2 currently supports prefixed/pcrel addressing. */
+ else if (rs6000_current_abi != ABI_ELFv2)
+ {
+ if (TARGET_PCREL && explicit_pcrel)
+ error ("%qs requires %qs", "-mpcrel", "-mabi=elfv2");
+
+ else if (TARGET_PREFIXED_ADDR && explicit_prefixed)
+ error ("%qs requires %qs", "-mprefixed-addr", "-mabi=elfv2");
+
+ rs6000_isa_flags &= ~ADDRESSING_FUTURE_MASKS;
+ }
+
+ /* Enable defaults if desired. */
+ else
+ {
+ if (!explicit_prefixed
+ && (PREFIXED_ADDR_SUPPORTED_BY_OS
+ || TARGET_PCREL
+ || PCREL_SUPPORTED_BY_OS))
+ rs6000_isa_flags |= OPTION_MASK_PREFIXED_ADDR;
+
+ if (!explicit_pcrel && PCREL_SUPPORTED_BY_OS
+ && TARGET_PREFIXED_ADDR
+ && TARGET_CMODEL == CMODEL_MEDIUM)
+ rs6000_isa_flags |= OPTION_MASK_PCREL;
+ }
+
+ /* PC-relative requires the medium code model. */
+ if (TARGET_PCREL && TARGET_CMODEL != CMODEL_MEDIUM)
+ {
+ if ((rs6000_isa_flags_explicit & OPTION_MASK_PCREL) != 0)
+ error ("%qs requires %qs", "-mpcrel", "-mcmodel=medium");
+
+ rs6000_isa_flags &= ~OPTION_MASK_PCREL;
+ }
+
+ }
+
+ /* -mprefixed-addr (and hence -mpcrel) requires -mcpu=future. */
+ if (TARGET_PREFIXED_ADDR && !TARGET_FUTURE)
{
if ((rs6000_isa_flags_explicit & OPTION_MASK_PCREL) != 0)
- error ("%qs requires %qs", "-mpcrel", "-mcmodel=medium");
+ 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);
+ }
+
+ /* -mpcrel requires prefixed load/store addressing. */
+ 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;
}
--
Michael Meissner, IBM
IBM, M/S 2506R, 550 King Street, Littleton, MA 01460-6245, USA
email: meissner@linux.ibm.com, phone: +1 (978) 899-4797
next prev parent reply other threads:[~2019-12-21 0:01 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-12-20 23:15 PowerPC -mcpu=future patches, V11 Michael Meissner
2019-12-20 23:28 ` [PATCH] V11 patch #1 of 15, Fix bug in vec_extract Michael Meissner
2019-12-22 14:06 ` Segher Boessenkool
2019-12-20 23:47 ` [PATCH] V11 patch #2 of 15, Use prefixed load for vector extract with large offset Michael Meissner
2019-12-22 17:24 ` Segher Boessenkool
2020-01-07 1:41 ` [PATCH, committed] " Michael Meissner
2019-12-20 23:49 ` [PATCH] V11 patch #3 of 15, Use 'Q' constraint for variable vector extract from memory Michael Meissner
2019-12-22 17:49 ` Segher Boessenkool
2020-01-07 1:43 ` [PATCH, committed] " Michael Meissner
2019-12-20 23:56 ` [PATCH] V11 patch #4 of 15, Update 'Q' constraint documentation Michael Meissner
2019-12-22 20:02 ` Segher Boessenkool
2020-01-07 1:45 ` [PATCH, committed] " Michael Meissner
2019-12-21 0:00 ` [PATCH] V11 patch #5 of 15, Optimize vec_extract of a vector in memory with a PC-relative address Michael Meissner
2019-12-25 6:41 ` Segher Boessenkool
2020-01-06 20:55 ` Michael Meissner
2020-01-06 21:01 ` Michael Meissner
2020-01-07 1:48 ` [PATCH, committed] " Michael Meissner
2019-12-21 0:03 ` Michael Meissner [this message]
2019-12-21 0:06 ` [PATCH] V11 patch #7 of 15, Add new target_supports cases for -mcpu=future tests Michael Meissner
2019-12-21 0:11 ` [PATCH] V11 patch #8 of 15, Add new tests for using PADDI and PLI with -mcpu=future Michael Meissner
2019-12-21 0:12 ` [PATCH] V11 patch #9 of 15, Add test to validate generating prefixed memory when the offset is invalid for DS/DQ insns Michael Meissner
2019-12-21 0:22 ` [PATCH] V11 patch #10 of 15, Make sure we don't generate pre-modify prefixed insns with -mcpu=future Michael Meissner
2019-12-21 0:25 ` [PATCH] V11 patch #11 of 15, Add new tests for generating prefixed loads/stores on -mcpu=future with large offsets Michael Meissner
2019-12-21 0:25 ` [PATCH] V11 patch #12 of 15, Add new PC-relative tests for -mcpu=future Michael Meissner
2019-12-21 0:33 ` [PATCH] V11 patch #13 of 15, Add test for -mcpu=future -fstack-protect-strong with large stacks Michael Meissner
2019-12-21 1:23 ` [PATCH] V11 patch #14 of 15, Add tests for vec_extract from memory with PC-relative addrss Michael Meissner
2019-12-21 1:25 ` [PATCH] V11 patch #15 of 15, Add tests for -mcpu=future vec_extract from memory with a large offset Michael Meissner
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20191221000117.GF28993@ibm-toto.the-meissners.org \
--to=meissner@linux.ibm.com \
--cc=dje.gcc@gmail.com \
--cc=gcc-patches@gcc.gnu.org \
--cc=segher@kernel.crashing.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).