public inbox for gcc-cvs@sourceware.org
help / color / mirror / Atom feed
* [gcc(refs/users/meissner/heads/work092)] __float128 and __ibm128 always gets different internal types.
@ 2022-06-22 21:41 Michael Meissner
0 siblings, 0 replies; only message in thread
From: Michael Meissner @ 2022-06-22 21:41 UTC (permalink / raw)
To: gcc-cvs
https://gcc.gnu.org/g:87904d9f36e1afc3f75da2faa12b4a1c18de437d
commit 87904d9f36e1afc3f75da2faa12b4a1c18de437d
Author: Michael Meissner <meissner@linux.ibm.com>
Date: Wed Jun 22 17:41:17 2022 -0400
__float128 and __ibm128 always gets different internal types.
2022-06-22 Michael Meissner <meissner@linux.ibm.com>
gcc/
* config/rs6000/rs6000-builtin.cc (rs6000_init_builtins): Always
create a new tree node for __ibm128, even if long double uses the
IBM 128-bit format. Always create a new tree node for __float128,
even if long double uses the IEEE 128-bit format. Change the
keyword create for IEEE 128-bit to be '__float128', not
'__ieee128'.
* config/rs6000/rs6000-c.cc (rs6000_target_modify_macros): Define
__ieee128 compatibility macro.
* config/rs6000/rs600.cc (reg_offset_addressing_ok_p): Allow
IFmode to use offset addresses.
(create_complex_muldiv): Delete.
(init_float128_ieee): Do not create __mulkc3 and __divkc3 since
__float128 always creates these functions.
(rs6000_libgcc_floating_mode_supported_p): Always allow KFmode.
(rs6000_floatn_mode): Always return KFmode for IEEE 128-bit. Do
not return TFmode, even if long double uses the IEEE 128-bit
format.
(rs6000_c_mode_for_suffix): The 'q' suffix always uses KFmode,
even if long double uses the IEEE 128-bit encoding.
Diff:
---
gcc/config/rs6000/rs6000-builtin.cc | 24 +++++----------
gcc/config/rs6000/rs6000-c.cc | 8 +++--
gcc/config/rs6000/rs6000.cc | 61 ++++---------------------------------
3 files changed, 18 insertions(+), 75 deletions(-)
diff --git a/gcc/config/rs6000/rs6000-builtin.cc b/gcc/config/rs6000/rs6000-builtin.cc
index 2819773d9f9..b43a8039ad6 100644
--- a/gcc/config/rs6000/rs6000-builtin.cc
+++ b/gcc/config/rs6000/rs6000-builtin.cc
@@ -713,18 +713,12 @@ 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_LONG_DOUBLE_128 || TARGET_FLOAT128_TYPE)
{
- 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);
- }
- t = build_qualified_type (ibm128_float_type_node, TYPE_QUAL_CONST);
+ 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);
lang_hooks.types.register_builtin_type (ibm128_float_type_node,
"__ibm128");
}
@@ -733,13 +727,9 @@ rs6000_init_builtins (void)
if (TARGET_FLOAT128_TYPE)
{
- if (TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128)
- ieee128_float_type_node = long_double_type_node;
- else
- ieee128_float_type_node = float128_type_node;
- t = build_qualified_type (ieee128_float_type_node, TYPE_QUAL_CONST);
+ ieee128_float_type_node = float128_type_node;
lang_hooks.types.register_builtin_type (ieee128_float_type_node,
- "__ieee128");
+ "__float128");
}
else
ieee128_float_type_node = NULL_TREE;
diff --git a/gcc/config/rs6000/rs6000-c.cc b/gcc/config/rs6000/rs6000-c.cc
index 9c8cbd7a66e..1f0cd40d4ec 100644
--- a/gcc/config/rs6000/rs6000-c.cc
+++ b/gcc/config/rs6000/rs6000-c.cc
@@ -578,13 +578,15 @@ rs6000_target_modify_macros (bool define_p, HOST_WIDE_INT flags,
2. If TARGET_ALTIVEC is turned off. */
if ((flags & OPTION_MASK_CRYPTO) != 0)
rs6000_define_or_undefine_macro (define_p, "__CRYPTO__");
+ /* In GCC 12 and before, we defined the actual IEEE keyword as __ieee128.
+ This was due some issues in the GCC 8 time frame, where __float128 support
+ was being worked on. In GCC 13, we change the keyword to __float128, and
+ add a macro for backwards compatibility for __ieee128. */
if ((flags & OPTION_MASK_FLOAT128_KEYWORD) != 0)
{
rs6000_define_or_undefine_macro (define_p, "__FLOAT128__");
if (define_p)
- rs6000_define_or_undefine_macro (true, "__float128=__ieee128");
- else
- rs6000_define_or_undefine_macro (false, "__float128");
+ rs6000_define_or_undefine_macro (true, "__ieee128=__float128");
if (ieee128_float_type_node && define_p)
rs6000_define_or_undefine_macro (true, "__SIZEOF_FLOAT128__=16");
else
diff --git a/gcc/config/rs6000/rs6000.cc b/gcc/config/rs6000/rs6000.cc
index 3d1f895ebd5..c036b05a077 100644
--- a/gcc/config/rs6000/rs6000.cc
+++ b/gcc/config/rs6000/rs6000.cc
@@ -8532,6 +8532,7 @@ reg_offset_addressing_ok_p (machine_mode mode)
case E_TImode:
case E_TFmode:
case E_KFmode:
+ case E_IFmode:
/* AltiVec/VSX vector modes. Only reg+reg addressing was valid until the
ISA 3.0 vector d-form addressing mode was added. While TImode is not
a vector mode, if we want to use the VSX registers to move it around,
@@ -11033,26 +11034,6 @@ init_float128_ibm (machine_mode mode)
}
}
-/* Create a decl for either complex long double multiply or complex long double
- divide when long double is IEEE 128-bit floating point. We can't use
- __multc3 and __divtc3 because the original long double using IBM extended
- double used those names. The complex multiply/divide functions are encoded
- as builtin functions with a complex result and 4 scalar inputs. */
-
-static void
-create_complex_muldiv (const char *name, built_in_function fncode, tree fntype)
-{
- tree fndecl = add_builtin_function (name, fntype, fncode, BUILT_IN_NORMAL,
- name, NULL_TREE);
-
- set_builtin_decl (fncode, fndecl, true);
-
- if (TARGET_DEBUG_BUILTIN)
- fprintf (stderr, "create complex %s, fncode: %d\n", name, (int) fncode);
-
- return;
-}
-
/* Set up IEEE 128-bit floating point routines. Use different names if the
arguments can be passed in a vector register. The historical PowerPC
implementation of IEEE 128-bit floating point used _q_<op> for the names, so
@@ -11064,32 +11045,6 @@ init_float128_ieee (machine_mode mode)
{
if (FLOAT128_VECTOR_P (mode))
{
- static bool complex_muldiv_init_p = false;
-
- /* Set up to call __mulkc3 and __divkc3 under -mabi=ieeelongdouble. If
- we have clone or target attributes, this will be called a second
- time. We want to create the built-in function only once. */
- if (mode == TFmode && TARGET_IEEEQUAD && !complex_muldiv_init_p)
- {
- complex_muldiv_init_p = true;
- built_in_function fncode_mul =
- (built_in_function) (BUILT_IN_COMPLEX_MUL_MIN + TCmode
- - MIN_MODE_COMPLEX_FLOAT);
- built_in_function fncode_div =
- (built_in_function) (BUILT_IN_COMPLEX_DIV_MIN + TCmode
- - MIN_MODE_COMPLEX_FLOAT);
-
- tree fntype = build_function_type_list (complex_long_double_type_node,
- long_double_type_node,
- long_double_type_node,
- long_double_type_node,
- long_double_type_node,
- NULL_TREE);
-
- create_complex_muldiv ("__mulkc3", fncode_mul, fntype);
- create_complex_muldiv ("__divkc3", fncode_div, fntype);
- }
-
set_optab_libfunc (add_optab, mode, "__addkf3");
set_optab_libfunc (sub_optab, mode, "__subkf3");
set_optab_libfunc (neg_optab, mode, "__negkf2");
@@ -23833,13 +23788,9 @@ rs6000_libgcc_floating_mode_supported_p (scalar_float_mode mode)
case E_TFmode:
return true;
- /* We only return true for KFmode if IEEE 128-bit types are supported, and
- if long double does not use the IEEE 128-bit format. If long double
- uses the IEEE 128-bit format, it will use TFmode and not KFmode.
- Because the code will not use KFmode in that case, there will be aborts
- because it can't find KFmode in the Floatn types. */
+ /* We only return true for KFmode if IEEE 128-bit types are supported. */
case E_KFmode:
- return TARGET_FLOAT128_TYPE && !TARGET_IEEEQUAD;
+ return TARGET_FLOAT128_TYPE;
default:
return false;
@@ -23873,7 +23824,7 @@ rs6000_floatn_mode (int n, bool extended)
case 64:
if (TARGET_FLOAT128_TYPE)
- return (FLOAT128_IEEE_P (TFmode)) ? TFmode : KFmode;
+ return KFmode;
else
return opt_scalar_float_mode ();
@@ -23897,7 +23848,7 @@ rs6000_floatn_mode (int n, bool extended)
case 128:
if (TARGET_FLOAT128_TYPE)
- return (FLOAT128_IEEE_P (TFmode)) ? TFmode : KFmode;
+ return KFmode;
else
return opt_scalar_float_mode ();
@@ -23915,7 +23866,7 @@ rs6000_c_mode_for_suffix (char suffix)
if (TARGET_FLOAT128_TYPE)
{
if (suffix == 'q' || suffix == 'Q')
- return (FLOAT128_IEEE_P (TFmode)) ? TFmode : KFmode;
+ return KFmode;
/* At the moment, we are not defining a suffix for IBM extended double.
If/when the default for -mabi=ieeelongdouble is changed, and we want
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2022-06-22 21:41 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-06-22 21:41 [gcc(refs/users/meissner/heads/work092)] __float128 and __ibm128 always gets different internal types Michael Meissner
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).