public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc/devel/gccgo] Turn on -mpcrel by default for -mcpu=future
@ 2020-07-12 17:33 Ian Lance Taylor
0 siblings, 0 replies; only message in thread
From: Ian Lance Taylor @ 2020-07-12 17:33 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:da4aae6e16f2755161b148d110edbf8ed8589acc
commit da4aae6e16f2755161b148d110edbf8ed8589acc
Author: Michael Meissner <2019-02-12 Michael Meissner meissner@linux.ibm.com>
Date: Sat Apr 25 02:43:10 2020 -0400
Turn on -mpcrel by default for -mcpu=future
2020-04-25 Michael Meissner <meissner@linux.ibm.com>
* config/rs6000/linux64.h (PCREL_SUPPORTED_BY_OS): Define to
enable PC-relative addressing for -mcpu=future.
* config/rs6000/rs6000-cpus.def (ISA_FUTURE_MASKS_SERVER): Move
after OTHER_FUTURE_MASKS. Use OTHER_FUTURE_MASKS.
* config/rs6000/rs6000.c (PCREL_SUPPORTED_BY_OS): If not defined,
suppress PC-relative addressing.
(rs6000_option_override_internal): Split up error messages
checking for -mprefixed and -mpcrel. Enable -mpcrel if the target
system supports it.
Diff:
---
gcc/ChangeLog | 12 ++++++++++++
gcc/config/rs6000/linux64.h | 7 +++++++
gcc/config/rs6000/rs6000-cpus.def | 11 +++++------
gcc/config/rs6000/rs6000.c | 28 +++++++++++++++++++++-------
4 files changed, 45 insertions(+), 13 deletions(-)
diff --git a/gcc/ChangeLog b/gcc/ChangeLog
index 3c0d67b206f..3d91fcd1cad 100644
--- a/gcc/ChangeLog
+++ b/gcc/ChangeLog
@@ -1,3 +1,15 @@
+2020-04-25 Michael Meissner <meissner@linux.ibm.com>
+
+ * config/rs6000/linux64.h (PCREL_SUPPORTED_BY_OS): Define to
+ enable PC-relative addressing for -mcpu=future.
+ * config/rs6000/rs6000-cpus.def (ISA_FUTURE_MASKS_SERVER): Move
+ after OTHER_FUTURE_MASKS. Use OTHER_FUTURE_MASKS.
+ * config/rs6000/rs6000.c (PCREL_SUPPORTED_BY_OS): If not defined,
+ suppress PC-relative addressing.
+ (rs6000_option_override_internal): Split up error messages
+ checking for -mprefixed and -mpcrel. Enable -mpcrel if the target
+ system supports it.
+
2020-04-25 Jakub Jelinek <jakub@redhat.com>
Richard Biener <rguenther@suse.de>
diff --git a/gcc/config/rs6000/linux64.h b/gcc/config/rs6000/linux64.h
index 11911c4966a..34776c8421e 100644
--- a/gcc/config/rs6000/linux64.h
+++ b/gcc/config/rs6000/linux64.h
@@ -640,3 +640,10 @@ extern int dot_symbols;
enabling the __float128 keyword. */
#undef TARGET_FLOAT128_ENABLE_TYPE
#define TARGET_FLOAT128_ENABLE_TYPE 1
+
+/* Enable using prefixed PC-relative addressing on the 'future' machine if the
+ ABI supports it. The ELF v2 ABI only supports PC-relative relocations for
+ the medium code model. */
+#define PCREL_SUPPORTED_BY_OS (TARGET_FUTURE && TARGET_PREFIXED \
+ && ELFv2_ABI_CHECK \
+ && TARGET_CMODEL == CMODEL_MEDIUM)
diff --git a/gcc/config/rs6000/rs6000-cpus.def b/gcc/config/rs6000/rs6000-cpus.def
index ff1db6019de..83362e05b10 100644
--- a/gcc/config/rs6000/rs6000-cpus.def
+++ b/gcc/config/rs6000/rs6000-cpus.def
@@ -75,16 +75,15 @@
| OPTION_MASK_P8_VECTOR \
| OPTION_MASK_P9_VECTOR)
-/* Support for a future processor's features. Do not enable -mpcrel until it
- is fully functional. */
-#define ISA_FUTURE_MASKS_SERVER (ISA_3_0_MASKS_SERVER \
- | OPTION_MASK_FUTURE \
- | OPTION_MASK_PREFIXED)
-
/* Flags that need to be turned off if -mno-future. */
#define OTHER_FUTURE_MASKS (OPTION_MASK_PCREL \
| OPTION_MASK_PREFIXED)
+/* Support for a future processor's features. */
+#define ISA_FUTURE_MASKS_SERVER (ISA_3_0_MASKS_SERVER \
+ | OPTION_MASK_FUTURE \
+ | OTHER_FUTURE_MASKS)
+
/* Flags that need to be turned off if -mno-power9-vector. */
#define OTHER_P9_VECTOR_MASKS (OPTION_MASK_FLOAT128_HW \
| OPTION_MASK_P9_MINMAX)
diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index a2992e682c8..aa632ea8f4a 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -98,6 +98,11 @@
#endif
#endif
+/* Don't enable PC-relative addressing if the target does not support it. */
+#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;
@@ -4024,15 +4029,17 @@ rs6000_option_override_internal (bool global_init_p)
rs6000_isa_flags &= ~OPTION_MASK_FLOAT128_HW;
}
- /* -mprefixed (and hence -mpcrel) requires -mcpu=future. */
- if (TARGET_PREFIXED && !TARGET_FUTURE)
+ /* Enable -mprefixed by default on 'future' systems. */
+ if (TARGET_FUTURE && (rs6000_isa_flags_explicit & OPTION_MASK_PREFIXED) == 0)
+ rs6000_isa_flags |= OPTION_MASK_PREFIXED;
+
+ /* -mprefixed requires -mcpu=future. */
+ else if (TARGET_PREFIXED && !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) != 0)
+ if ((rs6000_isa_flags_explicit & OPTION_MASK_PREFIXED) != 0)
error ("%qs requires %qs", "-mprefixed", "-mcpu=future");
- rs6000_isa_flags &= ~(OPTION_MASK_PCREL | OPTION_MASK_PREFIXED);
+ rs6000_isa_flags &= ~OPTION_MASK_PREFIXED;
}
/* -mpcrel requires prefixed load/store addressing. */
@@ -4175,9 +4182,16 @@ rs6000_option_override_internal (bool global_init_p)
SUB3TARGET_OVERRIDE_OPTIONS;
#endif
+ /* If the ABI has support for PC-relative relocations, enable it by default.
+ This test depends on the sub-target tests above setting the code model to
+ medium for ELF v2 systems. */
+ if (PCREL_SUPPORTED_BY_OS
+ && (rs6000_isa_flags_explicit & OPTION_MASK_PCREL) == 0)
+ rs6000_isa_flags |= OPTION_MASK_PCREL;
+
/* -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)
+ else if (TARGET_PCREL && TARGET_CMODEL != CMODEL_MEDIUM)
{
if ((rs6000_isa_flags_explicit & OPTION_MASK_PCREL) != 0)
error ("%qs requires %qs", "-mpcrel", "-mcmodel=medium");
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-07-12 17:33 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-07-12 17:33 [gcc/devel/gccgo] Turn on -mpcrel by default for -mcpu=future Ian Lance Taylor
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).