Blame SOURCES/gdb-rhbz1125820-ppc64le-enablement-05of37.patch

7ab123
commit f5aee5eeb88a99a8fb9d2b57971b0bda035ebc65
7ab123
Author: Alan Modra <amodra@gmail.com>
7ab123
Date:   Tue Aug 20 06:42:19 2013 +0000
7ab123
7ab123
    	* doublest.c (convert_floatformat_to_doublest): Use fmt->split_half
7ab123
    	for IBM long double nan and inf.
7ab123
    	(floatformat_is_negative, floatformat_classify,
7ab123
    	floatformat_mantissa): Similarly.
7ab123
    	(floatformat_ieee_single, floatformat_ieee_double,
7ab123
    	floatformat_ieee_quad, floatformat_arm_ext,
7ab123
    	floatformat_ia64_spill): Delete unused vars.
7ab123
    	(_initialize_doublest): Delete unused function.
7ab123
    	* gdbtypes.c (floatformats_ibm_long_double): Use new big- and
7ab123
    	little-endian variants of floatformat_ibm_long_double.
7ab123
7ab123
Index: gdb-7.6.1/gdb/doublest.c
7ab123
===================================================================
7ab123
--- gdb-7.6.1.orig/gdb/doublest.c
7ab123
+++ gdb-7.6.1/gdb/doublest.c
7ab123
@@ -190,7 +190,8 @@ convert_floatformat_to_doublest (const s
7ab123
     {
7ab123
       double dto;
7ab123
 
7ab123
-      floatformat_to_double (fmt, from, &dto;;
7ab123
+      floatformat_to_double (fmt->split_half ? fmt->split_half : fmt,
7ab123
+			     from, &dto;;
7ab123
       *to = (DOUBLEST) dto;
7ab123
       return;
7ab123
     }
7ab123
@@ -561,6 +562,11 @@ floatformat_is_negative (const struct fl
7ab123
   gdb_assert (fmt->totalsize
7ab123
 	      <= FLOATFORMAT_LARGEST_BYTES * FLOATFORMAT_CHAR_BIT);
7ab123
 
7ab123
+  /* An IBM long double (a two element array of double) always takes the
7ab123
+     sign of the first double.  */
7ab123
+  if (fmt->split_half)
7ab123
+    fmt = fmt->split_half;
7ab123
+
7ab123
   order = floatformat_normalize_byteorder (fmt, uval, newfrom);
7ab123
 
7ab123
   if (order != fmt->byteorder)
7ab123
@@ -587,6 +593,13 @@ floatformat_classify (const struct float
7ab123
   gdb_assert (fmt->totalsize
7ab123
 	      <= FLOATFORMAT_LARGEST_BYTES * FLOATFORMAT_CHAR_BIT);
7ab123
 
7ab123
+  /* An IBM long double (a two element array of double) can be classified
7ab123
+     by looking at the first double.  inf and nan are specified as
7ab123
+     ignoring the second double.  zero and subnormal will always have
7ab123
+     the second double 0.0 if the long double is correctly rounded.  */
7ab123
+  if (fmt->split_half)
7ab123
+    fmt = fmt->split_half;
7ab123
+
7ab123
   order = floatformat_normalize_byteorder (fmt, uval, newfrom);
7ab123
 
7ab123
   if (order != fmt->byteorder)
7ab123
@@ -669,6 +682,16 @@ floatformat_mantissa (const struct float
7ab123
   gdb_assert (fmt->totalsize
7ab123
 	      <= FLOATFORMAT_LARGEST_BYTES * FLOATFORMAT_CHAR_BIT);
7ab123
 
7ab123
+  /* For IBM long double (a two element array of double), return the
7ab123
+     mantissa of the first double.  The problem with returning the
7ab123
+     actual mantissa from both doubles is that there can be an
7ab123
+     arbitrary number of implied 0's or 1's between the mantissas
7ab123
+     of the first and second double.  In any case, this function
7ab123
+     is only used for dumping out nans, and a nan is specified to
7ab123
+     ignore the value in the second double.  */
7ab123
+  if (fmt->split_half)
7ab123
+    fmt = fmt->split_half;
7ab123
+
7ab123
   order = floatformat_normalize_byteorder (fmt, uval, newfrom);
7ab123
 
7ab123
   if (order != fmt->byteorder)
7ab123
@@ -926,27 +949,3 @@ convert_typed_floating (const void *from
7ab123
       floatformat_from_doublest (to_fmt, &d, to);
7ab123
     }
7ab123
 }
7ab123
-
7ab123
-const struct floatformat *floatformat_ieee_single[BFD_ENDIAN_UNKNOWN];
7ab123
-const struct floatformat *floatformat_ieee_double[BFD_ENDIAN_UNKNOWN];
7ab123
-const struct floatformat *floatformat_ieee_quad[BFD_ENDIAN_UNKNOWN];
7ab123
-const struct floatformat *floatformat_arm_ext[BFD_ENDIAN_UNKNOWN];
7ab123
-const struct floatformat *floatformat_ia64_spill[BFD_ENDIAN_UNKNOWN];
7ab123
-
7ab123
-extern void _initialize_doublest (void);
7ab123
-
7ab123
-extern void
7ab123
-_initialize_doublest (void)
7ab123
-{
7ab123
-  floatformat_ieee_single[BFD_ENDIAN_LITTLE] = &floatformat_ieee_single_little;
7ab123
-  floatformat_ieee_single[BFD_ENDIAN_BIG] = &floatformat_ieee_single_big;
7ab123
-  floatformat_ieee_double[BFD_ENDIAN_LITTLE] = &floatformat_ieee_double_little;
7ab123
-  floatformat_ieee_double[BFD_ENDIAN_BIG] = &floatformat_ieee_double_big;
7ab123
-  floatformat_arm_ext[BFD_ENDIAN_LITTLE]
7ab123
-    = &floatformat_arm_ext_littlebyte_bigword;
7ab123
-  floatformat_arm_ext[BFD_ENDIAN_BIG] = &floatformat_arm_ext_big;
7ab123
-  floatformat_ia64_spill[BFD_ENDIAN_LITTLE] = &floatformat_ia64_spill_little;
7ab123
-  floatformat_ia64_spill[BFD_ENDIAN_BIG] = &floatformat_ia64_spill_big;
7ab123
-  floatformat_ieee_quad[BFD_ENDIAN_LITTLE] = &floatformat_ia64_quad_little;
7ab123
-  floatformat_ieee_quad[BFD_ENDIAN_BIG] = &floatformat_ia64_quad_big;
7ab123
-}
7ab123
Index: gdb-7.6.1/gdb/gdbtypes.c
7ab123
===================================================================
7ab123
--- gdb-7.6.1.orig/gdb/gdbtypes.c
7ab123
+++ gdb-7.6.1/gdb/gdbtypes.c
7ab123
@@ -110,8 +110,8 @@ const struct floatformat *floatformats_v
7ab123
   &floatformat_vax_d
7ab123
 };
7ab123
 const struct floatformat *floatformats_ibm_long_double[BFD_ENDIAN_UNKNOWN] = {
7ab123
-  &floatformat_ibm_long_double,
7ab123
-  &floatformat_ibm_long_double
7ab123
+  &floatformat_ibm_long_double_big,
7ab123
+  &floatformat_ibm_long_double_little
7ab123
 };
7ab123
 
7ab123
 /* Should opaque types be resolved?  */