public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [PATCH] rs6000: Set up ieee128_float_type_node correctly (PR86285)
@ 2018-07-02 21:40 Segher Boessenkool
  0 siblings, 0 replies; only message in thread
From: Segher Boessenkool @ 2018-07-02 21:40 UTC (permalink / raw)
  To: gcc-patches; +Cc: dje.gcc, Segher Boessenkool

[ I wonder if I ever sent this patch to the list.  I now backported it
  to 8 branch as well.  Apologies. ]

We shouldn't init __ieee128 to be the same as long double if the
latter is not even a 128-bit type.

This also reorders the nearby __ibm128 code so both types use similar
logic.

Committing to trunk.  This should also go to 8.


Segher


2018-06-26  Segher Boessenkool  <segher@kernel.crashing.org>

	PR target/86285
	* config/rs6000/rs6000.c (rs6000_init_builtins): Do not set
	ieee128_float_type_node to long_double_type_node unless
	TARGET_LONG_DOUBLE_128 is set.

---
 gcc/config/rs6000/rs6000.c | 13 ++++++++-----
 1 file changed, 8 insertions(+), 5 deletions(-)

diff --git a/gcc/config/rs6000/rs6000.c b/gcc/config/rs6000/rs6000.c
index cb228ad..5b70521 100644
--- a/gcc/config/rs6000/rs6000.c
+++ b/gcc/config/rs6000/rs6000.c
@@ -16414,21 +16414,24 @@ rs6000_init_builtins (void)
      __ieee128.  */
   if (TARGET_FLOAT128_TYPE)
     {
-      if (TARGET_IEEEQUAD || !TARGET_LONG_DOUBLE_128)
+      if (!TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128)
+	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);
 	}
-      else
-	ibm128_float_type_node = long_double_type_node;
 
       lang_hooks.types.register_builtin_type (ibm128_float_type_node,
 					      "__ibm128");
 
-      ieee128_float_type_node
-	= TARGET_IEEEQUAD ? long_double_type_node : float128_type_node;
+      if (TARGET_IEEEQUAD && TARGET_LONG_DOUBLE_128)
+	ieee128_float_type_node = long_double_type_node;
+      else
+	ieee128_float_type_node = float128_type_node;
+
       lang_hooks.types.register_builtin_type (ieee128_float_type_node,
 					      "__ieee128");
     }
-- 
1.8.3.1

^ permalink raw reply	[flat|nested] only message in thread

only message in thread, other threads:[~2018-07-02 21:40 UTC | newest]

Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-07-02 21:40 [PATCH] rs6000: Set up ieee128_float_type_node correctly (PR86285) Segher Boessenkool

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).