[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commits] r877 - in /trunk: libc/ libc/misc/ libc/sysdeps/powerpc/bits/ libc/sysdeps/powerpc/fpu/ libc/sysdeps/powerpc/fpu/bits/ libc/...
- To: commits@xxxxxxxxxx
- Subject: [commits] r877 - in /trunk: libc/ libc/misc/ libc/sysdeps/powerpc/bits/ libc/sysdeps/powerpc/fpu/ libc/sysdeps/powerpc/fpu/bits/ libc/...
- From: joseph@xxxxxxxxxx
- Date: Thu, 07 Dec 2006 18:33:12 -0000
Author: joseph
Date: Thu Dec 7 10:33:12 2006
New Revision: 877
Log:
libc:
* misc/tst-efgcvt.c (ecvt_tests): Disable subnormal test for E500
double.
* sysdeps/powerpc/bits/fenv.h: Include E500 definitions. Based on
SPE add-on by Aldy Hernandez.
* sysdeps/powerpc/fpu/bits/fenvinline.h: Change _SOFT_FLOAT to
__NO_FPRS__.
* sysdeps/powerpc/fpu/bits/mathinline.h: Likewise.
* sysdeps/powerpc/fpu/fpu_control.h: Include soft-float and E500
definitions. Based on SPE add-on by Aldy Hernandez.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S:
If __CONTEXT_EXTRA defined, include <getcontext-extra.S>.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S:
If __CONTEXT_EXTRA defined, include <setcontext-extra.S>.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S:
If __CONTEXT_EXTRA defined, include <getcontext-extra.S> and
<setcontext-extra.S>.
ports:
Add PowerPC E500 port, based on SPE add-on by Aldy Hernandez.
* sysdeps/powerpc/preconfigure: New.
* sysdeps/powerpc/powerpc32/e500: New.
* sysdeps/unix/sysv/linux/powerpc/powerpc32/e500: New.
Added:
trunk/ports/sysdeps/powerpc/powerpc32/
trunk/ports/sysdeps/powerpc/powerpc32/e500/
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/Makefile
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/Versions
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/__longjmp-common.S
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/__longjmp.S
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/atosfix16.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/atosfix32.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/atosfix64.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/atoufix16.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/atoufix32.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/atoufix64.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/e_sqrt.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/e_sqrtf.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fclrexcpt.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fe_nomask.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fedisblxcpt.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/feenablxcpt.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fegetenv.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fegetexcept.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fegetround.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/feholdexcpt.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fenv_const.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fenv_libc.h
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fesetenv.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fesetround.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/feupdateenv.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fgetexcptflg.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fprrest.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fprsave.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fraiseexcpt.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fsetexcptflg.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/ftestexcept.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/math_ldbl.h
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/math_private.h
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_ceil.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_ceilf.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_copysign.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_copysignf.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_copysignl.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fabs.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fabsf.S
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fabsl.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fdim.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fdimf.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_floor.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_floorf.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fmax.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fmaxf.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fmin.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fminf.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_isnan.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_isnanf.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_llrint.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_llrintf.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_llround.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_llroundf.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_lrint.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_lrintf.S
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_lround.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_lroundf.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_rint.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_rintf.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_round.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_roundf.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_trunc.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_truncf.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/setjmp-common.S
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/setjmp.S
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/strtofix.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/strtosfix16.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/strtosfix32.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/strtosfix64.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/strtoufix16.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/strtoufix32.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/strtoufix64.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/t_sqrt.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/w_sqrt.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/w_sqrtf.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/soft-fp/
trunk/ports/sysdeps/powerpc/powerpc32/e500/soft-fp/Makefile
trunk/ports/sysdeps/powerpc/powerpc32/e500/soft-fp/Subdirs
trunk/ports/sysdeps/powerpc/powerpc32/e500/soft-fp/Versions
trunk/ports/sysdeps/powerpc/powerpc32/e500/soft-fp/fraiseexcept-soft.c
trunk/ports/sysdeps/powerpc/powerpc32/e500/soft-fp/sfp-machine.h
trunk/ports/sysdeps/powerpc/powerpc32/e500/spe-raise.c
trunk/ports/sysdeps/powerpc/preconfigure
trunk/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/
trunk/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/fpu/
trunk/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/fpu/Implies
trunk/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/fpu/getcontext-extra.S
trunk/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/fpu/getcontext.S
trunk/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/fpu/setcontext-extra.S
trunk/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/fpu/setcontext.S
trunk/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/fpu/swapcontext.S
trunk/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/
trunk/ports/sysdeps/unix/sysv/linux/powerpc/powerpc32/e500/single/Implies
Modified:
trunk/libc/ChangeLog.eglibc
trunk/libc/misc/tst-efgcvt.c
trunk/libc/sysdeps/powerpc/bits/fenv.h
trunk/libc/sysdeps/powerpc/fpu/bits/fenvinline.h
trunk/libc/sysdeps/powerpc/fpu/bits/mathinline.h
trunk/libc/sysdeps/powerpc/fpu/fpu_control.h
trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S
trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S
trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S
trunk/ports/ChangeLog.eglibc
Modified: trunk/libc/ChangeLog.eglibc
==============================================================================
--- trunk/libc/ChangeLog.eglibc (original)
+++ trunk/libc/ChangeLog.eglibc Thu Dec 7 10:33:12 2006
@@ -1,3 +1,22 @@
+2006-12-07 Joseph Myers <joseph@xxxxxxxxxxxxxxxx>
+
+ * misc/tst-efgcvt.c (ecvt_tests): Disable subnormal test for E500
+ double.
+ * sysdeps/powerpc/bits/fenv.h: Include E500 definitions. Based on
+ SPE add-on by Aldy Hernandez.
+ * sysdeps/powerpc/fpu/bits/fenvinline.h: Change _SOFT_FLOAT to
+ __NO_FPRS__.
+ * sysdeps/powerpc/fpu/bits/mathinline.h: Likewise.
+ * sysdeps/powerpc/fpu/fpu_control.h: Include soft-float and E500
+ definitions. Based on SPE add-on by Aldy Hernandez.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S:
+ If __CONTEXT_EXTRA defined, include <getcontext-extra.S>.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S:
+ If __CONTEXT_EXTRA defined, include <setcontext-extra.S>.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S:
+ If __CONTEXT_EXTRA defined, include <getcontext-extra.S> and
+ <setcontext-extra.S>.
+
2006-11-13 Joseph S. Myers <joseph@xxxxxxxxxxxxxxxx>
* sysdeps/alpha/bits/mathdef.h (float_t): Always define as float.
Modified: trunk/libc/misc/tst-efgcvt.c
==============================================================================
--- trunk/libc/misc/tst-efgcvt.c (original)
+++ trunk/libc/misc/tst-efgcvt.c Thu Dec 7 10:33:12 2006
@@ -60,7 +60,7 @@
{ 123.01, -4, 3, "" },
{ 126.71, -4, 3, "" },
{ 0.0, 4, 1, "0000" },
-#if DBL_MANT_DIG == 53
+#if DBL_MANT_DIG == 53 && !(defined __powerpc__ && defined __NO_FPRS__ && !defined _SOFT_FLOAT && !defined _SOFT_DOUBLE)
{ 0x1p-1074, 3, -323, "494" },
{ -0x1p-1074, 3, -323, "494" },
#endif
Modified: trunk/libc/sysdeps/powerpc/bits/fenv.h
==============================================================================
--- trunk/libc/sysdeps/powerpc/bits/fenv.h (original)
+++ trunk/libc/sysdeps/powerpc/bits/fenv.h Thu Dec 7 10:33:12 2006
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc.
+/* Copyright (C) 1997, 1998, 1999, 2004, 2006 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
@@ -20,6 +20,66 @@
# error "Never use <bits/fenv.h> directly; include <fenv.h> instead."
#endif
+#if defined __NO_FPRS__ && !defined _SOFT_FLOAT /* E500 */
+
+/* Define bits representing the exception. We use the bit positions of
+ the appropriate bits in the SPEFSCR... */
+enum
+ {
+ FE_INEXACT = 1 << (63 - 42),
+#define FE_INEXACT FE_INEXACT
+ FE_INVALID = 1 << (63 - 43),
+#define FE_INVALID FE_INVALID
+ FE_DIVBYZERO = 1 << (63 - 44),
+#define FE_DIVBYZERO FE_DIVBYZERO
+ FE_UNDERFLOW = 1 << (63 - 45),
+#define FE_UNDERFLOW FE_UNDERFLOW
+ FE_OVERFLOW = 1 << (63 - 46)
+#define FE_OVERFLOW FE_OVERFLOW
+ };
+
+#define FE_ALL_EXCEPT \
+ (FE_INEXACT | FE_DIVBYZERO | FE_UNDERFLOW | FE_OVERFLOW | FE_INVALID)
+
+/* The E500 support all of the four defined rounding modes. We use
+ the bit pattern in the SPEFSCR as the values for the appropriate
+ macros. */
+enum
+ {
+ FE_TONEAREST = 0,
+#define FE_TONEAREST FE_TONEAREST
+ FE_TOWARDZERO = 1,
+#define FE_TOWARDZERO FE_TOWARDZERO
+ FE_UPWARD = 2,
+#define FE_UPWARD FE_UPWARD
+ FE_DOWNWARD = 3
+#define FE_DOWNWARD FE_DOWNWARD
+ };
+
+/* Type representing exception flags. */
+typedef unsigned int fexcept_t;
+
+typedef double fenv_t;
+
+/* If the default argument is used we use this value. */
+extern const fenv_t __fe_dfl_env;
+#define FE_DFL_ENV (&__fe_dfl_env)
+
+#ifdef __USE_GNU
+/* Floating-point environment where all exceptions are enabled. Note that
+ this is not sufficient to give you SIGFPE. */
+extern const fenv_t __fe_enabled_env;
+# define FE_ENABLED_ENV (&__fe_enabled_env)
+
+/* Floating-point environment with all exceptions enabled. Note that
+ just evaluating this value will set the processor into 'FPU
+ exceptions imprecise recoverable' mode, which may cause a significant
+ performance penalty (but have no other visible effect). */
+extern const fenv_t *__fe_nomask_env (void);
+# define FE_NOMASK_ENV (__fe_nomask_env ())
+#endif
+
+#else /* PowerPC 6xx floating-point. */
/* Define bits representing the exception. We use the bit positions of
the appropriate bits in the FPSCR... */
@@ -143,3 +203,5 @@
extern const fenv_t *__fe_nomask_env (void);
# define FE_NOMASK_ENV (__fe_nomask_env ())
#endif
+
+#endif
Modified: trunk/libc/sysdeps/powerpc/fpu/bits/fenvinline.h
==============================================================================
--- trunk/libc/sysdeps/powerpc/fpu/bits/fenvinline.h (original)
+++ trunk/libc/sysdeps/powerpc/fpu/bits/fenvinline.h Thu Dec 7 10:33:12 2006
@@ -18,7 +18,7 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
-#if defined __GNUC__ && !defined _SOFT_FLOAT && !defined __NO_MATH_INLINES
+#if defined __GNUC__ && !defined __NO_FPRS__ && !defined __NO_MATH_INLINES
/* Inline definition for fegetround. */
# define fegetround() \
@@ -58,4 +58,4 @@
: 0) \
: (feclearexcept) (__excepts))
-#endif /* __GNUC__ && !_SOFT_FLOAT */
+#endif /* __GNUC__ && !__NO_FPRS__ */
Modified: trunk/libc/sysdeps/powerpc/fpu/bits/mathinline.h
==============================================================================
--- trunk/libc/sysdeps/powerpc/fpu/bits/mathinline.h (original)
+++ trunk/libc/sysdeps/powerpc/fpu/bits/mathinline.h Thu Dec 7 10:33:12 2006
@@ -28,7 +28,7 @@
# define __MATH_INLINE extern __inline
#endif /* __cplusplus */
-#if defined __GNUC__ && !defined _SOFT_FLOAT
+#if defined __GNUC__ && !defined __NO_FPRS__
#ifdef __USE_ISOC99
# if !__GNUC_PREREQ (2,97)
@@ -121,4 +121,4 @@
#endif /* __USE_ISOC99 */
#endif /* !__NO_MATH_INLINES && __OPTIMIZE__ */
-#endif /* __GNUC__ && !_SOFT_FLOAT */
+#endif /* __GNUC__ && !__NO_FPRS__ */
Modified: trunk/libc/sysdeps/powerpc/fpu/fpu_control.h
==============================================================================
--- trunk/libc/sysdeps/powerpc/fpu/fpu_control.h (original)
+++ trunk/libc/sysdeps/powerpc/fpu/fpu_control.h Thu Dec 7 10:33:12 2006
@@ -1,5 +1,5 @@
/* FPU control word definitions. PowerPC version.
- Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
+ Copyright (C) 1996, 1997, 1998, 2004, 2006 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
@@ -19,6 +19,57 @@
#ifndef _FPU_CONTROL_H
#define _FPU_CONTROL_H
+
+#ifdef _SOFT_FLOAT
+
+#define _FPU_RESERVED 0xffffffff
+#define _FPU_DEFAULT 0x00000000 /* Default value. */
+typedef unsigned int fpu_control_t;
+#define _FPU_GETCW(cw) 0
+#define _FPU_SETCW(cw) do { } while (0)
+extern fpu_control_t __fpu_control;
+
+#elif defined __NO_FPRS__ /* E500 */
+
+/* rounding control */
+#define _FPU_RC_NEAREST 0x00 /* RECOMMENDED */
+#define _FPU_RC_DOWN 0x03
+#define _FPU_RC_UP 0x02
+#define _FPU_RC_ZERO 0x01
+
+/* masking of interrupts */
+#define _FPU_MASK_ZM 0x10 /* zero divide */
+#define _FPU_MASK_OM 0x40 /* overflow */
+#define _FPU_MASK_UM 0x80 /* underflow */
+#define _FPU_MASK_XM 0x40 /* inexact */
+#define _FPU_MASK_IM 0x20 /* invalid operation */
+
+#define _FPU_RESERVED 0xff3fff7f /* These bits are reserved are not changed. */
+
+/* The fdlibm code requires no interrupts for exceptions. */
+#define _FPU_DEFAULT 0x00000000 /* Default value. */
+
+/* IEEE: same as above, but (some) exceptions;
+ we leave the 'inexact' exception off.
+ */
+#define _FPU_IEEE 0x000003c0
+
+/* Type of the control word. */
+typedef unsigned int fpu_control_t;
+
+/* Macros for accessing the hardware control word. */
+#define _FPU_GETCW(__cw) ({ \
+ unsigned int env; \
+ asm volatile ("mfspefscr %0" : "=r" (env)); \
+ (__cw) = env; })
+#define _FPU_SETCW(__cw) ({ \
+ unsigned int env = __cw; \
+ asm volatile ("mtspefscr %0" : : "r" (env)); })
+
+/* Default control word set at startup. */
+extern fpu_control_t __fpu_control;
+
+#else /* PowerPC 6xx floating-point. */
/* rounding control */
#define _FPU_RC_NEAREST 0x00 /* RECOMMENDED */
@@ -66,4 +117,6 @@
/* Default control word set at startup. */
extern fpu_control_t __fpu_control;
+#endif
+
#endif /* _FPU_CONTROL_H */
Modified: trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S
==============================================================================
--- trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S (original)
+++ trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/getcontext-common.S Thu Dec 7 10:33:12 2006
@@ -267,6 +267,11 @@
2: /* L(no_vec): */
# endif
#endif
+
+#ifdef __CONTEXT_EXTRA
+#include <getcontext-extra.S>
+#endif
+
/* We need to set up parms and call sigprocmask which will clobber
volatile registers. So before the call we need to retrieve the
original ucontext ptr (parm1) from stack and store the UC_REGS_PTR
Modified: trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S
==============================================================================
--- trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S (original)
+++ trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/setcontext-common.S Thu Dec 7 10:33:12 2006
@@ -233,6 +233,10 @@
lfd fp31,_UC_FREGS+(31*8)(r31)
#endif /* __CONTEXT_ENABLE_FPRS */
+#ifdef __CONTEXT_EXTRA
+#include <setcontext-extra.S>
+#endif
+
/* Restore LR and CCR, and set CTR to the NIP value */
lwz r3,_UC_GREGS+(PT_LNK*4)(r31)
lwz r4,_UC_GREGS+(PT_NIP*4)(r31)
Modified: trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S
==============================================================================
--- trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S (original)
+++ trunk/libc/sysdeps/unix/sysv/linux/powerpc/powerpc32/swapcontext-common.S Thu Dec 7 10:33:12 2006
@@ -270,6 +270,10 @@
# endif /* __CONTEXT_ENABLE_VRS */
#endif /* __CONTEXT_ENABLE_FPRS */
+#ifdef __CONTEXT_EXTRA
+#include <getcontext-extra.S>
+#endif
+
/* Restore ucontext (parm1) from stack. */
lwz r12,_FRAME_PARM_SAVE1(r1)
li r4,0
@@ -459,6 +463,10 @@
lfd fp31,_UC_FREGS+(31*8)(r31)
#endif /* __CONTEXT_ENABLE_FPRS */
+#ifdef __CONTEXT_EXTRA
+#include <setcontext-extra.S>
+#endif
+
/* Restore LR and CCR, and set CTR to the NIP value */
lwz r3,_UC_GREGS+(PT_LNK*4)(r31)
lwz r4,_UC_GREGS+(PT_NIP*4)(r31)
Modified: trunk/ports/ChangeLog.eglibc
==============================================================================
--- trunk/ports/ChangeLog.eglibc (original)
+++ trunk/ports/ChangeLog.eglibc Thu Dec 7 10:33:12 2006
@@ -1,3 +1,10 @@
+2006-12-07 Joseph Myers <joseph@xxxxxxxxxxxxxxxx>
+
+ Add PowerPC E500 port, based on SPE add-on by Aldy Hernandez.
+ * sysdeps/powerpc/preconfigure: New.
+ * sysdeps/powerpc/powerpc32/e500: New.
+ * sysdeps/unix/sysv/linux/powerpc/powerpc32/e500: New.
+
2006-11-14 Joseph Myers <joseph@xxxxxxxxxxxxxxxx>
* sysdeps/powerpc/nofpu/libm-test-ulps: Add more ULPs.
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/Makefile
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/Makefile (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/Makefile Thu Dec 7 10:33:12 2006
@@ -1,0 +1,5 @@
+ifeq ($(subdir),stdlib)
+spepim_routines = atosfix16 atosfix32 atosfix64 atoufix16 atoufix32 atoufix64 \
+ strtosfix16 strtosfix32 strtosfix64 strtoufix16 strtoufix32 strtoufix64
+sysdep_routines += $(spepim_routines)
+endif
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/Versions
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/Versions (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/Versions Thu Dec 7 10:33:12 2006
@@ -1,0 +1,8 @@
+libc {
+ GLIBC_2.3.3 {
+ atosfix16; atosfix32; atosfix64;
+ atoufix16; atoufix32; atoufix64;
+ strtosfix16; strtosfix32; strtosfix64;
+ strtoufix16; strtoufix32; strtoufix64;
+ }
+}
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/__longjmp-common.S
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/__longjmp-common.S (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/__longjmp-common.S Thu Dec 7 10:33:12 2006
@@ -1,0 +1,103 @@
+/* longjmp for PowerPC E500.
+ Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+ Contributed by Aldy Hernandez <aldyh@xxxxxxxxxx>.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+#define _ASM
+#define _SETJMP_H
+#ifdef __NO_VMX__
+# include <novmxsetjmp.h>
+#else
+# include <jmpbuf-offsets.h>
+#endif
+#include <bp-sym.h>
+#include <bp-asm.h>
+
+ENTRY (BP_SYM (__longjmp))
+ CHECK_BOUNDS_BOTH_WIDE_LIT (r3, r8, r9, JB_SIZE)
+
+#ifdef PTR_DEMANGLE
+ lwz r24,(JB_GPR1*4)(r3)
+#else
+ lwz r1,(JB_GPR1*4)(r3)
+#endif
+ lwz r0,(JB_LR*4)(r3)
+ /*lfd fp14,((JB_FPRS+0*2)*4)(r3)*/
+ evldd r14,((JB_FPRS+0*2)*4)(r3)
+ lwz r14,((JB_GPRS+0)*4)(r3)
+ /*lfd fp15,((JB_FPRS+1*2)*4)(r3)*/
+ evldd r15,((JB_FPRS+1*2)*4)(r3)
+ lwz r15,((JB_GPRS+1)*4)(r3)
+ /*lfd fp16,((JB_FPRS+2*2)*4)(r3)*/
+ evldd r16,((JB_FPRS+2*2)*4)(r3)
+ lwz r16,((JB_GPRS+2)*4)(r3)
+ /*lfd fp17,((JB_FPRS+3*2)*4)(r3)*/
+ evldd r17,((JB_FPRS+3*2)*4)(r3)
+ lwz r17,((JB_GPRS+3)*4)(r3)
+ /*lfd fp18,((JB_FPRS+4*2)*4)(r3)*/
+ evldd r18,((JB_FPRS+4*2)*4)(r3)
+ lwz r18,((JB_GPRS+4)*4)(r3)
+ /*lfd fp19,((JB_FPRS+5*2)*4)(r3)*/
+ evldd r19,((JB_FPRS+5*2)*4)(r3)
+ lwz r19,((JB_GPRS+5)*4)(r3)
+ /*lfd fp20,((JB_FPRS+6*2)*4)(r3)*/
+ evldd r20,((JB_FPRS+6*2)*4)(r3)
+ lwz r20,((JB_GPRS+6)*4)(r3)
+#ifdef PTR_DEMANGLE
+ PTR_DEMANGLE3 (r1, r24, r25)
+ PTR_DEMANGLE2 (r0, r25)
+#endif
+ mtlr r0
+ /*lfd fp21,((JB_FPRS+7*2)*4)(r3)*/
+ evldd r21,((JB_FPRS+7*2)*4)(r3)
+ lwz r21,((JB_GPRS+7)*4)(r3)
+ /*lfd fp22,((JB_FPRS+8*2)*4)(r3)*/
+ evldd r22,((JB_FPRS+8*2)*4)(r3)
+ lwz r22,((JB_GPRS+8)*4)(r3)
+ lwz r0,(JB_CR*4)(r3)
+ /*lfd fp23,((JB_FPRS+9*2)*4)(r3)*/
+ evldd r23,((JB_FPRS+9*2)*4)(r3)
+ lwz r23,((JB_GPRS+9)*4)(r3)
+ /*lfd fp24,((JB_FPRS+10*2)*4)(r3)*/
+ evldd r24,((JB_FPRS+10*2)*4)(r3)
+ lwz r24,((JB_GPRS+10)*4)(r3)
+ /*lfd fp25,((JB_FPRS+11*2)*4)(r3)*/
+ evldd r25,((JB_FPRS+11*2)*4)(r3)
+ lwz r25,((JB_GPRS+11)*4)(r3)
+ mtcrf 0xFF,r0
+ /*lfd fp26,((JB_FPRS+12*2)*4)(r3)*/
+ evldd r26,((JB_FPRS+12*2)*4)(r3)
+ lwz r26,((JB_GPRS+12)*4)(r3)
+ /*lfd fp27,((JB_FPRS+13*2)*4)(r3)*/
+ evldd r27,((JB_FPRS+13*2)*4)(r3)
+ lwz r27,((JB_GPRS+13)*4)(r3)
+ /*lfd fp28,((JB_FPRS+14*2)*4)(r3)*/
+ evldd r28,((JB_FPRS+14*2)*4)(r3)
+ lwz r28,((JB_GPRS+14)*4)(r3)
+ /*lfd fp29,((JB_FPRS+15*2)*4)(r3)*/
+ evldd r29,((JB_FPRS+15*2)*4)(r3)
+ lwz r29,((JB_GPRS+15)*4)(r3)
+ /*lfd fp30,((JB_FPRS+16*2)*4)(r3)*/
+ evldd r30,((JB_FPRS+16*2)*4)(r3)
+ lwz r30,((JB_GPRS+16)*4)(r3)
+ /*lfd fp31,((JB_FPRS+17*2)*4)(r3)*/
+ evldd r31,((JB_FPRS+17*2)*4)(r3)
+ lwz r31,((JB_GPRS+17)*4)(r3)
+ mr r3,r4
+ blr
+END (BP_SYM (__longjmp))
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/__longjmp.S
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/__longjmp.S (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/__longjmp.S Thu Dec 7 10:33:12 2006
@@ -1,0 +1,39 @@
+/* AltiVec/VMX (new) version of __longjmp for PowerPC.
+ Copyright (C) 1995-1997,1999,2000,2003,2004 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <libc-symbols.h>
+#include <shlib-compat.h>
+
+#if defined NOT_IN_libc
+/* Build a non-versioned object for rtld-*. */
+# include "__longjmp-common.S"
+
+#else /* !NOT_IN_libc */
+strong_alias (__vmx__longjmp, __longjmp);
+# define __longjmp __vmx__longjmp
+# include "__longjmp-common.S"
+
+# if defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)
+# define __NO_VMX__
+# undef JB_SIZE
+# undef __longjmp
+# define __longjmp __novmx__longjmp
+# include "__longjmp-common.S"
+# endif
+#endif /* !NOT_IN_libc */
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/atosfix16.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/atosfix16.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/atosfix16.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,28 @@
+/* Convert string to 16-bit signed fixed point.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Joseph Myers <joseph@xxxxxxxxxxxxxxxx>, 2006.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stddef.h>
+#include <spe.h>
+
+int16_t
+atosfix16 (const char *str)
+{
+ return strtosfix16 (str, NULL);
+}
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/atosfix32.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/atosfix32.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/atosfix32.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,28 @@
+/* Convert string to 32-bit signed fixed point.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Joseph Myers <joseph@xxxxxxxxxxxxxxxx>, 2006.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stddef.h>
+#include <spe.h>
+
+int32_t
+atosfix32 (const char *str)
+{
+ return strtosfix32 (str, NULL);
+}
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/atosfix64.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/atosfix64.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/atosfix64.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,28 @@
+/* Convert string to 64-bit signed fixed point.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Joseph Myers <joseph@xxxxxxxxxxxxxxxx>, 2006.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stddef.h>
+#include <spe.h>
+
+int64_t
+atosfix64 (const char *str)
+{
+ return strtosfix64 (str, NULL);
+}
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/atoufix16.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/atoufix16.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/atoufix16.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,28 @@
+/* Convert string to 16-bit unsigned fixed point.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Joseph Myers <joseph@xxxxxxxxxxxxxxxx>, 2006.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stddef.h>
+#include <spe.h>
+
+uint16_t
+atoufix16 (const char *str)
+{
+ return strtoufix16 (str, NULL);
+}
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/atoufix32.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/atoufix32.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/atoufix32.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,28 @@
+/* Convert string to 32-bit unsigned fixed point.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Joseph Myers <joseph@xxxxxxxxxxxxxxxx>, 2006.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stddef.h>
+#include <spe.h>
+
+uint32_t
+atoufix32 (const char *str)
+{
+ return strtoufix32 (str, NULL);
+}
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/atoufix64.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/atoufix64.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/atoufix64.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,28 @@
+/* Convert string to 64-bit unsigned fixed point.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Joseph Myers <joseph@xxxxxxxxxxxxxxxx>, 2006.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <stddef.h>
+#include <spe.h>
+
+uint64_t
+atoufix64 (const char *str)
+{
+ return strtoufix64 (str, NULL);
+}
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/e_sqrt.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/e_sqrt.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/e_sqrt.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,1 @@
+#include <sysdeps/ieee754/dbl-64/e_sqrt.c>
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/e_sqrtf.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/e_sqrtf.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/e_sqrtf.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,1 @@
+#include <sysdeps/ieee754/flt-32/e_sqrtf.c>
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fclrexcpt.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fclrexcpt.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fclrexcpt.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,47 @@
+/* Clear given exceptions in current floating-point environment.
+ Copyright (C) 2004 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fenv_libc.h>
+
+#undef feclearexcept
+int
+__feclearexcept (int excepts)
+{
+ unsigned int fpescr;
+
+ /* Get the current state. */
+ fpescr = fegetenv_register ();
+
+ /* Clear the relevant bits. */
+ fpescr &= ~(excepts & FE_ALL_EXCEPT);
+
+ /* Put the new state in effect. */
+ fesetenv_register (fpescr);
+
+ /* Success. */
+ return 0;
+}
+
+#include <shlib-compat.h>
+#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
+strong_alias (__feclearexcept, __old_feclearexcept)
+compat_symbol (libm, __old_feclearexcept, feclearexcept, GLIBC_2_1);
+#endif
+
+versioned_symbol (libm, __feclearexcept, feclearexcept, GLIBC_2_2);
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fe_nomask.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fe_nomask.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fe_nomask.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,32 @@
+/* Procedure definition for FE_NOMASK_ENV.
+ 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fenv.h>
+#include <errno.h>
+
+/* This is presently a stub, until it's decided how the kernels should
+ support this. */
+
+const fenv_t *
+__fe_nomask_env(void)
+{
+ __set_errno (ENOSYS);
+ return FE_ENABLED_ENV;
+}
+stub_warning (__fe_nomask_env)
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fedisblxcpt.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fedisblxcpt.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fedisblxcpt.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,60 @@
+/* Disable floating-point exceptions.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Aldy Hernandez <aldyh@xxxxxxxxxx>, 2004.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fenv_libc.h>
+#include <sysdep.h>
+#include <sys/prctl.h>
+
+int
+fedisableexcept (int excepts)
+{
+ unsigned int result = 0, pflags, r;
+ INTERNAL_SYSCALL_DECL (err);
+
+ INTERNAL_SYSCALL (prctl, err, 2, PR_GET_FPEXC, &pflags);
+
+ /* Save old enable bits. */
+ if (pflags & PR_FP_EXC_OVF)
+ result |= FE_OVERFLOW;
+ if (pflags & PR_FP_EXC_UND)
+ result |= FE_UNDERFLOW;
+ if (pflags & PR_FP_EXC_INV)
+ result |= FE_INVALID;
+ if (pflags & PR_FP_EXC_DIV)
+ result |= FE_DIVBYZERO;
+ if (pflags & PR_FP_EXC_RES)
+ result |= FE_INEXACT;
+
+ if (excepts & FE_INEXACT)
+ pflags &= ~PR_FP_EXC_RES;
+ if (excepts & FE_DIVBYZERO)
+ pflags &= ~PR_FP_EXC_DIV;
+ if (excepts & FE_UNDERFLOW)
+ pflags &= ~PR_FP_EXC_UND;
+ if (excepts & FE_OVERFLOW)
+ pflags &= ~PR_FP_EXC_OVF;
+ if (excepts & FE_INVALID)
+ pflags &= ~PR_FP_EXC_INV;
+ r = INTERNAL_SYSCALL (prctl, err, 2, PR_SET_FPEXC, pflags);
+ if (INTERNAL_SYSCALL_ERROR_P (r, err))
+ return -1;
+
+ return result;
+}
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/feenablxcpt.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/feenablxcpt.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/feenablxcpt.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,60 @@
+/* Enable floating-point exceptions.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Aldy Hernandez <aldyh@xxxxxxxxxx>, 2004.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fenv_libc.h>
+#include <sysdep.h>
+#include <sys/prctl.h>
+
+int
+feenableexcept (int excepts)
+{
+ unsigned int result = 0, pflags, r;
+ INTERNAL_SYSCALL_DECL (err);
+
+ INTERNAL_SYSCALL (prctl, err, 2, PR_GET_FPEXC, &pflags);
+
+ /* Save old enable bits. */
+ if (pflags & PR_FP_EXC_OVF)
+ result |= FE_OVERFLOW;
+ if (pflags & PR_FP_EXC_UND)
+ result |= FE_UNDERFLOW;
+ if (pflags & PR_FP_EXC_INV)
+ result |= FE_INVALID;
+ if (pflags & PR_FP_EXC_DIV)
+ result |= FE_DIVBYZERO;
+ if (pflags & PR_FP_EXC_RES)
+ result |= FE_INEXACT;
+
+ if (excepts & FE_INEXACT)
+ pflags |= PR_FP_EXC_RES;
+ if (excepts & FE_DIVBYZERO)
+ pflags |= PR_FP_EXC_DIV;
+ if (excepts & FE_UNDERFLOW)
+ pflags |= PR_FP_EXC_UND;
+ if (excepts & FE_OVERFLOW)
+ pflags |= PR_FP_EXC_OVF;
+ if (excepts & FE_INVALID)
+ pflags |= PR_FP_EXC_INV;
+ r = INTERNAL_SYSCALL (prctl, err, 2, PR_SET_FPEXC, pflags);
+ if (INTERNAL_SYSCALL_ERROR_P (r, err))
+ return -1;
+
+ return result;
+}
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fegetenv.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fegetenv.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fegetenv.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,46 @@
+/* Store current floating-point environment.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+ Contributed by Aldy Hernandez <aldyh@xxxxxxxxxx>, 2004
+ 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fenv_libc.h>
+#include <bp-sym.h>
+#include <sysdep.h>
+#include <sys/prctl.h>
+
+int
+__fegetenv (fenv_t *envp)
+{
+ fenv_union_t u;
+ INTERNAL_SYSCALL_DECL (err);
+
+ INTERNAL_SYSCALL (prctl, err, 2, PR_GET_FPEXC, &u.l[0]);
+ u.l[1] = fegetenv_register ();
+ *envp = u.fenv;
+
+ /* Success. */
+ return 0;
+}
+
+#include <shlib-compat.h>
+#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
+strong_alias (__fegetenv, __old_fegetenv)
+compat_symbol (libm, BP_SYM (__old_fegetenv), BP_SYM (fegetenv), GLIBC_2_1);
+#endif
+
+versioned_symbol (libm, BP_SYM (__fegetenv), BP_SYM (fegetenv), GLIBC_2_2);
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fegetexcept.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fegetexcept.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fegetexcept.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,31 @@
+/* Get floating-point exceptions.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Aldy Hernandez <aldyh@xxxxxxxxxx>, 2004.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fenv_libc.h>
+
+int
+fegetexcept (void)
+{
+ unsigned long fpescr;
+
+ fpescr = fegetenv_register ();
+
+ return fpescr & FE_ALL_EXCEPT;
+}
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fegetround.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fegetround.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fegetround.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,31 @@
+/* Return current rounding direction.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Aldy Hernandez <aldyh@xxxxxxxxxx>, 2004.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fenv_libc.h>
+
+#undef fegetround
+int
+fegetround (void)
+{
+ unsigned long fpescr;
+
+ fpescr = fegetenv_register ();
+ return fpescr & 3;
+}
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/feholdexcpt.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/feholdexcpt.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/feholdexcpt.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,45 @@
+/* Store current floating-point environment and clear exceptions.
+ Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Aldy Hernandez <aldyh@xxxxxxxxxx>, 2004.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fenv_libc.h>
+#include <sysdep.h>
+#include <sys/prctl.h>
+
+int
+feholdexcept (fenv_t *envp)
+{
+ fenv_union_t u;
+ INTERNAL_SYSCALL_DECL (err);
+
+
+ /* Get the current state. */
+ INTERNAL_SYSCALL (prctl, err, 2, PR_GET_FPEXC, &u.l[0]);
+ u.l[1] = fegetenv_register ();
+ *envp = u.fenv;
+
+ /* Clear everything except for the rounding mode. */
+ u.l[1] &= 3;
+
+ /* Put the new state in effect. */
+ fesetenv_register (u.l[1]);
+
+ return 0;
+}
+libm_hidden_def (feholdexcept)
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fenv_const.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fenv_const.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fenv_const.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,27 @@
+/* Constants for fenv_bits.h.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Aldy Hernandez <aldyh@xxxxxxxxxx>, 2004.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* If the default argument is used we use this value. */
+const unsigned long long __fe_dfl_env __attribute__ ((aligned (8))) =
+0x0ULL;
+
+/* Floating-point environment where none of the exceptions are masked. */
+const unsigned long long __fe_enabled_env __attribute__ ((aligned (8))) =
+0xF00000000ULL;
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fenv_libc.h
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fenv_libc.h (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fenv_libc.h Thu Dec 7 10:33:12 2006
@@ -1,0 +1,77 @@
+/* Internal libc stuff for floating point environment routines.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+ Contributed by Aldy Hernandez <aldyh@xxxxxxxxxx>, 2004
+ 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#ifndef _FENV_LIBC_H
+#define _FENV_LIBC_H 1
+
+#include <fenv.h>
+
+extern int __feraiseexcept_internal (int __excepts);
+
+/* Equivalent to fegetenv, but returns a fenv_t instead of taking a
+ pointer. */
+#define fegetenv_register() \
+ ({ unsigned fscr; asm volatile ("mfspefscr %0" : "=r" (fscr)); fscr; })
+
+/* Equivalent to fesetenv, but takes a fenv_t instead of a pointer. */
+#define fesetenv_register(fscr) \
+ ({ asm volatile ("mtspefscr %0" : : "r" (fscr)); })
+
+typedef union
+{
+ fenv_t fenv;
+ unsigned int l[2];
+} fenv_union_t;
+
+/* Definitions of all the SPEFSCR bit numbers. */
+enum {
+ SPEFSCR_SOVH = 0x80000000,
+ SPEFSCR_OVH = 0x40000000,
+ SPEFSCR_FGH = 0x20000000,
+ SPEFSCR_FXH = 0x10000000,
+ SPEFSCR_FINVH = 0x08000000,
+ SPEFSCR_FDBZH = 0x04000000,
+ SPEFSCR_FUNFH = 0x02000000,
+ SPEFSCR_FOVFH = 0x01000000,
+ /* 2 unused bits. */
+ SPEFSCR_FINXS = 0x00200000,
+ SPEFSCR_FINVS = 0x00100000,
+ SPEFSCR_FDBZS = 0x00080000,
+ SPEFSCR_FUNFS = 0x00040000,
+ SPEFSCR_FOVFS = 0x00020000,
+ SPEFSCR_MODE = 0x00010000,
+ SPEFSCR_SOV = 0x00008000,
+ SPEFSCR_OV = 0x00004000,
+ SPEFSCR_FG = 0x00002000,
+ SPEFSCR_FX = 0x00001000,
+ SPEFSCR_FINV = 0x00000800,
+ SPEFSCR_FDBZ = 0x00000400,
+ SPEFSCR_FUNF = 0x00000200,
+ SPEFSCR_FOVF = 0x00000100,
+ /* 1 unused bit. */
+ SPEFSCR_FINXE = 0x00000040,
+ SPEFSCR_FINVE = 0x00000020,
+ SPEFSCR_FDBZE = 0x00000010,
+ SPEFSCR_FUNFE = 0x00000008,
+ SPEFSCR_FOVFE = 0x00000004,
+ SPEFSCR_FRMC = 0x00000003
+};
+
+#endif /* fenv_libc.h */
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fesetenv.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fesetenv.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fesetenv.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,46 @@
+/* Install given floating-point environment.
+ Copyright (C) 1997,99,2000,01,02 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fenv_libc.h>
+#include <bp-sym.h>
+#include <sysdep.h>
+#include <sys/prctl.h>
+
+int
+__fesetenv (const fenv_t *envp)
+{
+ fenv_union_t u;
+ INTERNAL_SYSCALL_DECL (err);
+
+ u.fenv = *envp;
+ INTERNAL_SYSCALL (prctl, err, 2, PR_SET_FPEXC, &u.l[0]);
+ fesetenv_register (u.l[1]);
+
+ /* Success. */
+ return 0;
+}
+
+#include <shlib-compat.h>
+#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
+strong_alias (__fesetenv, __old_fesetenv)
+compat_symbol (libm, BP_SYM (__old_fesetenv), BP_SYM (fesetenv), GLIBC_2_1);
+#endif
+
+libm_hidden_ver (__fesetenv, fesetenv)
+versioned_symbol (libm, BP_SYM (__fesetenv), BP_SYM (fesetenv), GLIBC_2_2);
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fesetround.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fesetround.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fesetround.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,37 @@
+/* Set current rounding direction.
+ Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Aldy Hernandez <aldyh@xxxxxxxxxx>, 2004.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fenv_libc.h>
+
+int
+fesetround (int round)
+{
+ unsigned long fpescr;
+
+ if ((unsigned int) round > 3)
+ return 1;
+
+ fpescr = fegetenv_register ();
+ fpescr = (fpescr & ~SPEFSCR_FRMC) | (round & 3);
+ fesetenv_register (fpescr);
+
+ return 0;
+}
+libm_hidden_def (fesetround)
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/feupdateenv.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/feupdateenv.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/feupdateenv.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,57 @@
+/* Install given floating-point environment and raise exceptions.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Aldy Hernandez <aldyh@xxxxxxxxxx>, 2004.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fenv_libc.h>
+#include <bp-sym.h>
+#include <sysdep.h>
+#include <sys/prctl.h>
+
+int
+__feupdateenv (const fenv_t *envp)
+{
+ unsigned long fpescr, old, new, pflags;
+ fenv_union_t u;
+ INTERNAL_SYSCALL_DECL (err);
+
+ /* Save the currently set exceptions. */
+ u.fenv = *envp;
+ new = u.l[1];
+ old = fegetenv_register ();
+ new |= (old & FE_ALL_EXCEPT);
+
+ INTERNAL_SYSCALL (prctl, err, 2, PR_GET_FPEXC, &pflags);
+ pflags |= u.l[0];
+ INTERNAL_SYSCALL (prctl, err, 2, PR_SET_FPEXC, pflags);
+
+ /* Enable and raise (if appropriate) exceptions set in `new'. */
+ fesetenv_register (new);
+ feraiseexcept (new & FE_ALL_EXCEPT);
+
+ /* Success. */
+ return 0;
+}
+
+#include <shlib-compat.h>
+#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
+strong_alias (__feupdateenv, __old_feupdateenv)
+compat_symbol (libm, BP_SYM (__old_feupdateenv), BP_SYM (feupdateenv), GLIBC_2_1);
+#endif
+
+versioned_symbol (libm, BP_SYM (__feupdateenv), BP_SYM (feupdateenv), GLIBC_2_2);
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fgetexcptflg.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fgetexcptflg.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fgetexcptflg.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,47 @@
+/* Store current representation for exceptions.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Aldy Hernandez <aldyh@xxxxxxxxxx>, 2004.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fenv_libc.h>
+#include <bp-sym.h>
+
+int
+__fegetexceptflag (fexcept_t *flagp, int excepts)
+{
+ unsigned long fpescr;
+
+ /* Get the current state. */
+ fpescr = fegetenv_register ();
+
+ /* ?? Classic PPC doesn't do anything with `excepts', so we'll do
+ the same here. (We should really be ignoring exceptions in
+ excepts) ?? */
+ *flagp = fpescr & FE_ALL_EXCEPT;
+
+ /* Success. */
+ return 0;
+}
+
+#include <shlib-compat.h>
+#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
+strong_alias (__fegetexceptflag, __old_fegetexceptflag)
+compat_symbol (libm, BP_SYM (__old_fegetexceptflag), BP_SYM (fegetexceptflag), GLIBC_2_1);
+#endif
+
+versioned_symbol (libm, BP_SYM (__fegetexceptflag), BP_SYM (fegetexceptflag), GLIBC_2_2);
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fprrest.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fprrest.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fprrest.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,1 @@
+/* Not needed. */
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fprsave.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fprsave.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fprsave.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,1 @@
+/* Not needed. */
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fraiseexcpt.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fraiseexcpt.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fraiseexcpt.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,29 @@
+/* Raise given exceptions.
+ Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Aldy Hernandez <aldyh@xxxxxxxxxx>, 2004.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fenv_libc.h>
+#include <bp-sym.h>
+
+#undef feraiseexcept
+
+#define __FERAISEEXCEPT_INTERNAL feraiseexcept
+#include "../spe-raise.c"
+
+libm_hidden_def (feraiseexcept)
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fsetexcptflg.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fsetexcptflg.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/fsetexcptflg.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,54 @@
+/* Set floating-point environment exception handling.
+ Copyright (C) 1997,99,2000,01,04 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fenv_libc.h>
+#include <bp-sym.h>
+
+int
+__fesetexceptflag (const fexcept_t *flagp, int excepts)
+{
+ unsigned long spefscr;
+ fexcept_t flag;
+
+ /* Get the current state. */
+ spefscr = fegetenv_register ();
+
+ /* Ignore exceptions not listed in 'excepts'. */
+ flag = *flagp & excepts;
+
+ /* Replace the exception status */
+ spefscr = (spefscr & ~FE_ALL_EXCEPT) | flag;
+
+ /* Store the new status word (along with the rest of the environment).
+ This may cause floating-point exceptions if the restored state
+ requests it. */
+ fesetenv_register (spefscr);
+ feraiseexcept (spefscr & FE_ALL_EXCEPT);
+
+ /* Success. */
+ return 0;
+}
+
+#include <shlib-compat.h>
+#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
+strong_alias (__fesetexceptflag, __old_fesetexceptflag)
+compat_symbol (libm, BP_SYM (__old_fesetexceptflag), BP_SYM (fesetexceptflag), GLIBC_2_1);
+#endif
+
+versioned_symbol (libm, BP_SYM (__fesetexceptflag), BP_SYM (fesetexceptflag), GLIBC_2_2);
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/ftestexcept.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/ftestexcept.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/ftestexcept.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,32 @@
+/* Test exception in current environment.
+ Copyright (C) 2004 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Aldy Hernandez <aldyh@xxxxxxxxxx>, 2004.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <fenv_libc.h>
+
+int
+fetestexcept (int excepts)
+{
+ unsigned long f;
+
+ /* Get the current state. */
+ f = fegetenv_register ();
+
+ return f & excepts;
+}
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/math_ldbl.h
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/math_ldbl.h (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/math_ldbl.h Thu Dec 7 10:33:12 2006
@@ -1,0 +1,1 @@
+#include <sysdeps/ieee754/ldbl-128ibm/math_ldbl.h>
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/math_private.h
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/math_private.h (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/math_private.h Thu Dec 7 10:33:12 2006
@@ -1,0 +1,1 @@
+#include <math/math_private.h>
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_ceil.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_ceil.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_ceil.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,1 @@
+#include <sysdeps/ieee754/dbl-64/s_ceil.c>
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_ceilf.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_ceilf.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_ceilf.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,1 @@
+#include <sysdeps/ieee754/flt-32/s_ceilf.c>
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_copysign.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_copysign.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_copysign.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,1 @@
+#include <sysdeps/ieee754/dbl-64/s_copysign.c>
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_copysignf.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_copysignf.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_copysignf.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,1 @@
+#include <sysdeps/ieee754/flt-32/s_copysignf.c>
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_copysignl.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_copysignl.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_copysignl.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,1 @@
+#include <sysdeps/ieee754/ldbl-128ibm/s_copysignl.c>
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fabs.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fabs.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fabs.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,1 @@
+#include <sysdeps/ieee754/dbl-64/s_fabs.c>
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fabsf.S
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fabsf.S (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fabsf.S Thu Dec 7 10:33:12 2006
@@ -1,0 +1,29 @@
+/* Floating-point absolute value. PowerPC E500 version.
+ Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Aldy Hernandez <aldyh@xxxxxxxxxx>, 2004.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+ENTRY(__fabsf)
+/* float [r3] fabsf (float [r3] x) ; */
+ efsabs r3,r3
+ blr
+END(__fabsf)
+
+weak_alias(__fabsf,fabsf)
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fabsl.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fabsl.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fabsl.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,1 @@
+#include <sysdeps/ieee754/ldbl-128ibm/s_fabsl.c>
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fdim.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fdim.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fdim.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,1 @@
+#include <math/s_fdim.c>
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fdimf.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fdimf.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fdimf.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,1 @@
+#include <math/s_fdimf.c>
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_floor.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_floor.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_floor.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,1 @@
+#include <sysdeps/ieee754/dbl-64/s_floor.c>
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_floorf.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_floorf.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_floorf.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,1 @@
+#include <sysdeps/ieee754/flt-32/s_floorf.c>
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fmax.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fmax.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fmax.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,1 @@
+#include <math/s_fmax.c>
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fmaxf.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fmaxf.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fmaxf.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,1 @@
+#include <math/s_fmaxf.c>
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fmin.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fmin.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fmin.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,1 @@
+#include <math/s_fmin.c>
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fminf.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fminf.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_fminf.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,1 @@
+#include <math/s_fminf.c>
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_isnan.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_isnan.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_isnan.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,1 @@
+#include <sysdeps/ieee754/dbl-64/s_isnan.c>
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_isnanf.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_isnanf.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_isnanf.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,1 @@
+#include <sysdeps/ieee754/flt-32/s_isnanf.c>
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_llrint.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_llrint.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_llrint.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,1 @@
+#include <sysdeps/ieee754/dbl-64/s_llrint.c>
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_llrintf.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_llrintf.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_llrintf.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,1 @@
+#include <sysdeps/ieee754/flt-32/s_llrintf.c>
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_llround.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_llround.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_llround.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,1 @@
+#include <sysdeps/ieee754/dbl-64/s_llround.c>
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_llroundf.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_llroundf.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_llroundf.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,1 @@
+#include <sysdeps/ieee754/flt-32/s_llroundf.c>
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_lrint.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_lrint.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_lrint.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,1 @@
+#include <sysdeps/ieee754/dbl-64/s_lrint.c>
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_lrintf.S
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_lrintf.S (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_lrintf.S Thu Dec 7 10:33:12 2006
@@ -1,0 +1,29 @@
+/* Round float to long int. PowerPC E500 version.
+ Copyright (C) 2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Joseph Myers <joseph@xxxxxxxxxxxxxxxx>, 2006.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+
+ENTRY(__lrintf)
+/* long int [r3] lrintf (float [r3] x) ; */
+ efsctsi r3,r3
+ blr
+END(__lrintf)
+
+weak_alias(__lrintf,lrintf)
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_lround.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_lround.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_lround.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,1 @@
+#include <sysdeps/ieee754/dbl-64/s_lround.c>
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_lroundf.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_lroundf.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_lroundf.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,1 @@
+#include <sysdeps/ieee754/flt-32/s_lroundf.c>
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_rint.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_rint.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_rint.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,1 @@
+#include <sysdeps/ieee754/dbl-64/s_rint.c>
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_rintf.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_rintf.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_rintf.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,1 @@
+#include <sysdeps/ieee754/flt-32/s_rintf.c>
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_round.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_round.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_round.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,1 @@
+#include <sysdeps/ieee754/dbl-64/s_round.c>
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_roundf.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_roundf.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_roundf.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,1 @@
+#include <sysdeps/ieee754/flt-32/s_roundf.c>
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_trunc.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_trunc.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_trunc.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,1 @@
+#include <sysdeps/ieee754/dbl-64/s_trunc.c>
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_truncf.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_truncf.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/s_truncf.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,1 @@
+#include <sysdeps/ieee754/flt-32/s_truncf.c>
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/setjmp-common.S
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/setjmp-common.S (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/setjmp-common.S Thu Dec 7 10:33:12 2006
@@ -1,0 +1,108 @@
+/* setjmp for PowerPC E500.
+ Copyright (C) 2004, 2006 Free Software Foundation, Inc.
+ Contributed by Aldy Hernandez <aldyh@xxxxxxxxxx>.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <sysdep.h>
+#define _ASM
+#ifdef __NO_VMX__
+# include <novmxsetjmp.h>
+#else
+# include <jmpbuf-offsets.h>
+#endif
+#include <bp-sym.h>
+#include <bp-asm.h>
+
+ENTRY (BP_SYM (__sigsetjmp))
+ CHECK_BOUNDS_BOTH_WIDE_LIT (r3, r8, r9, JB_SIZE)
+
+#ifdef PTR_MANGLE
+ mr r5,r1
+ PTR_MANGLE(r5, r10)
+ stw r5,(JB_GPR1*4)(3)
+#else
+ stw r1,(JB_GPR1*4)(3)
+#endif
+ mflr r0
+ stw r14,((JB_GPRS+0)*4)(3)
+#ifdef PTR_MANGLE
+ PTR_MANGLE2 (r0, r10)
+ li r10,0
+#endif
+ /*stfd fp14,((JB_FPRS+0*2)*4)(3)*/
+ evstdd r14,((JB_FPRS+0*2)*4)(3)
+ stw r0,(JB_LR*4)(3)
+ stw r15,((JB_GPRS+1)*4)(3)
+ /*stfd fp15,((JB_FPRS+1*2)*4)(3)*/
+ evstdd r15,((JB_FPRS+1*2)*4)(3)
+ mfcr r0
+ stw r16,((JB_GPRS+2)*4)(3)
+ /*stfd fp16,((JB_FPRS+2*2)*4)(3)*/
+ evstdd r16,((JB_FPRS+2*2)*4)(3)
+ stw r0,(JB_CR*4)(3)
+ stw r17,((JB_GPRS+3)*4)(3)
+ /*stfd fp17,((JB_FPRS+3*2)*4)(3)*/
+ evstdd r17,((JB_FPRS+3*2)*4)(3)
+ stw r18,((JB_GPRS+4)*4)(3)
+ /*stfd fp18,((JB_FPRS+4*2)*4)(3)*/
+ evstdd r18,((JB_FPRS+4*2)*4)(3)
+ stw r19,((JB_GPRS+5)*4)(3)
+ /*stfd fp19,((JB_FPRS+5*2)*4)(3)*/
+ evstdd r19,((JB_FPRS+5*2)*4)(3)
+ stw r20,((JB_GPRS+6)*4)(3)
+ /*stfd fp20,((JB_FPRS+6*2)*4)(3)*/
+ evstdd r20,((JB_FPRS+6*2)*4)(3)
+ stw r21,((JB_GPRS+7)*4)(3)
+ /*stfd fp21,((JB_FPRS+7*2)*4)(3)*/
+ evstdd r21,((JB_FPRS+7*2)*4)(3)
+ stw r22,((JB_GPRS+8)*4)(3)
+ /*stfd fp22,((JB_FPRS+8*2)*4)(3)*/
+ evstdd r22,((JB_FPRS+8*2)*4)(3)
+ stw r23,((JB_GPRS+9)*4)(3)
+ /*stfd fp23,((JB_FPRS+9*2)*4)(3)*/
+ evstdd r23,((JB_FPRS+9*2)*4)(3)
+ stw r24,((JB_GPRS+10)*4)(3)
+ /*stfd fp24,((JB_FPRS+10*2)*4)(3)*/
+ evstdd r24,((JB_FPRS+10*2)*4)(3)
+ stw r25,((JB_GPRS+11)*4)(3)
+ /*stfd fp25,((JB_FPRS+11*2)*4)(3)*/
+ evstdd r25,((JB_FPRS+11*2)*4)(3)
+ stw r26,((JB_GPRS+12)*4)(3)
+ /*stfd fp26,((JB_FPRS+12*2)*4)(3)*/
+ evstdd r26,((JB_FPRS+12*2)*4)(3)
+ stw r27,((JB_GPRS+13)*4)(3)
+ /*stfd fp27,((JB_FPRS+13*2)*4)(3)*/
+ evstdd r27,((JB_FPRS+13*2)*4)(3)
+ stw r28,((JB_GPRS+14)*4)(3)
+ /*stfd fp28,((JB_FPRS+14*2)*4)(3)*/
+ evstdd r28,((JB_FPRS+14*2)*4)(3)
+ stw r29,((JB_GPRS+15)*4)(3)
+ /*stfd fp29,((JB_FPRS+15*2)*4)(3)*/
+ evstdd r29,((JB_FPRS+15*2)*4)(3)
+ stw r30,((JB_GPRS+16)*4)(3)
+ /*stfd fp30,((JB_FPRS+16*2)*4)(3)*/
+ evstdd r30,((JB_FPRS+16*2)*4)(3)
+ stw r31,((JB_GPRS+17)*4)(3)
+ /*stfd fp31,((JB_FPRS+17*2)*4)(3)*/
+ evstdd r31,((JB_FPRS+17*2)*4)(3)
+#if defined NOT_IN_libc && defined IS_IN_rtld
+ li r3,0
+ blr
+#else
+ b BP_SYM (__sigjmp_save@local)
+#endif
+END (BP_SYM (__sigsetjmp))
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/setjmp.S
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/setjmp.S (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/setjmp.S Thu Dec 7 10:33:12 2006
@@ -1,0 +1,44 @@
+/* non alitivec (old) version of setjmp for PowerPC.
+ Copyright (C) 1995-1997,1999-2001,2004 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 Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+#include <shlib-compat.h>
+#include <libc-symbols.h>
+
+#if defined NOT_IN_libc
+/* Build a non-versioned object for rtld-*. */
+# include "setjmp-common.S"
+
+#else /* !NOT_IN_libc */
+/* Build a versioned object for libc. */
+default_symbol_version (__vmx__sigsetjmp,__sigsetjmp,GLIBC_2.3.4)
+# define __sigsetjmp __vmx__sigsetjmp
+# define __sigjmp_save __vmx__sigjmp_save
+# include "setjmp-common.S"
+
+# if defined SHARED && SHLIB_COMPAT (libc, GLIBC_2_0, GLIBC_2_3_4)
+# define __NO_VMX__
+# undef __sigsetjmp
+# undef __sigjmp_save
+# undef JB_SIZE
+symbol_version (__novmx__sigsetjmp,__sigsetjmp,GLIBC_2.0)
+# define __sigsetjmp __novmx__sigsetjmp
+# define __sigjmp_save __novmx__sigjmp_save
+# include "setjmp-common.S"
+# endif
+#endif /* !NOT_IN_libc */
Added: trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/strtofix.c
==============================================================================
--- trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/strtofix.c (added)
+++ trunk/ports/sysdeps/powerpc/powerpc32/e500/fpu/strtofix.c Thu Dec 7 10:33:12 2006
@@ -1,0 +1,692 @@
+/* Convert string representing a number to float value, using given locale.
+ Copyright (C) 1997,1998,2002,2004,2005,2006 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Ulrich Drepper <drepper@xxxxxxxxxx>, 1997.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 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
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, write to the Free
+ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
+ 02111-1307 USA. */
+
+/* Cut down from strtod_l.c for converting to fixed-point, no locale
+ choice, no grouping, narrow strings only. */
+
+
+#include <ctype.h>
+#include <errno.h>
+#include <fenv_libc.h>
+#include <locale/localeinfo.h>
+#include <locale.h>
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+
+/* The gmp headers need some configuration frobs. */
+#define HAVE_ALLOCA 1
+
+/* Include gmp-mparam.h first, such that definitions of _SHORT_LIMB
+ and _LONG_LONG_LIMB in it can take effect into gmp.h. */
+#include <gmp-mparam.h>
+#include <gmp.h>
+#include <stdlib/gmp-impl.h>
+#include <stdlib/longlong.h>
+#include <stdlib/fpioconst.h>
+
+/*#define NDEBUG 1*/
+#include <assert.h>
+
+#if UNSIGNED
+#define RETURN_FRAC_BITS RETURN_TYPE_BITS
+#else
+#define RETURN_FRAC_BITS (RETURN_TYPE_BITS - 1)
+#endif
+
+#define RETURN(val,end) \
+ do { if (endptr != NULL) *endptr = (char *) (end); \
+ return val; } while (0)
+
+/* Definitions according to limb size used. */
+#if BITS_PER_MP_LIMB == 32
+# define MAX_DIG_PER_LIMB 9
+# define MAX_FAC_PER_LIMB 1000000000UL
+#elif BITS_PER_MP_LIMB == 64
+# define MAX_DIG_PER_LIMB 19
+# define MAX_FAC_PER_LIMB 10000000000000000000ULL
+#else
+# error "mp_limb_t size " BITS_PER_MP_LIMB "not accounted for"
+#endif
+
+/* Local data structure. */
+static const mp_limb_t _tens_in_limb[MAX_DIG_PER_LIMB + 1] =
+{ 0, 10, 100,
+ 1000, 10000, 100000L,
+ 1000000L, 10000000L, 100000000L,
+ 1000000000L
+#if BITS_PER_MP_LIMB > 32
+ , 10000000000ULL, 100000000000ULL,
+ 1000000000000ULL, 10000000000000ULL, 100000000000000ULL,
+ 1000000000000000ULL, 10000000000000000ULL, 100000000000000000ULL,
+ 1000000000000000000ULL, 10000000000000000000ULL
+#endif
+#if BITS_PER_MP_LIMB > 64
+ #error "Need to expand tens_in_limb table to" MAX_DIG_PER_LIMB
+#endif
+};
+
+/* Define pow5 to be 5^(RETURN_FRAC_BITS + 1), shifted left so the
+ most significant bit is set (as required by mpn_divrem), pow5size
+ to be the size in limbs and pow5shift to be the shift. */
+#if RETURN_FRAC_BITS + 1 == 16
+# if BITS_PER_MP_LIMB == 32
+static const mp_limb_t pow5[] = { 0x04000000, 0x8e1bc9bf };
+# define pow5shift 26
+# define pow5size 2
+# else
+static const mp_limb_t pow5[] = { 0x8e1bc9bf04000000ull };
+# define pow5shift 26
+# define pow5size 1
+# endif
+#elif RETURN_FRAC_BITS + 1 == 17
+# if BITS_PER_MP_LIMB == 32
+static const mp_limb_t pow5[] = { 0xc5000000, 0xb1a2bc2e };
+# define pow5shift 24
+# define pow5size 2
+# else
+static const mp_limb_t pow5[] = { 0xb1a2bc2ec5000000ull };
+# define pow5shift 24
+# define pow5size 1
+# endif
+#elif RETURN_FRAC_BITS + 1 == 32
+# if BITS_PER_MP_LIMB == 32
+static const mp_limb_t pow5[] = { 0xf0200000, 0x2b70b59d, 0x9dc5ada8 };
+# define pow5shift 21
+# define pow5size 3
+# else
+static const mp_limb_t pow5[] = { 0xf020000000000000ull, 0x9dc5ada82b70b59dull };
+# define pow5shift 53
+# define pow5size 2
+# endif
+#elif RETURN_FRAC_BITS + 1 == 33
+# if BITS_PER_MP_LIMB == 32
+static const mp_limb_t pow5[] = { 0x6c280000, 0x364ce305, 0xc5371912 };
+# define pow5shift 19
+# define pow5size 3
+# else
+static const mp_limb_t pow5[] = { 0x6c28000000000000ull, 0xc5371912364ce305ull };
+# define pow5shift 51
+# define pow5size 2
+# endif
+#elif RETURN_FRAC_BITS + 1 == 64
+# if BITS_PER_MP_LIMB == 32
+static const mp_limb_t pow5[] = { 0x50f80800, 0xc76b25fb, 0x3cbf6b71, 0xffcfa6d5, 0xc2781f49 };
+# define pow5shift 11
+# define pow5size 5
+# else
+static const mp_limb_t pow5[] = { 0x50f8080000000000ull, 0x3cbf6b71c76b25fbull, 0xc2781f49ffcfa6d5ull };
+# define pow5shift 43
+# define pow5size 3
+# endif
+#elif RETURN_FRAC_BITS + 1 == 65
+# if BITS_PER_MP_LIMB == 32
+static const mp_limb_t pow5[] = { 0x25360a00, 0x3945ef7a, 0x8bef464e, 0x7fc3908a, 0xf316271c };
+# define pow5shift 9
+# define pow5size 5
+# else
+static const mp_limb_t pow5[] = { 0x25360a0000000000ull, 8bef464e3945ef7aull, 0xf316271c7fc3908aull };
+# define pow5shift 41
+# define pow5size 3
+# endif
+#else
+# error "Unknown RETURN_FRAC_BITS value."
+#endif
+
+/* Read a multi-precision integer starting at STR with exactly DIGCNT digits
+ into N. Return the size of the number limbs in NSIZE. */
+static void
+str_to_mpn (const char *str, int digcnt, mp_limb_t *n, mp_size_t *nsize)
+{
+ /* Number of digits for actual limb. */
+ int cnt = 0;
+ mp_limb_t low = 0;
+ mp_limb_t start;
+
+ *nsize = 0;
+ assert (digcnt > 0);
+ do
+ {
+ if (cnt == MAX_DIG_PER_LIMB)
+ {
+ if (*nsize == 0)
+ {
+ n[0] = low;
+ *nsize = 1;
+ }
+ else
+ {
+ mp_limb_t cy;
+ cy = __mpn_mul_1 (n, n, *nsize, MAX_FAC_PER_LIMB);
+ cy += __mpn_add_1 (n, n, *nsize, low);
+ if (cy != 0)
+ {
+ n[*nsize] = cy;
+ ++(*nsize);
+ }
+ }
+ cnt = 0;
+ low = 0;
+ }
+
+ low = low * 10 + *str++ - '0';
+ ++cnt;
+ }
+ while (--digcnt > 0);
+
+ start = _tens_in_limb[cnt];
+
+ if (*nsize == 0)
+ {
+ n[0] = low;
+ *nsize = 1;
+ }
+ else
+ {
+ mp_limb_t cy;
+ cy = __mpn_mul_1 (n, n, *nsize, start);
+ cy += __mpn_add_1 (n, n, *nsize, low);
+ if (cy != 0)
+ n[(*nsize)++] = cy;
+ }
+}
+
+/* Round a fixed point number according to the current rounding mode
+ and set its sign. VAL is the initial part of the number
+ (RETURN_TYPE_BITS for unsigned, one fewer for signed; values equal
+ to -1.0 do not come here). SIGN is 1 for negative, 0 for positive;
+ this function will not be called for negative numbers in the
+ unsigned case. HALF is 1 if the next bit is 1; REST is 1 if any of
+ the subsequent bits are 1. */
+static RETURN_TYPE
+round_and_set_sign (RETURN_TYPE val, int sign, int half, int rest)
+{
+ int incr = 0;
+ unsigned int mode = fegetenv_register ();
+ mode &= 3;
+ switch (mode)
+ {
+ case FE_TONEAREST:
+ incr = (half && (rest || (val & 1)));
+ break;
+ case FE_TOWARDZERO:
+ break;
+ case FE_UPWARD:
+ incr = (!sign && (half || rest));
+ break;
+ case FE_DOWNWARD:
+ incr = (sign && (half || rest));
+ break;
+ }
+ if (incr)
+ {
+ if (val == SAT_MAX)
+ {
+ if (sign)
+ val = SAT_MIN;
+ else
+ {
+ __set_errno (ERANGE);
+ return SAT_MAX;
+ }
+ }
+ else
+ {
+ val++;
+ if (sign)
+ val = -val;
+ }
+ }
+ else if (sign)
+ val = -val;
+ return val;
+}
+
+/* Return a fixed point number with the value of the given string
+ NPTR, handling out-of-range numbers as described in the SPE PIM.
+ Set *ENDPTR to the character after the last used one. */
+RETURN_TYPE
+STRTOFIX (const char *nptr, char **endptr)
+{
+ int negative; /* The sign of the number. */
+ int exponent; /* Exponent of the number. */
+
+ /* Numbers starting `0X' or `0x' have to be processed with base 16. */
+ int base = 10;
+
+ /* Running pointer after the last character processed in the string. */
+ const char *cp;
+ /* Start of significant part of the number. */
+ const char *startp, *start_of_digits;
+ /* Points at the character following the integer and fractional digits. */
+ const char *expp;
+ /* Total number of digit and number of digits in integer part. */
+ int dig_no, int_no, lead_zero;
+ /* Contains the last character read. */
+ char c;
+
+ /* The radix character of the current locale. */
+ const char *decimal;
+ size_t decimal_len;
+ /* Used in several places. */
+ int cnt;
+
+ decimal = _NL_CURRENT (LC_NUMERIC, DECIMAL_POINT);
+ decimal_len = strlen (decimal);
+ assert (decimal_len > 0);
+
+ /* Prepare number representation. */
+ exponent = 0;
+ negative = 0;
+
+ /* Parse string to get maximal legal prefix. We need the number of
+ characters of the integer part, the fractional part and the exponent. */
+ cp = nptr - 1;
+ /* Ignore leading white space. */
+ do
+ c = *++cp;
+ while (isspace (c));
+
+ /* Get sign of the result. */
+ if (c == '-')
+ {
+ negative = 1;
+ c = *++cp;
+ }
+ else if (c == '+')
+ c = *++cp;
+
+ /* Return 0.0 if no legal string is found.
+ No character is used even if a sign was found. */
+ for (cnt = 0; decimal[cnt] != '\0'; ++cnt)
+ if (cp[cnt] != decimal[cnt])
+ break;
+ if (decimal[cnt] == '\0' && cp[cnt] >= '0' && cp[cnt] <= '9')
+ {
+ /* We accept it. This funny construct is here only to indent
+ the code directly. */
+ }
+ else if (c < '0' || c > '9')
+ {
+ /* The SPE PIM says NaN and Inf are not supported. */
+ /* It is really a text we do not recognize. */
+ RETURN (0, nptr);
+ }
+
+ /* First look whether we are faced with a hexadecimal number. */
+ if (c == '0' && tolower (cp[1]) == 'x')
+ {
+ /* Okay, it is a hexa-decimal number. Remember this and skip
+ the characters. BTW: hexadecimal numbers must not be
+ grouped. */
+ base = 16;
+ cp += 2;
+ c = *cp;
+ }
+
+ /* Record the start of the digits, in case we will check their grouping. */
+ start_of_digits = startp = cp;
+
+ /* Ignore leading zeroes. This helps us to avoid useless computations. */
+ while (c == '0')
+ c = *++cp;
+
+ /* If no other digit but a '0' is found the result is 0.0.
+ Return current read pointer. */
+ if ((c < '0' || c > '9')
+ && (base != 16 || (c < (char) tolower ('a')
+ || c > (char) tolower ('f')))
+ && ({ for (cnt = 0; decimal[cnt] != '\0'; ++cnt)
+ if (decimal[cnt] != cp[cnt])
+ break;
+ decimal[cnt] != '\0'; })
+ && (base != 16 || (cp == start_of_digits
+ || (char) tolower (c) != 'p'))
+ && (base == 16 || (char) tolower (c) != 'e'))
+ {
+ /* If CP is at the start of the digits, there was no correctly
+ grouped prefix of the string; so no number found. */
+ RETURN (0, cp == start_of_digits ? (base == 16 ? cp - 1 : nptr) : cp);
+ }
+
+ /* Remember first significant digit and read following characters until the
+ decimal point, exponent character or any non-FP number character. */
+ startp = cp;
+ dig_no = 0;
+ while (1)
+ {
+ if ((c >= '0' && c <= '9')
+ || (base == 16 && tolower (c) >= 'a'
[... 1153 lines stripped ...]