Hi Guys,

> I think this indicates that i386 and ia64 need their own local version of 
> float128_type_node, set up like float80_type_node (i.e. copied from the 
> global one if that isn't NULL, otherwise set up locally) instead of using 
> the global one unconditionally, because of the existence of i386 and ia64 
> targets where the TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P hook can return 
> false for TFmode (in which case __float128 still exists, but not 
> _Float128).

OK - that I can do.

> Though preferable would be to fix all the targets with 
> IX86_NO_LIBGCC_TFMODE / IX86_MAYBE_NO_LIBGCC_TFMODE / 
> IA64_NO_LIBGCC_TFMODE so that they include the relevant support code in 
> libgcc and so no longer need the TARGET_LIBGCC_FLOATING_MODE_SUPPORTED_P 
> hook overridden at all.

I would prefer to leave this to the maintainers as I do not want to get target
greping wrong.

So - Jan, Uros, Jim, Steve - are these ia64 and i386 backend patches OK ?
 
Cheers
  Nick

gcc/ChangeLog
2016-08-25  Nick Clifton  <ni...@redhat.com>

        * config/ia64/ia64.c (ia64_init_builtins): Initialise the
        float128_type_node if that has not been done already.
        * config/i386/i386.c (ix86_init_builtin_types): Likewise.

Index: gcc/config/i386/i386.c
===================================================================
--- gcc/config/i386/i386.c	(revision 239761)
+++ gcc/config/i386/i386.c	(working copy)
@@ -33341,9 +33341,19 @@
     }
   lang_hooks.types.register_builtin_type (float80_type_node, "__float80");
 
-  /* The __float128 type.  The node has already been created as
-     _Float128, so we only need to register the __float128 name for
-     it.  */
+  /* The __float128 type.  If TFmode is supported by libgcc then the node
+     has already been created as _Float128, so we only need to register the
+     __float128 name for  it.  Otherwise we have to create the float128
+     type first.  */
+#if defined IX86_NO_LIBGCC_TFMODE || defined IX86_MAYBE_NO_LIBGCC_TFMODE
+  if (float128_type_node == NULL)
+    {
+      float128_type_node = make_node (REAL_TYPE);
+      TYPE_PRECISION (float128_type_node) = 128;
+      layout_type (float128_type_node);
+      SET_TYPE_MODE (float128_type_node, TFmode);
+    }
+#endif
   lang_hooks.types.register_builtin_type (float128_type_node, "__float128");
 
   const_string_type_node
Index: gcc/config/ia64/ia64.c
===================================================================
--- gcc/config/ia64/ia64.c	(revision 239761)
+++ gcc/config/ia64/ia64.c	(working copy)
@@ -10368,6 +10368,13 @@
       tree const_string_type
 	= build_pointer_type (build_qualified_type
 			      (char_type_node, TYPE_QUAL_CONST));
+#ifdef IA64_NO_LIBGCC_TFMODE
+      gcc_assert (float128_type_node == NULL);
+      float128_type_node = make_node (REAL_TYPE);
+      TYPE_PRECISION (float128_type_node) = 128;
+      layout_type (float128_type_node);
+      SET_TYPE_MODE (float128_type_node, TFmode);
+#endif
 
       (*lang_hooks.types.register_builtin_type) (float128_type_node,
 						 "__float128");

Reply via email to