+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>
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)
| 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)
#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;
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. */
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");