summaryrefslogtreecommitdiff
path: root/sysdeps
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps')
-rw-r--r--sysdeps/ieee754/nan.h2
-rw-r--r--sysdeps/libm-ieee754/s_erf.c4
-rw-r--r--sysdeps/libm-ieee754/s_fdim.c4
-rw-r--r--sysdeps/libm-ieee754/s_fmax.c4
-rw-r--r--sysdeps/libm-ieee754/s_fmin.c4
-rw-r--r--sysdeps/libm-ieee754/s_log2.c4
-rw-r--r--sysdeps/libm-ieee754/s_nan.c9
-rw-r--r--sysdeps/libm-ieee754/s_nanf.c5
-rw-r--r--sysdeps/libm-ieee754/s_nanl.c6
-rw-r--r--sysdeps/libm-ieee754/s_remquo.c4
-rw-r--r--sysdeps/m68k/fpu/__math.h12
-rw-r--r--sysdeps/m68k/fpu/fraiseexcpt.c22
-rw-r--r--sysdeps/m68k/huge_val.h51
-rw-r--r--sysdeps/m68k/nan.h59
14 files changed, 133 insertions, 57 deletions
diff --git a/sysdeps/ieee754/nan.h b/sysdeps/ieee754/nan.h
index d4e6842562..499edbac8c 100644
--- a/sysdeps/ieee754/nan.h
+++ b/sysdeps/ieee754/nan.h
@@ -32,7 +32,7 @@
#define NANF \
(__extension__ \
- ((union { unsigned __l __attribute__((__mode__(__SI__))); flaot __d; }) \
+ ((union { unsigned __l __attribute__((__mode__(__SI__))); float __d; }) \
{ __l: 0x7fc00000UL }).__d)
#else
diff --git a/sysdeps/libm-ieee754/s_erf.c b/sysdeps/libm-ieee754/s_erf.c
index 022cf11abe..f64f0fcefd 100644
--- a/sysdeps/libm-ieee754/s_erf.c
+++ b/sysdeps/libm-ieee754/s_erf.c
@@ -247,6 +247,10 @@ sb7 = -2.24409524465858183362e+01; /* 0xC03670E2, 0x42712D62 */
if(hx>=0) return one-r/x; else return r/x-one;
}
weak_alias (__erf, erf)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__erf, __erfl)
+weak_alias (__erf, erfl)
+#endif
#ifdef __STDC__
double __erfc(double x)
diff --git a/sysdeps/libm-ieee754/s_fdim.c b/sysdeps/libm-ieee754/s_fdim.c
index cdd7886068..b45c413cb8 100644
--- a/sysdeps/libm-ieee754/s_fdim.c
+++ b/sysdeps/libm-ieee754/s_fdim.c
@@ -34,3 +34,7 @@ __fdim (double x, double y)
return x < y ? 0 : x - y;
}
weak_alias (__fdim, fdim)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__fdim, __fdiml)
+weak_alias (__fdim, fdiml)
+#endif
diff --git a/sysdeps/libm-ieee754/s_fmax.c b/sysdeps/libm-ieee754/s_fmax.c
index 651def8aac..bc6af7286c 100644
--- a/sysdeps/libm-ieee754/s_fmax.c
+++ b/sysdeps/libm-ieee754/s_fmax.c
@@ -27,3 +27,7 @@ __fmax (double x, double y)
return (isgreaterequal (x, y) || isnan (y)) ? x : y;
}
weak_alias (__fmax, fmax)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__fmax, __fmaxl)
+weak_alias (__fmax, fmaxl)
+#endif
diff --git a/sysdeps/libm-ieee754/s_fmin.c b/sysdeps/libm-ieee754/s_fmin.c
index 2a49a2e069..f9a937c850 100644
--- a/sysdeps/libm-ieee754/s_fmin.c
+++ b/sysdeps/libm-ieee754/s_fmin.c
@@ -27,3 +27,7 @@ __fmin (double x, double y)
return (islessequal (x, y) || isnan (y)) ? x : y;
}
weak_alias (__fmin, fmin)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__fmim, __fminl)
+weak_alias (__fmin, fminl)
+#endif
diff --git a/sysdeps/libm-ieee754/s_log2.c b/sysdeps/libm-ieee754/s_log2.c
index 7950dfa420..46b53cfeff 100644
--- a/sysdeps/libm-ieee754/s_log2.c
+++ b/sysdeps/libm-ieee754/s_log2.c
@@ -129,3 +129,7 @@ static double zero = 0.0;
}
weak_alias (__log2, log2)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__log2, __log2l)
+weak_alias (__log2, log2l)
+#endif
diff --git a/sysdeps/libm-ieee754/s_nan.c b/sysdeps/libm-ieee754/s_nan.c
index 1d2319cbd8..ff3b26855f 100644
--- a/sysdeps/libm-ieee754/s_nan.c
+++ b/sysdeps/libm-ieee754/s_nan.c
@@ -28,9 +28,6 @@
double
__nan (const char *tagp)
{
- static const union ieee754_double nan_value =
- { ieee: { mantissa1: 0, mantissa0: 0x80000, exponent: 0x7ff, negative: 0 } };
-
if (tagp[0] != '\0')
{
char buf[6 + strlen (tagp)];
@@ -38,6 +35,10 @@ __nan (const char *tagp)
return strtod (buf, NULL);
}
- return nan_value.d;
+ return NAN;
}
weak_alias (__nan, nan)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__nan, __nanl)
+weak_alias (__nan, nanl)
+#endif
diff --git a/sysdeps/libm-ieee754/s_nanf.c b/sysdeps/libm-ieee754/s_nanf.c
index 56fb9e7e3d..862327aa1e 100644
--- a/sysdeps/libm-ieee754/s_nanf.c
+++ b/sysdeps/libm-ieee754/s_nanf.c
@@ -28,9 +28,6 @@
float
__nanf (const char *tagp)
{
- static const union ieee754_float nan_value =
- { ieee: { mantissa: 0x400000, exponent: 0xff, negative: 0 } };
-
if (tagp[0] != '\0')
{
char buf[6 + strlen (tagp)];
@@ -38,6 +35,6 @@ __nanf (const char *tagp)
return strtof (buf, NULL);
}
- return nan_value.f;
+ return NANF;
}
weak_alias (__nanf, nanf)
diff --git a/sysdeps/libm-ieee754/s_nanl.c b/sysdeps/libm-ieee754/s_nanl.c
index 279e070492..223f95082e 100644
--- a/sysdeps/libm-ieee754/s_nanl.c
+++ b/sysdeps/libm-ieee754/s_nanl.c
@@ -28,10 +28,6 @@
long double
__nanl (const char *tagp)
{
- static const union ieee854_long_double nan_value =
- { ieee: { mantissa1: 0, mantissa0: 0xc0000000,
- exponent: 0x7fff, negative: 0 } };
-
if (tagp[0] != '\0')
{
char buf[6 + strlen (tagp)];
@@ -39,6 +35,6 @@ __nanl (const char *tagp)
return strtold (buf, NULL);
}
- return nan_value.d;
+ return NANL;
}
weak_alias (__nanl, nanl)
diff --git a/sysdeps/libm-ieee754/s_remquo.c b/sysdeps/libm-ieee754/s_remquo.c
index 4103155e3f..f0a32130a2 100644
--- a/sysdeps/libm-ieee754/s_remquo.c
+++ b/sysdeps/libm-ieee754/s_remquo.c
@@ -110,3 +110,7 @@ __remquo (double x, double y, int *quo)
return x;
}
weak_alias (__remquo, remquo)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__remquo, __remquol)
+weak_alias (__remquo, remquol)
+#endif
diff --git a/sysdeps/m68k/fpu/__math.h b/sysdeps/m68k/fpu/__math.h
index 5dc4d2e066..fd90a2de1b 100644
--- a/sysdeps/m68k/fpu/__math.h
+++ b/sysdeps/m68k/fpu/__math.h
@@ -414,7 +414,7 @@ __inline_forward(void,sincosl,
#define isgreater(x, y) \
__extension__ \
({ char __result; \
- __asm__ ("fcmp %2,%1; fsogt %0" \
+ __asm__ ("fcmp%.x %2,%1; fsogt %0" \
: "=dm" (__result) : "f" (x), "f" (y)); \
(int) __result; })
@@ -422,7 +422,7 @@ __inline_forward(void,sincosl,
#define isgreaterequal(x, y) \
__extension__ \
({ char __result; \
- __asm__ ("fcmp %2,%1; fsoge %0" \
+ __asm__ ("fcmp%.x %2,%1; fsoge %0" \
: "=dm" (__result) : "f" (x), "f" (y)); \
(int) __result; })
@@ -430,7 +430,7 @@ __inline_forward(void,sincosl,
#define isless(x, y) \
__extension__ \
({ char __result; \
- __asm__ ("fcmp %2,%1; fsolt %0" \
+ __asm__ ("fcmp%.x %2,%1; fsolt %0" \
: "=dm" (__result) : "f" (x), "f" (y)); \
(int) __result; })
@@ -438,7 +438,7 @@ __inline_forward(void,sincosl,
#define islessequal(x, y) \
__extension__ \
({ char __result; \
- __asm__ ("fcmp %2,%1; fsole %0" \
+ __asm__ ("fcmp%.x %2,%1; fsole %0" \
: "=dm" (__result) : "f" (x), "f" (y)); \
(int) __result; })
@@ -446,7 +446,7 @@ __inline_forward(void,sincosl,
#define islessgreater(x, y) \
__extension__ \
({ char __result; \
- __asm__ ("fcmp %2,%1; fsogl %0" \
+ __asm__ ("fcmp%.x %2,%1; fsogl %0" \
: "=dm" (__result) : "f" (x), "f" (y)); \
(int) __result; })
@@ -454,7 +454,7 @@ __inline_forward(void,sincosl,
#define isunordered(x, y) \
__extension__ \
({ char __result; \
- __asm__ ("fcmp %2,%1; fsun %0" \
+ __asm__ ("fcmp%.x %2,%1; fsun %0" \
: "=dm" (__result) : "f" (x), "f" (y)); \
(int) __result; })
#endif
diff --git a/sysdeps/m68k/fpu/fraiseexcpt.c b/sysdeps/m68k/fpu/fraiseexcpt.c
index b6ff82760d..51411dd292 100644
--- a/sysdeps/m68k/fpu/fraiseexcpt.c
+++ b/sysdeps/m68k/fpu/fraiseexcpt.c
@@ -34,9 +34,8 @@ feraiseexcept (int excepts)
if (excepts & FE_INVALID)
{
/* One example of a invalid operation is 0 * Infinity. */
- double d = 0.0 * HUGE_VAL;
- /* Now force the exception. */
- __asm__ __volatile__ ("fnop" : : "f" (d));
+ double d = HUGE_VAL;
+ __asm__ __volatile__ ("fmul%.s %#0r0,%0; fnop" : "=f" (d) : "0" (d));
}
/* Next: division by zero. */
@@ -49,26 +48,21 @@ feraiseexcept (int excepts)
/* Next: overflow. */
if (excepts & FE_OVERFLOW)
{
- long double d = LDBL_MAX * LDBL_MAX;
- /* Now force the exception. */
- __asm__ __volatile__ ("fnop" : : "f" (d));
+ long double d = LDBL_MAX;
+ __asm__ __volatile__ ("fmul%.x %0,%0; fnop" : "=f" (d) : "0" (d));
}
/* Next: underflow. */
if (excepts & FE_UNDERFLOW)
{
- long double d = LDBL_MIN / 16.0;
- /* Now force the exception. */
- __asm__ __volatile__ ("fnop" : : "f" (d));
+ long double d = LDBL_MIN;
+ __asm__ __volatile__ ("fdiv%.s %#0r16,%0; fnop" : "=f" (d) : "0" (d));
}
/* Last: inexact. */
if (excepts & FE_INEXACT)
{
- long double d1, d2 = 1.0;
- __asm__ __volatile__ ("fmovecr %#0,%0\n\t"
- "fdiv%.x %1,%0\n\t"
- "fnop"
- : "=&f" (d1) : "f" (d2));
+ long double d = 1.0;
+ __asm__ __volatile__ ("fdiv%.s %#0r3,%0; fnop" : "=f" (d) : "0" (d));
}
}
diff --git a/sysdeps/m68k/huge_val.h b/sysdeps/m68k/huge_val.h
index 8d45aaec2b..c71454e9a8 100644
--- a/sysdeps/m68k/huge_val.h
+++ b/sysdeps/m68k/huge_val.h
@@ -26,15 +26,19 @@
/* IEEE positive infinity (-HUGE_VAL is negative infinity). */
-#define __HUGE_VAL_bytes { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 }
-
-#define __huge_val_t union { unsigned char __c[8]; double __d; }
#ifdef __GNUC__
-#define HUGE_VAL (__extension__ \
- ((__huge_val_t) { __c: __HUGE_VAL_bytes }).__d)
-#else /* Not GCC. */
-static __huge_val_t __huge_val = { __HUGE_VAL_bytes };
+
+#define HUGE_VAL \
+ (__extension__ \
+ ((union { unsigned long long __l; double __d; }) \
+ { __l: 0x7ff0000000000000ULL }).__d)
+
+#else /* not GCC */
+
+static union { unsigned char __c[8]; double __d; } __huge_val =
+ { { 0x7f, 0xf0, 0, 0, 0, 0, 0, 0 } };
#define HUGE_VAL (__huge_val.__d)
+
#endif /* GCC. */
@@ -42,27 +46,28 @@ static __huge_val_t __huge_val = { __HUGE_VAL_bytes };
#ifdef __USE_ISOC9X
-#define __HUGE_VALF_bytes { 0x7f, 0x80, 0, 0 }
+#ifdef __GNUC__
-#define __huge_valf_t union { unsigned char __c[4]; float __f; }
-#ifdef __GNUC__
-#define HUGE_VALF (__extension__ \
- ((__huge_valf_t) { __c: __HUGE_VALF_bytes }).__f)
-#else /* Not GCC. */
-static __huge_valf_t __huge_valf = { __HUGE_VALF_bytes };
-#define HUGE_VALF (__huge_valf.__f)
-#endif /* GCC. */
+#define HUGE_VALF \
+ (__extension__ \
+ ((union { unsigned long __l; float __f; }) \
+ { __l: 0x7f800000UL }).__f)
+#define HUGE_VALL \
+ (__extension__ \
+ ((union { unsigned long __l[3]; long double __ld; }) \
+ { __l: { 0x7fff0000UL, 0x80000000UL, 0UL } }).__ld)
-#define __HUGE_VALL_bytes { 0x7f, 0xff, 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0 }
+#else /* not GCC */
-#define __huge_vall_t union { unsigned char __c[12]; long double __ld; }
-#ifdef __GNUC__
-#define HUGE_VALL (__extension__ \
- ((__huge_vall_t) { __c: __HUGE_VALL_bytes }).__ld)
-#else /* Not GCC. */
-static __huge_vall_t __huge_vall = { __HUGE_VALL_bytes };
+static union { unsigned char __c[4]; float __f; } __huge_valf =
+ { { 0x7f, 0x80, 0, 0 } };
+#define HUGE_VALF (__huge_valf.__f)
+
+static union { unsigned char __c[12]; long double __ld; } __huge_vall =
+ { { 0x7f, 0xff, 0, 0, 0x80, 0, 0, 0, 0, 0, 0, 0 } };
#define HUGE_VALL (__huge_vall.__ld)
+
#endif /* GCC. */
#endif /* __USE_ISOC9X. */
diff --git a/sysdeps/m68k/nan.h b/sysdeps/m68k/nan.h
new file mode 100644
index 0000000000..b4efddfe91
--- /dev/null
+++ b/sysdeps/m68k/nan.h
@@ -0,0 +1,59 @@
+/* `NAN' constants for m68k.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _NAN_H
+
+#define _NAN_H 1
+
+/* IEEE Not A Number. */
+
+#ifdef __GNUC__
+
+#define NAN \
+ (__extension__ \
+ ((union { unsigned long long __l; double __d; }) \
+ { __l: 0x7fffffffffffffffULL }).__d)
+
+#define NANF \
+ (__extension__ \
+ ((union { unsigned long __l; float __f; }) \
+ { __l: 0x7fffffffUL }).__f)
+
+#define NANL \
+ (__extension__ \
+ ((union { unsigned long __l[3]; long double __ld; }) \
+ { __l: { 0x7fff0000UL, 0xffffffffUL, 0xffffffffUL } }).__ld)
+
+#else
+
+static union { unsigned char __c[8]; double __d; } __nan =
+ { { 0x7f, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } };
+#define NAN (__nan.__d)
+
+static union { unsigned char __c[4]; float __f; } __nanf =
+ { { 0x7f, 0xff, 0xff, 0xff } };
+#define NANF (__nanf.__f)
+
+static union { unsigned char __c[12]; long double __ld; } __nanl =
+ { { 0x7f, 0xff, 0, 0, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff } };
+#define NANL (__nanl.__ld)
+
+#endif /* GCC. */
+
+#endif /* nan.h */