From: Michael Meissner <meissner@linux.ibm.com>
To: gcc-patches@gcc.gnu.org,
Segher Boessenkool <segher@kernel.crashing.org>,
David Edelsohn <dje.gcc@gmail.com>,
Michael Meissner <meissner@linux.ibm.com>
Subject: [PATCH], Make PowerPC -mcpu=future enable -mpcrel on linux ELFv2
Date: Fri, 27 Mar 2020 21:31:46 -0400 [thread overview]
Message-ID: <20200328013146.GA26011@ibm-tinman.the-meissners.org> (raw)
This is a revised version of the patch I posted on March 23rd. The changes are
to update the comments and improve the ChangeLog.
There were no regressions when I did the bootstrap and make check steps. I
verified that -mcpu=future does turn on -mprecl if you are targeting a Linux
ELF v2 system and use the medium code model. Can I check this into the master
branch?
2020-03-27 Michael Meissner <meissner@linux.ibm.com>
* config/rs6000/linux64.h (PCREL_SUPPORTED_BY_OS): New macro.
* config/rs6000/rs6000-cpus.def (ISA_FUTURE_MASKS_SERVER): Do not
set -mprefixed here.
* config/rs6000/rs6000.c (PCREL_SUPPORTED_BY_OS): New macro.
(rs6000_option_override_internal): Set the -mprefixed and -mpcrel
options for -mcpu=future if these options can be used.
--- /tmp/JVBhAf_linux64.h 2020-03-27 16:27:05.478619500 -0400
+++ gcc/config/rs6000/linux64.h 2020-03-27 16:21:56.268876616 -0400
@@ -640,3 +640,11 @@ extern int dot_symbols;
enabling the __float128 keyword. */
#undef TARGET_FLOAT128_ENABLE_TYPE
#define TARGET_FLOAT128_ENABLE_TYPE 1
+
+/* Enable default support for PC-relative addressing on the 'future' system if
+ we can use the PC-relative instructions. Currently this support only exits
+ for the ELF v2 object file format using the medium code model. */
+#undef PCREL_SUPPORTED_BY_OS
+#define PCREL_SUPPORTED_BY_OS (TARGET_FUTURE && TARGET_PREFIXED \
+ && ELFv2_ABI_CHECK \
+ && (TARGET_CMODEL == CMODEL_MEDIUM))
--- /tmp/KyQOUN_rs6000-cpus.def 2020-03-27 16:27:05.488619427 -0400
+++ gcc/config/rs6000/rs6000-cpus.def 2020-03-27 16:23:51.780030238 -0400
@@ -75,11 +75,11 @@
| 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. We do not set -mpcrel or
+ -mprefixed here. These bits are set in rs6000_option_override if the system
+ supports those options. */
#define ISA_FUTURE_MASKS_SERVER (ISA_3_0_MASKS_SERVER \
- | OPTION_MASK_FUTURE \
- | OPTION_MASK_PREFIXED)
+ | OPTION_MASK_FUTURE)
/* Flags that need to be turned off if -mno-future. */
#define OTHER_FUTURE_MASKS (OPTION_MASK_PCREL \
--- /tmp/z4Mwhm_rs6000.c 2020-03-27 16:27:05.500619340 -0400
+++ gcc/config/rs6000/rs6000.c 2020-03-27 16:20:13.066641659 -0400
@@ -98,6 +98,12 @@
#endif
#endif
+/* Set up the defaults for whether PC-relative addressing is supported by the
+ target system. */
+#ifndef PCREL_SUPPORTED_BY_OS
+#define PCREL_SUPPORTED_BY_OS 0
+#endif
+
/* Support targetm.vectorize.builtin_mask_for_load. */
tree altivec_builtin_mask_for_load;
@@ -4014,6 +4020,11 @@ rs6000_option_override_internal (bool gl
rs6000_isa_flags &= ~OPTION_MASK_FLOAT128_HW;
}
+ /* Enable -mprefixed by default on 64-bit 'future' systems. */
+ if (TARGET_FUTURE && TARGET_POWERPC64
+ && (rs6000_isa_flags_explicit & OPTION_MASK_PREFIXED) == 0)
+ rs6000_isa_flags |= OPTION_MASK_PREFIXED;
+
/* -mprefixed (and hence -mpcrel) requires -mcpu=future. */
if (TARGET_PREFIXED && !TARGET_FUTURE)
{
@@ -4175,6 +4186,11 @@ rs6000_option_override_internal (bool gl
rs6000_isa_flags &= ~OPTION_MASK_PCREL;
}
+ /* If the OS has support for PC-relative relocations, enable it now. */
+ if (PCREL_SUPPORTED_BY_OS
+ && (rs6000_isa_flags_explicit & OPTION_MASK_PCREL) == 0)
+ rs6000_isa_flags |= OPTION_MASK_PCREL;
+
if (TARGET_DEBUG_REG || TARGET_DEBUG_TARGET)
rs6000_print_isa_options (stderr, 0, "after subtarget", rs6000_isa_flags);
--
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 reply other threads:[~2020-03-28 1:32 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-03-28 1:31 Michael Meissner [this message]
2020-03-30 17:50 ` will schmidt
2020-03-30 22:51 ` Segher Boessenkool
2020-04-01 19:16 ` Michael Meissner
2020-04-01 21:36 ` Segher Boessenkool
2020-04-01 23:11 ` Michael Meissner
2020-04-02 19:27 ` Segher Boessenkool
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=20200328013146.GA26011@ibm-tinman.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).