From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1005) id 54E793851C24; Wed, 24 Mar 2021 19:58:34 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 54E793851C24 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: Michael Meissner To: gcc-cvs@gcc.gnu.org Subject: [gcc(refs/users/meissner/heads/work042)] Revert patch. X-Act-Checkin: gcc X-Git-Author: Michael Meissner X-Git-Refname: refs/users/meissner/heads/work042 X-Git-Oldrev: ede097698da974dfee5d3d58089ee479a1c72159 X-Git-Newrev: 79f33bdff8d237f2c82e09091e13129cc180d324 Message-Id: <20210324195834.54E793851C24@sourceware.org> Date: Wed, 24 Mar 2021 19:58:34 +0000 (GMT) X-BeenThere: gcc-cvs@gcc.gnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Gcc-cvs mailing list List-Unsubscribe: , List-Archive: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 24 Mar 2021 19:58:34 -0000 https://gcc.gnu.org/g:79f33bdff8d237f2c82e09091e13129cc180d324 commit 79f33bdff8d237f2c82e09091e13129cc180d324 Author: Michael Meissner Date: Wed Mar 24 15:58:07 2021 -0400 Revert patch. Do not enable __float128 or __ibm128 support on Fortran, PR 96983 This patch does not create the internal types for __float128 and __ibm128 on Fortran which cannot use them. This in turn allows us to set the type precision for long double to be 128, which Fortran wants. gcc/ 2021-03-23 Michael Meissner Revert patch. PR fortran/96983 * config/rs6000/rs6000.c (rs6000_debug_reg_global): Add more debugging for __float128, __ibm128 support. (rs6000_option_override_internal): Do not enable __float128 and __ibm128 support for Fortran. On Fortran, make the default long double precision to be 128. Add error messages if the user tries to change the long double type between IBM/IEEE on Fortran. (rs6000_init_libfuncs): Do not enable __ibm128 support if it is disabled. * config/rs6000/rs6000.h (FLOAT128_IBM_P): Do not return true if __ibm128 was disabled for IFmode/ICmode. (TARGET_IBM128): Move this to rs6000.opt. * config/rs6000/rs6000.md (FP iterator): Do not enable IF mode if __ibm128 is disabled. (FLOAT128 iterator): Likewise. * config/rs6000/rs6000.opt (x_TARGET_IBM128): New variables to record whether __ibm128 is supported or not. (TARGET_IBM128): Likewise. Diff: --- gcc/config/rs6000/rs6000.c | 92 +++++++++++--------------------------------- gcc/config/rs6000/rs6000.h | 9 ++++- gcc/config/rs6000/rs6000.md | 4 +- gcc/config/rs6000/rs6000.opt | 7 ---- 4 files changed, 31 insertions(+), 81 deletions(-) diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c index c3d280b0874..db215810aa6 100644 --- a/gcc/config/rs6000/rs6000.c +++ b/gcc/config/rs6000/rs6000.c @@ -2551,11 +2551,6 @@ rs6000_debug_reg_global (void) TARGET_IEEEQUAD ? "IEEE" : "IBM"); fprintf (stderr, DEBUG_FMT_S, "default long double type", TARGET_IEEEQUAD_DEFAULT ? "IEEE" : "IBM"); - if (TARGET_FLOAT128_TYPE) - fprintf (stderr, DEBUG_FMT_S, "IEEE 128-bit support", - TARGET_FLOAT128_KEYWORD ? "keyword" : "type"); - if (TARGET_IBM128) - fprintf (stderr, DEBUG_FMT_S, "__ibm128 keyword", "true"); } fprintf (stderr, DEBUG_FMT_D, "sched_restricted_insns_priority", (int)rs6000_sched_restricted_insns_priority); @@ -4141,20 +4136,12 @@ rs6000_option_override_internal (bool global_init_p) rs6000_isa_flags &= ~OPTION_MASK_BLOCK_OPS_VECTOR_PAIR; } - /* Use long double size to select the appropriate long double. - - On C/C++, We use TYPE_PRECISION to differentiate the 3 different long - double types. We map 128 into the precision used for TFmode. - - Fortran does not have support for the types __float128 and __ibm128, just - the default long double type. For Fortran, we use the precision 128 for - the long double type. */ - bool is_fortran = lang_GNU_Fortran (); + /* Use long double size to select the appropriate long double. We use + TYPE_PRECISION to differentiate the 3 different long double types. We map + 128 into the precision used for TFmode. */ int default_long_double_size = (RS6000_DEFAULT_LONG_DOUBLE_SIZE == 64 ? 64 - : (is_fortran - ? 128 - : FLOAT_PRECISION_TFmode)); + : FLOAT_PRECISION_TFmode); /* Set long double size before the IEEE 128-bit tests. */ if (!global_options_set.x_rs6000_long_double_type_size) @@ -4166,7 +4153,7 @@ rs6000_option_override_internal (bool global_init_p) else rs6000_long_double_type_size = default_long_double_size; } - else if (rs6000_long_double_type_size == 128 && !is_fortran) + else if (rs6000_long_double_type_size == 128) rs6000_long_double_type_size = FLOAT_PRECISION_TFmode; else if (global_options_set.x_rs6000_ieeequad) { @@ -4197,25 +4184,17 @@ rs6000_option_override_internal (bool global_init_p) 2.32 or newer. Only issue one warning. */ static bool warned_change_long_double; - if (!warned_change_long_double) + if (!warned_change_long_double + && (!glibc_supports_ieee_128bit () + || (!lang_GNU_C () && !lang_GNU_CXX ()))) { warned_change_long_double = true; - if (is_fortran) - error ("Fortran does not support %qs to change the default " - "long double type", - (TARGET_IEEEQUAD - ? "-mabi=ieeelongdouble" - : "-mabi=ibmlongdouble")); - - else if (!glibc_supports_ieee_128bit ()) - { - if (TARGET_IEEEQUAD) - warning (OPT_Wpsabi, "Using IEEE extended precision " - "%"); - else - warning (OPT_Wpsabi, "Using IBM extended precision " - "%"); - } + if (TARGET_IEEEQUAD) + warning (OPT_Wpsabi, "Using IEEE extended precision " + "%"); + else + warning (OPT_Wpsabi, "Using IBM extended precision " + "%"); } } } @@ -4224,13 +4203,8 @@ rs6000_option_override_internal (bool global_init_p) sytems. In GCC 7, we would enable the IEEE 128-bit floating point infrastructure (-mfloat128-type) but not enable the actual __float128 type unless the user used the explicit -mfloat128. In GCC 8, we enable both - the keyword as well as the type. - - Fortran does not support separate 128-bit floating point types other than - long double, we only enable TARGET_FLOAT128_TYPE if the default long double - for Fortran is IEEE-128 bit. */ - TARGET_FLOAT128_TYPE = (TARGET_FLOAT128_ENABLE_TYPE && TARGET_VSX - && (!is_fortran || TARGET_IEEEQUAD)); + the keyword as well as the type. */ + TARGET_FLOAT128_TYPE = TARGET_FLOAT128_ENABLE_TYPE && TARGET_VSX; /* IEEE 128-bit floating point requires VSX support. */ if (TARGET_FLOAT128_KEYWORD) @@ -4244,13 +4218,6 @@ rs6000_option_override_internal (bool global_init_p) rs6000_isa_flags &= ~(OPTION_MASK_FLOAT128_KEYWORD | OPTION_MASK_FLOAT128_HW); } - else if (is_fortran) - { - if ((rs6000_isa_flags_explicit & OPTION_MASK_FLOAT128_KEYWORD) != 0) - error ("Fortran does not support %qs", "-mfloat128"); - - rs6000_isa_flags &= ~OPTION_MASK_FLOAT128_KEYWORD; - } else if (!TARGET_FLOAT128_TYPE) { TARGET_FLOAT128_TYPE = 1; @@ -4258,22 +4225,8 @@ rs6000_option_override_internal (bool global_init_p) } } - /* Whether the '__ibm128' keywork is enabled. We enable __ibm128 either if the - IEEE 128-bit floating point support is enabled or if the long double support - uses the 128-bit IBM extended double format. - - However, we don't enable __ibm128 if the language is Fortran. Fortran - doesn't have the notion of separate types for __ibm128 and __float128, and it - wants the precision for the 16 byte floating point type to be 128. With the - 3 128-bit types enabled, we use the precision field to identify the separate - types. */ - TARGET_IBM128 = (!is_fortran - && (TARGET_FLOAT128_TYPE - || (!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128))); - - - /* Enable the __float128 keyword under Linux by default for C/C++. */ - if (TARGET_FLOAT128_TYPE && !TARGET_FLOAT128_KEYWORD && !is_fortran + /* Enable the __float128 keyword under Linux by default. */ + if (TARGET_FLOAT128_TYPE && !TARGET_FLOAT128_KEYWORD && (rs6000_isa_flags_explicit & OPTION_MASK_FLOAT128_KEYWORD) == 0) rs6000_isa_flags |= OPTION_MASK_FLOAT128_KEYWORD; @@ -11108,11 +11061,10 @@ rs6000_init_libfuncs (void) { /* __float128 support. */ if (TARGET_FLOAT128_TYPE) - init_float128_ieee (KFmode); - - /* __ibm128 support. */ - if (TARGET_IBM128) - init_float128_ibm (IFmode); + { + init_float128_ibm (IFmode); + init_float128_ieee (KFmode); + } /* AIX/Darwin/64-bit Linux quad floating point routines. */ if (TARGET_LONG_DOUBLE_128) diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index 6c25fedc0ff..520e277f7f3 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -334,8 +334,7 @@ extern const char *host_detect_local_cpu (int argc, const char **argv); #define FLOAT128_IBM_P(MODE) \ ((!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128 \ && ((MODE) == TFmode || (MODE) == TCmode)) \ - || (TARGET_HARD_FLOAT && TARGET_IBM128 \ - && ((MODE) == IFmode || (MODE) == ICmode))) + || (TARGET_HARD_FLOAT && ((MODE) == IFmode || (MODE) == ICmode))) /* Helper macros to say whether a 128-bit floating point type can go in a single vector register, or whether it needs paired scalar values. */ @@ -510,6 +509,12 @@ extern int rs6000_vector_align[]; #define TARGET_MINMAX (TARGET_HARD_FLOAT && TARGET_PPC_GFXOPT \ && (TARGET_P9_MINMAX || !flag_trapping_math)) +/* Whether the '__ibm128' keywork is enabled. We enable __ibm128 either if the + IEEE 128-bit floating point support is enabled or if the long double support + uses the 128-bit IBM extended double format. */ +#define TARGET_IBM128 (TARGET_FLOAT128_TYPE \ + || (!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128)) + /* In switching from using target_flags to using rs6000_isa_flags, the options machinery creates OPTION_MASK_ instead of MASK_. For now map OPTION_MASK_ back into MASK_. */ diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index a99681ac6bb..0cad17fec4b 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -480,7 +480,7 @@ (SF "TARGET_HARD_FLOAT") (DF "TARGET_HARD_FLOAT") (TF "TARGET_HARD_FLOAT && TARGET_LONG_DOUBLE_128") - (IF "TARGET_HARD_FLOAT && TARGET_IBM128") + (IF "TARGET_HARD_FLOAT && TARGET_LONG_DOUBLE_128") (KF "TARGET_FLOAT128_TYPE") (DD "TARGET_DFP") (TD "TARGET_DFP")]) @@ -604,7 +604,7 @@ ; Iterator for 128-bit floating point (define_mode_iterator FLOAT128 [(KF "TARGET_FLOAT128_TYPE") - (IF "TARGET_IBM128") + (IF "TARGET_FLOAT128_TYPE") (TF "TARGET_LONG_DOUBLE_128")]) ; Iterator for signbit on 64-bit machines with direct move diff --git a/gcc/config/rs6000/rs6000.opt b/gcc/config/rs6000/rs6000.opt index 1fb2c35c1b3..0dbdf753673 100644 --- a/gcc/config/rs6000/rs6000.opt +++ b/gcc/config/rs6000/rs6000.opt @@ -112,13 +112,6 @@ unsigned char x_TARGET_FLOAT128_TYPE Variable unsigned char TARGET_FLOAT128_TYPE -;; Whether to enable the __ibm128 support -TargetSave -unsigned char x_TARGET_IBM128 - -Variable -unsigned char TARGET_IBM128 - ;; This option existed in the past, but now is always on. mpowerpc Target RejectNegative Undocumented Ignore