From 4010308ce53f36930935a230441630c8f5e79b86 Mon Sep 17 00:00:00 2001
From: "Steven G. Kargl" <kargl@gcc.gnu.org>
Date: Fri, 13 Oct 2006 19:08:37 +0000
Subject: [PATCH] spacing.m4: Use scalbn[f,l] if ldexp[f,l] is unavailable.

2006-10-13  Steven G. Kargl  <kargl@gcc.gnu.org>

        * m4/spacing.m4: Use scalbn[f,l] if ldexp[f,l] is unavailable.
        * m4/rrspacing.m4: Ditto.
        * generated/spacing_r4.c: Regenerated.
        * generated/spacing_r8.c: Ditto.
        * generated/spacing_r10.c: Ditto.
        * generated/spacing_r16.c: Ditto.
        * generated/rrspacing_r4.c: Ditto.
        * generated/rrspacing_r8.c: Ditto.
        * generated/rrspacing_r10.c: Ditto.
        * generated/rrspacing_r16.c: Ditto.

From-SVN: r117703
---
 libgfortran/ChangeLog                 | 13 +++++++++++++
 libgfortran/generated/rrspacing_r10.c |  7 ++++++-
 libgfortran/generated/rrspacing_r16.c |  7 ++++++-
 libgfortran/generated/rrspacing_r4.c  |  7 ++++++-
 libgfortran/generated/rrspacing_r8.c  |  7 ++++++-
 libgfortran/generated/spacing_r10.c   |  6 +++++-
 libgfortran/generated/spacing_r16.c   |  6 +++++-
 libgfortran/generated/spacing_r4.c    |  6 +++++-
 libgfortran/generated/spacing_r8.c    |  6 +++++-
 libgfortran/m4/rrspacing.m4           |  7 ++++++-
 libgfortran/m4/spacing.m4             |  6 +++++-
 11 files changed, 68 insertions(+), 10 deletions(-)

diff --git a/libgfortran/ChangeLog b/libgfortran/ChangeLog
index 9adf768d96dc..2852bbbaa8fe 100644
--- a/libgfortran/ChangeLog
+++ b/libgfortran/ChangeLog
@@ -1,3 +1,16 @@
+2006-10-13  Steven G. Kargl  <kargl@gcc.gnu.org>
+
+	* m4/spacing.m4: Use scalbn[f,l] if ldexp[f,l] is unavailable.
+	* m4/rrspacing.m4: Ditto.
+	* generated/spacing_r4.c: Regenerated.
+	* generated/spacing_r8.c: Ditto.
+	* generated/spacing_r10.c: Ditto.
+	* generated/spacing_r16.c: Ditto.
+	* generated/rrspacing_r4.c: Ditto.
+	* generated/rrspacing_r8.c: Ditto.
+	* generated/rrspacing_r10.c: Ditto.
+	* generated/rrspacing_r16.c: Ditto.
+
 2006-10-06  Steven G. Kargl  <kargl@gcc.gnu.org>
 
 	PR fortran/15441
diff --git a/libgfortran/generated/rrspacing_r10.c b/libgfortran/generated/rrspacing_r10.c
index 315fb1ba26c6..2950b71941ac 100644
--- a/libgfortran/generated/rrspacing_r10.c
+++ b/libgfortran/generated/rrspacing_r10.c
@@ -33,7 +33,7 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
-#if defined (HAVE_GFC_REAL_10) && defined (HAVE_FABSL) && defined (HAVE_FREXPL) && defined (HAVE_LDEXPL)
+#if defined (HAVE_GFC_REAL_10) && defined (HAVE_FABSL) && defined (HAVE_FREXPL)
 
 extern GFC_REAL_10 rrspacing_r10 (GFC_REAL_10 s, int p);
 export_proto(rrspacing_r10);
@@ -47,7 +47,12 @@ rrspacing_r10 (GFC_REAL_10 s, int p)
   if (x == 0.)
     return 0.;
   frexpl (s, &e);
+#if defined (HAVE_LDEXPL)
   return ldexpl (x, p - e);
+#else
+  return scalbnl (x, p - e);
+#endif
+
 }
 
 #endif
diff --git a/libgfortran/generated/rrspacing_r16.c b/libgfortran/generated/rrspacing_r16.c
index d18a9c3fea4c..20225d45baee 100644
--- a/libgfortran/generated/rrspacing_r16.c
+++ b/libgfortran/generated/rrspacing_r16.c
@@ -33,7 +33,7 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
-#if defined (HAVE_GFC_REAL_16) && defined (HAVE_FABSL) && defined (HAVE_FREXPL) && defined (HAVE_LDEXPL)
+#if defined (HAVE_GFC_REAL_16) && defined (HAVE_FABSL) && defined (HAVE_FREXPL)
 
 extern GFC_REAL_16 rrspacing_r16 (GFC_REAL_16 s, int p);
 export_proto(rrspacing_r16);
@@ -47,7 +47,12 @@ rrspacing_r16 (GFC_REAL_16 s, int p)
   if (x == 0.)
     return 0.;
   frexpl (s, &e);
+#if defined (HAVE_LDEXPL)
   return ldexpl (x, p - e);
+#else
+  return scalbnl (x, p - e);
+#endif
+
 }
 
 #endif
diff --git a/libgfortran/generated/rrspacing_r4.c b/libgfortran/generated/rrspacing_r4.c
index 0c7d1828e6d0..89be40b1a1cc 100644
--- a/libgfortran/generated/rrspacing_r4.c
+++ b/libgfortran/generated/rrspacing_r4.c
@@ -33,7 +33,7 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
-#if defined (HAVE_GFC_REAL_4) && defined (HAVE_FABSF) && defined (HAVE_FREXPF) && defined (HAVE_LDEXPF)
+#if defined (HAVE_GFC_REAL_4) && defined (HAVE_FABSF) && defined (HAVE_FREXPF)
 
 extern GFC_REAL_4 rrspacing_r4 (GFC_REAL_4 s, int p);
 export_proto(rrspacing_r4);
@@ -47,7 +47,12 @@ rrspacing_r4 (GFC_REAL_4 s, int p)
   if (x == 0.)
     return 0.;
   frexpf (s, &e);
+#if defined (HAVE_LDEXPF)
   return ldexpf (x, p - e);
+#else
+  return scalbnf (x, p - e);
+#endif
+
 }
 
 #endif
diff --git a/libgfortran/generated/rrspacing_r8.c b/libgfortran/generated/rrspacing_r8.c
index 3969f66941cf..9dc87381de15 100644
--- a/libgfortran/generated/rrspacing_r8.c
+++ b/libgfortran/generated/rrspacing_r8.c
@@ -33,7 +33,7 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
-#if defined (HAVE_GFC_REAL_8) && defined (HAVE_FABS) && defined (HAVE_FREXP) && defined (HAVE_LDEXP)
+#if defined (HAVE_GFC_REAL_8) && defined (HAVE_FABS) && defined (HAVE_FREXP)
 
 extern GFC_REAL_8 rrspacing_r8 (GFC_REAL_8 s, int p);
 export_proto(rrspacing_r8);
@@ -47,7 +47,12 @@ rrspacing_r8 (GFC_REAL_8 s, int p)
   if (x == 0.)
     return 0.;
   frexp (s, &e);
+#if defined (HAVE_LDEXP)
   return ldexp (x, p - e);
+#else
+  return scalbn (x, p - e);
+#endif
+
 }
 
 #endif
diff --git a/libgfortran/generated/spacing_r10.c b/libgfortran/generated/spacing_r10.c
index fd11ab65964e..797920c60c31 100644
--- a/libgfortran/generated/spacing_r10.c
+++ b/libgfortran/generated/spacing_r10.c
@@ -33,7 +33,7 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
-#if defined (HAVE_GFC_REAL_10) && defined (HAVE_FREXPL) && defined (HAVE_LDEXPL)
+#if defined (HAVE_GFC_REAL_10) && defined (HAVE_FREXPL)
 
 extern GFC_REAL_10 spacing_r10 (GFC_REAL_10 s, int p, int emin, GFC_REAL_10 tiny);
 export_proto(spacing_r10);
@@ -47,7 +47,11 @@ spacing_r10 (GFC_REAL_10 s, int p, int emin, GFC_REAL_10 tiny)
   frexpl (s, &e);
   e = e - p;
   e = e > emin ? e : emin;
+#if defined (HAVE_LDEXPL)
   return ldexpl (1., e);
+#else
+  return scalbnl (1., e);
+#endif
 }
 
 #endif
diff --git a/libgfortran/generated/spacing_r16.c b/libgfortran/generated/spacing_r16.c
index 333221a4b2eb..c13e9b11882f 100644
--- a/libgfortran/generated/spacing_r16.c
+++ b/libgfortran/generated/spacing_r16.c
@@ -33,7 +33,7 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
-#if defined (HAVE_GFC_REAL_16) && defined (HAVE_FREXPL) && defined (HAVE_LDEXPL)
+#if defined (HAVE_GFC_REAL_16) && defined (HAVE_FREXPL)
 
 extern GFC_REAL_16 spacing_r16 (GFC_REAL_16 s, int p, int emin, GFC_REAL_16 tiny);
 export_proto(spacing_r16);
@@ -47,7 +47,11 @@ spacing_r16 (GFC_REAL_16 s, int p, int emin, GFC_REAL_16 tiny)
   frexpl (s, &e);
   e = e - p;
   e = e > emin ? e : emin;
+#if defined (HAVE_LDEXPL)
   return ldexpl (1., e);
+#else
+  return scalbnl (1., e);
+#endif
 }
 
 #endif
diff --git a/libgfortran/generated/spacing_r4.c b/libgfortran/generated/spacing_r4.c
index 41cc72e9b2d4..1e09e1106c41 100644
--- a/libgfortran/generated/spacing_r4.c
+++ b/libgfortran/generated/spacing_r4.c
@@ -33,7 +33,7 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
-#if defined (HAVE_GFC_REAL_4) && defined (HAVE_FREXPF) && defined (HAVE_LDEXPF)
+#if defined (HAVE_GFC_REAL_4) && defined (HAVE_FREXPF)
 
 extern GFC_REAL_4 spacing_r4 (GFC_REAL_4 s, int p, int emin, GFC_REAL_4 tiny);
 export_proto(spacing_r4);
@@ -47,7 +47,11 @@ spacing_r4 (GFC_REAL_4 s, int p, int emin, GFC_REAL_4 tiny)
   frexpf (s, &e);
   e = e - p;
   e = e > emin ? e : emin;
+#if defined (HAVE_LDEXPF)
   return ldexpf (1., e);
+#else
+  return scalbnf (1., e);
+#endif
 }
 
 #endif
diff --git a/libgfortran/generated/spacing_r8.c b/libgfortran/generated/spacing_r8.c
index 0f925217e423..cde5d96f1fd1 100644
--- a/libgfortran/generated/spacing_r8.c
+++ b/libgfortran/generated/spacing_r8.c
@@ -33,7 +33,7 @@ Boston, MA 02110-1301, USA.  */
 #include "libgfortran.h"
 
 
-#if defined (HAVE_GFC_REAL_8) && defined (HAVE_FREXP) && defined (HAVE_LDEXP)
+#if defined (HAVE_GFC_REAL_8) && defined (HAVE_FREXP)
 
 extern GFC_REAL_8 spacing_r8 (GFC_REAL_8 s, int p, int emin, GFC_REAL_8 tiny);
 export_proto(spacing_r8);
@@ -47,7 +47,11 @@ spacing_r8 (GFC_REAL_8 s, int p, int emin, GFC_REAL_8 tiny)
   frexp (s, &e);
   e = e - p;
   e = e > emin ? e : emin;
+#if defined (HAVE_LDEXP)
   return ldexp (1., e);
+#else
+  return scalbn (1., e);
+#endif
 }
 
 #endif
diff --git a/libgfortran/m4/rrspacing.m4 b/libgfortran/m4/rrspacing.m4
index 6b3ccd55ec15..34ff98eb6988 100644
--- a/libgfortran/m4/rrspacing.m4
+++ b/libgfortran/m4/rrspacing.m4
@@ -34,7 +34,7 @@ Boston, MA 02110-1301, USA.  */
 
 include(`mtype.m4')dnl
 
-`#if defined (HAVE_'real_type`) && defined (HAVE_FABS'Q`) && defined (HAVE_FREXP'Q`) && defined (HAVE_LDEXP'Q`)'
+`#if defined (HAVE_'real_type`) && defined (HAVE_FABS'Q`) && defined (HAVE_FREXP'Q`)'
 
 extern real_type rrspacing_r`'kind (real_type s, int p);
 export_proto(rrspacing_r`'kind);
@@ -48,7 +48,12 @@ rrspacing_r`'kind (real_type s, int p)
   if (x == 0.)
     return 0.;
   frexp`'q (s, &e);
+`#if defined (HAVE_LDEXP'Q`)'
   return ldexp`'q (x, p - e);
+#else
+  return scalbn`'q (x, p - e);
+#endif
+
 }
 
 #endif
diff --git a/libgfortran/m4/spacing.m4 b/libgfortran/m4/spacing.m4
index 4aa4e19250f9..77b7a38e550f 100644
--- a/libgfortran/m4/spacing.m4
+++ b/libgfortran/m4/spacing.m4
@@ -34,7 +34,7 @@ Boston, MA 02110-1301, USA.  */
 
 include(`mtype.m4')dnl
 
-`#if defined (HAVE_'real_type`) && defined (HAVE_FREXP'Q`) && defined (HAVE_LDEXP'Q`)'
+`#if defined (HAVE_'real_type`) && defined (HAVE_FREXP'Q`)'
 
 extern real_type spacing_r`'kind (real_type s, int p, int emin, real_type tiny);
 export_proto(spacing_r`'kind);
@@ -48,7 +48,11 @@ spacing_r`'kind (real_type s, int p, int emin, real_type tiny)
   frexp`'q (s, &e);
   e = e - p;
   e = e > emin ? e : emin;
+`#if defined (HAVE_LDEXP'Q`)'
   return ldexp`'q (1., e);
+#else
+  return scalbn`'q (1., e);
+#endif
 }
 
 #endif
-- 
GitLab