From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1005) id 4E1413858C2D; Wed, 3 Aug 2022 15:13:02 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 4E1413858C2D 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/work096)] Make __ibm128 have a distinct type and always use IFmode. X-Act-Checkin: gcc X-Git-Author: Michael Meissner X-Git-Refname: refs/users/meissner/heads/work096 X-Git-Oldrev: 0fcc54d9ac7f9d532dcda14b1319e2380b780859 X-Git-Newrev: 950f236ef807c8b55933827a46ad98e0925dfb02 Message-Id: <20220803151302.4E1413858C2D@sourceware.org> Date: Wed, 3 Aug 2022 15:13:02 +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, 03 Aug 2022 15:13:02 -0000 https://gcc.gnu.org/g:950f236ef807c8b55933827a46ad98e0925dfb02 commit 950f236ef807c8b55933827a46ad98e0925dfb02 Author: Michael Meissner Date: Wed Aug 3 11:11:47 2022 -0400 Make __ibm128 have a distinct type and always use IFmode. This patch makes the __ibm128 use a distinct type which always uses the IFmode instead of __ibm128 using the long double type when long double uses the IBM 128-bit encoding. 2022-08-03 Michael Meissner gcc/ * config/rs6000/rs6000-builtin.cc (rs6000_init_builtins): Always create a unique type for __ibm128 instead of using the long double type. Make sure ibm128_float_type_node is initialized. * config/rs6000/rs6000-c.c (rs6000_cpu_cpp_builtins): Do not define __KF__ and __KC__ mode when long double uses the IEEE 128-bit encoding. * config/rs6000/rs6000.cc (TARGET_TRANSLATE_MODE_ATTRIBUTE): Delete. (rs6000_translate_mode_attribute): Likewise. Diff: --- gcc/config/rs6000/rs6000-builtin.cc | 33 +++++++++++++++------------------ gcc/config/rs6000/rs6000-c.cc | 14 +++++--------- gcc/config/rs6000/rs6000.cc | 17 ----------------- 3 files changed, 20 insertions(+), 44 deletions(-) diff --git a/gcc/config/rs6000/rs6000-builtin.cc b/gcc/config/rs6000/rs6000-builtin.cc index f796110c14d..d3de5827156 100644 --- a/gcc/config/rs6000/rs6000-builtin.cc +++ b/gcc/config/rs6000/rs6000-builtin.cc @@ -709,31 +709,28 @@ rs6000_init_builtins (void) format that uses a pair of doubles, depending on the switches and defaults. - If we don't support for either 128-bit IBM double double or IEEE 128-bit - floating point, we need make sure the type is non-zero or else self-test - fails during bootstrap. - - For IEEE 128-bit floating point, always create the type __ieee128. If the - user used -mfloat128, rs6000-c.cc will create a define from __float128 to - __ieee128. Use the standard _Float128 type even if long double uses IEEE - 128-bit. */ + In the past, we used to map _Float128 and __float128/__ieee128 modes into + TFmode if long double used the IEEE 128-bit encoding. Similarly, we used + to map __ibm128 into TFmode if long double used the IBM 128-bit encoding. + + Now __ieee128/__float128 always uses the type for _Float128 and KFmode. + And __ibm128 always uses a distinct type and IFmode. + + If we don't have support for either 128-bit IBM double double or IEEE + 128-bit floating point, we need make sure the type is non-zero or else + self-test fails during bootstrap. */ if (TARGET_IBM128) { - if (!TARGET_IEEEQUAD) - ibm128_float_type_node = long_double_type_node; - else - { - ibm128_float_type_node = make_node (REAL_TYPE); - TYPE_PRECISION (ibm128_float_type_node) = 128; - SET_TYPE_MODE (ibm128_float_type_node, IFmode); - layout_type (ibm128_float_type_node); - } + ibm128_float_type_node = make_node (REAL_TYPE); + TYPE_PRECISION (ibm128_float_type_node) = 128; + SET_TYPE_MODE (ibm128_float_type_node, IFmode); + layout_type (ibm128_float_type_node); t = build_qualified_type (ibm128_float_type_node, TYPE_QUAL_CONST); lang_hooks.types.register_builtin_type (ibm128_float_type_node, "__ibm128"); } else - ibm128_float_type_node = NULL_TREE; + ibm128_float_type_node = long_double_type_node; if (TARGET_FLOAT128_TYPE) { diff --git a/gcc/config/rs6000/rs6000-c.cc b/gcc/config/rs6000/rs6000-c.cc index 437b39f23af..82379744109 100644 --- a/gcc/config/rs6000/rs6000-c.cc +++ b/gcc/config/rs6000/rs6000-c.cc @@ -716,16 +716,12 @@ rs6000_cpu_cpp_builtins (cpp_reader *pfile) if (TARGET_IEEEQUAD) { - /* Older versions of GLIBC used __attribute__((__KC__)) to create the - IEEE 128-bit floating point complex type for C++ (which does not - support _Float128 _Complex). If the default for long double is - IEEE 128-bit mode, the library would need to use - __attribute__((__TC__)) instead. Defining __KF__ and __KC__ - is a stop-gap to build with the older libraries, until we - get an updated library. */ + /* In the past, we used to map __KF__ to __TF__ and __KC__ to __TC__ + to allow older glibc code to work on systems where the long double + type uses the IEEE 128-bit encoding. Now that we always use + KFmode and KCmode for the _Float128 and __float128 types, we don't + need to use these defines any more. */ builtin_define ("__LONG_DOUBLE_IEEE128__"); - builtin_define ("__KF__=__TF__"); - builtin_define ("__KC__=__TC__"); } else builtin_define ("__LONG_DOUBLE_IBM128__"); diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc index 6dfdfebd7a6..9066bbe8850 100644 --- a/gcc/config/rs6000/rs6000.cc +++ b/gcc/config/rs6000/rs6000.cc @@ -1543,9 +1543,6 @@ static const struct attribute_spec rs6000_attribute_table[] = #undef TARGET_EH_RETURN_FILTER_MODE #define TARGET_EH_RETURN_FILTER_MODE rs6000_eh_return_filter_mode -#undef TARGET_TRANSLATE_MODE_ATTRIBUTE -#define TARGET_TRANSLATE_MODE_ATTRIBUTE rs6000_translate_mode_attribute - #undef TARGET_SCALAR_MODE_SUPPORTED_P #define TARGET_SCALAR_MODE_SUPPORTED_P rs6000_scalar_mode_supported_p @@ -23678,20 +23675,6 @@ rs6000_eh_return_filter_mode (void) return TARGET_32BIT ? SImode : word_mode; } -/* Target hook for translate_mode_attribute. The __float128 and _Float128 - types always have a separate type and mode from the long double types. - - Currently __ibm128 shares the type and mode with long double if long double - uses the IBM 128-bit encoding. */ -static machine_mode -rs6000_translate_mode_attribute (machine_mode mode) -{ - if (FLOAT128_IEEE_P (mode)) - return COMPLEX_MODE_P (mode) ? E_KCmode : E_KFmode; - - return mode; -} - /* Target hook for scalar_mode_supported_p. */ static bool rs6000_scalar_mode_supported_p (scalar_mode mode)