Commit da4aae6e by Michael Meissner

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.
parent 35281187
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> 2020-04-25 Jakub Jelinek <jakub@redhat.com>
Richard Biener <rguenther@suse.de> Richard Biener <rguenther@suse.de>
......
...@@ -640,3 +640,10 @@ extern int dot_symbols; ...@@ -640,3 +640,10 @@ extern int dot_symbols;
enabling the __float128 keyword. */ enabling the __float128 keyword. */
#undef TARGET_FLOAT128_ENABLE_TYPE #undef TARGET_FLOAT128_ENABLE_TYPE
#define TARGET_FLOAT128_ENABLE_TYPE 1 #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)
...@@ -75,16 +75,15 @@ ...@@ -75,16 +75,15 @@
| OPTION_MASK_P8_VECTOR \ | OPTION_MASK_P8_VECTOR \
| OPTION_MASK_P9_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. */ /* 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) | 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. */ /* Flags that need to be turned off if -mno-power9-vector. */
#define OTHER_P9_VECTOR_MASKS (OPTION_MASK_FLOAT128_HW \ #define OTHER_P9_VECTOR_MASKS (OPTION_MASK_FLOAT128_HW \
| OPTION_MASK_P9_MINMAX) | OPTION_MASK_P9_MINMAX)
......
...@@ -98,6 +98,11 @@ ...@@ -98,6 +98,11 @@
#endif #endif
#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. */ /* Support targetm.vectorize.builtin_mask_for_load. */
tree altivec_builtin_mask_for_load; tree altivec_builtin_mask_for_load;
...@@ -4024,15 +4029,17 @@ rs6000_option_override_internal (bool global_init_p) ...@@ -4024,15 +4029,17 @@ rs6000_option_override_internal (bool global_init_p)
rs6000_isa_flags &= ~OPTION_MASK_FLOAT128_HW; rs6000_isa_flags &= ~OPTION_MASK_FLOAT128_HW;
} }
/* -mprefixed (and hence -mpcrel) requires -mcpu=future. */ /* Enable -mprefixed by default on 'future' systems. */
if (TARGET_PREFIXED && !TARGET_FUTURE) 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) if ((rs6000_isa_flags_explicit & OPTION_MASK_PREFIXED) != 0)
error ("%qs requires %qs", "-mpcrel", "-mcpu=future");
else if ((rs6000_isa_flags_explicit & OPTION_MASK_PREFIXED) != 0)
error ("%qs requires %qs", "-mprefixed", "-mcpu=future"); 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. */ /* -mpcrel requires prefixed load/store addressing. */
...@@ -4175,9 +4182,16 @@ rs6000_option_override_internal (bool global_init_p) ...@@ -4175,9 +4182,16 @@ rs6000_option_override_internal (bool global_init_p)
SUB3TARGET_OVERRIDE_OPTIONS; SUB3TARGET_OVERRIDE_OPTIONS;
#endif #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 /* -mpcrel requires -mcmodel=medium, but we can't check TARGET_CMODEL until
after the subtarget override options are done. */ 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) if ((rs6000_isa_flags_explicit & OPTION_MASK_PCREL) != 0)
error ("%qs requires %qs", "-mpcrel", "-mcmodel=medium"); error ("%qs requires %qs", "-mpcrel", "-mcmodel=medium");
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment