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

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