public inbox for gcc-patches@gcc.gnu.org
 help / color / mirror / Atom feed
* [LTO][PATCH] Fix long double precision problem
@ 2007-12-05  7:05 Doug Kwan (關振德)
  2007-12-05 10:52 ` Andrew Pinski
  0 siblings, 1 reply; 24+ messages in thread
From: Doug Kwan (關振德) @ 2007-12-05  7:05 UTC (permalink / raw)
  To: gcc-patches, Diego Novillo, zadeck

[-- Attachment #1: Type: text/plain, Size: 176 bytes --]

Hi,

    Could someone review this patch.  This fixes a problem where long
double type has BLK mode instead of the correct XF mode.  It fixes
about 20 dejagnu failures.

-Doug

[-- Attachment #2: patches.txt --]
[-- Type: text/plain, Size: 1505 bytes --]

2007-12-04  Doug Kwan  <dougkwan@google.com>

	* lto.c (lto_real_type_precision): New.
	(lto_read_base_type_DIE): Use type size to compute precision of
	a scalar real base type instead of using type size as precision.

Index: gcc/lto/lto.c
===================================================================
--- gcc/lto/lto.c	(revision 130614)
+++ gcc/lto/lto.c	(working copy)
@@ -2899,6 +2899,20 @@ lto_read_subrange_type_DIE (lto_info_fd 
   return type;
 }
 
+static int
+lto_real_type_precision (int size)
+{
+  if (size == TREE_INT_CST_LOW (TYPE_SIZE (float_type_node)))
+    return TYPE_PRECISION (float_type_node);
+  if (size == TREE_INT_CST_LOW (TYPE_SIZE (double_type_node)))
+    return TYPE_PRECISION (double_type_node);
+  if (size == TREE_INT_CST_LOW (TYPE_SIZE (long_double_type_node)))
+    return TYPE_PRECISION (long_double_type_node);
+
+  gcc_unreachable ();
+  return 0;
+}
+
 static tree
 lto_read_base_type_DIE (lto_info_fd *fd, 
 			lto_die_ptr die ATTRIBUTE_UNUSED,
@@ -3003,14 +3017,14 @@ lto_read_base_type_DIE (lto_info_fd *fd,
 
     case DW_ATE_float:
       type = make_node (REAL_TYPE);
-      TYPE_PRECISION (type) = bits;
+      TYPE_PRECISION (type) = lto_real_type_precision (bits);
       layout_type (type);
       break;
 
     case DW_ATE_complex_float:
       {
 	tree base = make_node (REAL_TYPE);
-	TYPE_PRECISION (base) = bits / 2;
+	TYPE_PRECISION (base) = lto_real_type_precision (bits / 2);
 	layout_type (base);
 	type = build_complex_type (base);
       }

^ permalink raw reply	[flat|nested] 24+ messages in thread

end of thread, other threads:[~2007-12-18  4:07 UTC | newest]

Thread overview: 24+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2007-12-05  7:05 [LTO][PATCH] Fix long double precision problem Doug Kwan (關振德)
2007-12-05 10:52 ` Andrew Pinski
2007-12-05 12:55   ` Kenneth Zadeck
2007-12-05 14:56     ` Diego Novillo
2007-12-05 16:28       ` Doug Kwan (關振德)
2007-12-05 19:02         ` Andrew Pinski
2007-12-05 16:34     ` Mark Mitchell
2007-12-05 18:42       ` Doug Kwan (關振德)
2007-12-05 19:01       ` Doug Kwan (關振德)
2007-12-05 23:52         ` Mark Mitchell
2007-12-11 23:15           ` Doug Kwan (關振德)
2007-12-12  9:22             ` Mark Mitchell
2007-12-12 20:23               ` Doug Kwan (關振德)
2007-12-12 20:45                 ` Mark Mitchell
2007-12-13  2:27                   ` Doug Kwan (關振德)
2007-12-13 11:02                     ` Andreas Schwab
2007-12-13 19:13                       ` Doug Kwan (關振德)
2007-12-14  9:50                         ` Andreas Schwab
2007-12-14 22:18                           ` Doug Kwan (關振德)
2007-12-13 20:11                   ` Jim Blandy
2007-12-13 20:40                     ` Doug Kwan (關振德)
2007-12-13 22:43                       ` Jim Blandy
     [not found]                         ` <4765FBC0.8020400@codesourcery.com>
2007-12-17 21:53                           ` Doug Kwan (關振德)
2007-12-18  4:29                             ` Mark Mitchell

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