From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: by sourceware.org (Postfix, from userid 1005) id 8B7193858C83; Thu, 1 Sep 2022 20:11:33 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 sourceware.org 8B7193858C83 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gcc.gnu.org; s=default; t=1662063093; bh=+7MB+pH+QfLVhvRzDEZzJdHf4ELnUZ+cZ+A2Oh/o23E=; h=From:To:Subject:Date:From; b=qNXOKEQyObW/bjXKbEmd3XUXw65yy8J+MD/jqGrKJrYRDD+yR2aPNTIRCUPR63l9E MPOJUyHwK+WGNKXctCUfYbL0L+rBf/C//1SmILXU7KKivFkREYTZyAj08exRBTeFO3 gBOXXIN0Dhs/ATb25RSoeSCF5fp/29qijWCg3E+U= 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/work099)] Allow __ibm128 even if IEEE 128-bit floating point is not supported. X-Act-Checkin: gcc X-Git-Author: Michael Meissner X-Git-Refname: refs/users/meissner/heads/work099 X-Git-Oldrev: 2c9c000f9182cee2a73d4dc91c9afaf8a427ba2b X-Git-Newrev: 1aca6192b7b4dbe48a163e28b7bceaf83a760a30 Message-Id: <20220901201133.8B7193858C83@sourceware.org> Date: Thu, 1 Sep 2022 20:11:33 +0000 (GMT) List-Id: https://gcc.gnu.org/g:1aca6192b7b4dbe48a163e28b7bceaf83a760a30 commit 1aca6192b7b4dbe48a163e28b7bceaf83a760a30 Author: Michael Meissner Date: Thu Sep 1 16:06:35 2022 -0400 Allow __ibm128 even if IEEE 128-bit floating point is not supported. This patch allows the use of the __ibm128 keyword on non-VSX systems. Originally, the __ibm128 keyword was only enabled when the IEEE 128-bit floating point is enabled. Sometime back in the GCC 12 development period, Segher asked that the __ibm128 keyword be allowed in older systems that don't support IEEE 128-bit. But at the time, stage 1 had closed for GCC 12, so I deferred doing this change until GCC 13. This patch allows __ibm128 to be used if either IEEE 128-bit is enabled or long double used the IBM 128-bit format. 2022-09-01 Michael Meissner gcc/ * config/rs6000/rs6000-builtins.cc (rs6000_init_builtins): Enable using the__ibm128 keyword on systems that either use the 128-bit IBM long double format for long double or support IEEE 128-bit. * config/rs6000/rs6000.cc (rs6000_init_libfuncs): Create IBM 128-bit floating point support functions on systems that support the __ibm128 keyword. (rs6000_scalar_mode_supported_p): Likewise. * config/rs6000/rs6000.h (TARGET_IBM128): New macro. * config/rs6000/rs6000.md (@extenddf2_fprs): Allow IFmode to be converted even if long double is not 128-bits. (extenddf2_vsx): Likewise. (extendiftf2):Allow conversion on systems that support the __ibm128 keyword. (extendtfif2): Likewise. (trunciftf2): Likewise. (trunctfif2): Likewise. Diff: --- gcc/config/rs6000/rs6000-builtin.cc | 2 +- gcc/config/rs6000/rs6000.cc | 13 ++++++++----- gcc/config/rs6000/rs6000.h | 6 ++++++ gcc/config/rs6000/rs6000.md | 13 ++++++------- 4 files changed, 21 insertions(+), 13 deletions(-) diff --git a/gcc/config/rs6000/rs6000-builtin.cc b/gcc/config/rs6000/rs6000-builtin.cc index e6948b9abb7..cc88b68ac47 100644 --- a/gcc/config/rs6000/rs6000-builtin.cc +++ b/gcc/config/rs6000/rs6000-builtin.cc @@ -713,7 +713,7 @@ rs6000_init_builtins (void) 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. */ - if (TARGET_LONG_DOUBLE_128 && (!TARGET_IEEEQUAD || TARGET_FLOAT128_TYPE)) + if (TARGET_IBM128) { if (!TARGET_IEEEQUAD) ibm128_float_type_node = long_double_type_node; diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc index 2f3146e56f8..01bd89ccfdc 100644 --- a/gcc/config/rs6000/rs6000.cc +++ b/gcc/config/rs6000/rs6000.cc @@ -11115,10 +11115,11 @@ rs6000_init_libfuncs (void) { /* __float128 support. */ if (TARGET_FLOAT128_TYPE) - { - init_float128_ibm (IFmode); - init_float128_ieee (KFmode); - } + init_float128_ieee (KFmode); + + /* __ibm128 support. */ + if (TARGET_IBM128) + init_float128_ibm (IFmode); /* AIX/Darwin/64-bit Linux quad floating point routines. */ if (TARGET_LONG_DOUBLE_128) @@ -23752,7 +23753,9 @@ rs6000_scalar_mode_supported_p (scalar_mode mode) if (DECIMAL_FLOAT_MODE_P (mode)) return default_decimal_float_supported_p (); - else if (TARGET_FLOAT128_TYPE && (mode == KFmode || mode == IFmode)) + else if (TARGET_FLOAT128_TYPE && mode == KFmode) + return true; + else if (TARGET_IBM128 && mode == IFmode) return true; else return default_scalar_mode_supported_p (mode); diff --git a/gcc/config/rs6000/rs6000.h b/gcc/config/rs6000/rs6000.h index ad9bf0f7358..813ec696c0d 100644 --- a/gcc/config/rs6000/rs6000.h +++ b/gcc/config/rs6000/rs6000.h @@ -564,6 +564,12 @@ extern int rs6000_vector_align[]; && TARGET_P8_VECTOR \ && TARGET_POWERPC64) +/* Whether the __ibm128 keyword is allowed. Any system that supports _Float128 + is assumed to be capable of supporting __ibm128. Similarly if the long + double size is 128 bits, we assume __ibm128 is supported. We don't want to + support it on a system without existing 128-bit long doubles. */ +#define TARGET_IBM128 (TARGET_FLOAT128_TYPE || TARGET_LONG_DOUBLE_128) + /* Inlining allows targets to define the meanings of bits in target_info field of ipa_fn_summary by itself, the used bits for rs6000 are listed below. */ diff --git a/gcc/config/rs6000/rs6000.md b/gcc/config/rs6000/rs6000.md index e9e5cd1e54d..a31673051f7 100644 --- a/gcc/config/rs6000/rs6000.md +++ b/gcc/config/rs6000/rs6000.md @@ -8632,8 +8632,7 @@ (float_extend:IBM128 (match_operand:DF 1 "nonimmediate_operand" "d,m,d"))) (use (match_operand:DF 2 "nonimmediate_operand" "m,m,d"))] - "!TARGET_VSX && TARGET_HARD_FLOAT - && TARGET_LONG_DOUBLE_128 && FLOAT128_IBM_P (mode)" + "!TARGET_VSX && TARGET_HARD_FLOAT && FLOAT128_IBM_P (mode)" "#" "&& reload_completed" [(set (match_dup 3) (match_dup 1)) @@ -8650,7 +8649,7 @@ [(set (match_operand:IBM128 0 "gpc_reg_operand" "=d,d") (float_extend:IBM128 (match_operand:DF 1 "nonimmediate_operand" "wa,m")))] - "TARGET_LONG_DOUBLE_128 && TARGET_VSX && FLOAT128_IBM_P (mode)" + "TARGET_VSX && FLOAT128_IBM_P (mode)" "#" "&& reload_completed" [(set (match_dup 2) (match_dup 1)) @@ -9107,7 +9106,7 @@ (define_expand "extendiftf2" [(set (match_operand:TF 0 "gpc_reg_operand") (float_extend:TF (match_operand:IF 1 "gpc_reg_operand")))] - "TARGET_FLOAT128_TYPE" + "TARGET_IBM128" { rs6000_expand_float128_convert (operands[0], operands[1], false); DONE; @@ -9134,7 +9133,7 @@ (define_expand "extendtfif2" [(set (match_operand:IF 0 "gpc_reg_operand") (float_extend:IF (match_operand:TF 1 "gpc_reg_operand")))] - "TARGET_FLOAT128_TYPE" + "TARGET_IBM128" { rs6000_expand_float128_convert (operands[0], operands[1], false); DONE; @@ -9143,7 +9142,7 @@ (define_expand "trunciftf2" [(set (match_operand:TF 0 "gpc_reg_operand") (float_truncate:TF (match_operand:IF 1 "gpc_reg_operand")))] - "TARGET_FLOAT128_TYPE" + "TARGET_IBM128" { rs6000_expand_float128_convert (operands[0], operands[1], false); DONE; @@ -9170,7 +9169,7 @@ (define_expand "trunctfif2" [(set (match_operand:IF 0 "gpc_reg_operand") (float_truncate:IF (match_operand:TF 1 "gpc_reg_operand")))] - "TARGET_FLOAT128_TYPE" + "TARGET_IBM128" { rs6000_expand_float128_convert (operands[0], operands[1], false); DONE;