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

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