aboutsummaryrefslogtreecommitdiff
path: root/sysdeps/powerpc
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>1997-12-28 16:01:53 +0000
committerUlrich Drepper <drepper@redhat.com>1997-12-28 16:01:53 +0000
commitb9b49b44fdc1c74ad85076bca9ff7ea0200e2214 (patch)
tree9fb0945b8576709212f84f3bbc6bd051e36b36af /sysdeps/powerpc
parent9756dfe161e523a5d543fb2b1f33a7e682a36342 (diff)
downloadglibc-b9b49b44fdc1c74ad85076bca9ff7ea0200e2214.zip
glibc-b9b49b44fdc1c74ad85076bca9ff7ea0200e2214.tar.gz
glibc-b9b49b44fdc1c74ad85076bca9ff7ea0200e2214.tar.bz2
1997-12-28 15:08 Ulrich Drepper <drepper@cygnus.com> * sysdeps/powerpc/__longjmp.S: Define _SETJMP_H before including <bits/setjmp.h>. * sysdeps/powerpc/setjmp.S: Likewise. Patches by Matt McLean <keys@keys.got.net>. * Make-dist (sysdep_dirs): Ignore bits dirs while searching. * Makefile: Undo last patch. (distribute): Add test-installation.pl. * configure.in: Correct handling of --enable-add-ons without parameter. Correct address of WWW pages. * libc.map: Add _nl_domain_bindings. * db2/mutex/tsl_parisc.s: New file. * iconvdata/Makefile (distribute): Add jis0201.c, jis0208.c, jis0212.c, and extra-module.mk. * localedata/Makefile (distribute): New. Add all the files. * stdlib/Makefile (headers): Add inttypes.h. (routines): Add strtoimax, strtoumax, wcstoimax, and wcstoumax. * sysdeps/generic/inttypes.h: New file. * sysdeps/generic/strtoimax.c: New file. * sysdeps/generic/strtoumax.c: New file. * sysdeps/generic/wcstoimax.c: New file. * sysdeps/generic/wcstoumax.c: New file. * sysdeps/wordsize-32/Dist: Removed. * sysdeps/wordsize-32/Makefile: Removed. * sysdeps/wordsize-64/Dist: Removed. * sysdeps/wordsize-64/Makefile: Removed. * sysdeps/generic/bits/environments.h: New file. * include/limits.h: Define MB_LEN_MAX in any case to 6. The gcc header is still not correct. * io/fcntl.h [__USE_FILE_OFFSET64]: We have to use the __*64 types. * posix/unistd.h: Likewise. * sysdeps/generic/sys/mman.h: Likewise. * sysdeps/unix/sysv/linux/sys/mman.h: Likewise. * manual/arith.texi: Change definition of mul macro. * manual/math.texi: Likewise. * misc/Makefile (routines): Add mmap64. * sysdeps/generic/mmap64.c: New file. * sysdeps/unix/sysv/linux/alpha/mmap64.c: New file. * sysdeps/unix/sysv/linux/sparc/sparc64/mmap64.c: New file. * sysdeps/unix/sysv/linux/alpha/syscalls.list: Add __mmap64 and mmap64 aliases to mmap. * sysdeps/unix/sysv/linux/sparc/sparc64/syscalls.list: Likewise. * sysdeps/generic/setrlimit64.c: Don't mark as stub. * nis/nss_nis/nis-hosts.c (internal_nis_gethostent_r): Pretty print. * nis(rpcsvc/nis_tags.h: Prevent warning by unknown pragma. * sysdeps/posix/mk-stdiolim.c: Generate correct file which defines FOPEN_MAX also when included by limits.h. * sysdeps/unix/sysv/linux/stdio_lim.h.in: Likewise. * sysdeps/unix/sysv/linux/Dist: Add oldsiglist.c, netax25/ax25.h, and netrom/netrom.h. * sysdeps/unix/sysv/linux/Makefile [$(subdir)=stdio-common]: Add oldsiglist to sysdep_routines, not aux. [$(subdir)=inet] (sysdep_headers): Add netax25/ax25.h, netrom/netrom.h. * sysdeps/unix/sysv/linux/bits/socket.h: Remove SOL_AX25, SOL_ATALK, and SOL_NETROM definition. * sysdeps/unix/sysv/linux/i386/Dist: Add s_pwrite64.S and s_pread64.S. * sysdeps/unix/sysv/linux/net/route.h: Pretty print. * sysdeps/unix/sysv/linux/netatalk/at.h: Pretty print. 1997-12-25 Ulrich Drepper <drepper@cygnus.com> * sysdeps/unix/sysv/linux/alpha/net/route.h: New file. * sysdeps/unix/sysv/linux/alpha/kernel_sigaction.h: Replace sa_handler with k_sa_handler. * sysdeps/unix/sysv/linux/alpha/syscalls.list: Add __getrlimit as strong alias. Reported by a sun. * sysdeps/unix/sysv/linux/sigsuspend.c: Don't define __libc_have_rt_sigs here. * sysdeps/unix/sysv/linux/sigaction.c: Do it instead here. * sysdeps/unix/sysv/linux/i386/sigaction.c: Likewise. * sysdeps/unix/sysv/linux/sigpending.c: Correct comment. * sysdeps/unix/sysv/linux/sigprocmask.c: Likewise. 1997-12-11 07:51 Geoff Keating <geoffk@ozemail.com.au> * sysdeps/powerpc/atomicity.h: New file. * sysdeps/mach/powerpc/machine-lock.h: New file. * Rules: Use -fpic to build anything that might end up in a users' shared library. * sysdeps/powerpc/s_fdim.c: New file. * sysdeps/powerpc/s_fdimf.c: New file. * sysdeps/powerpc/s_fmax.S: New file. * sysdeps/powerpc/s_fmaxf.S: New file. * sysdeps/powerpc/s_fmin.S: New file. * sysdeps/powerpc/s_fminf.S: New file. * sysdeps/powerpc/s_llrint.c: Now is for double. * sysdeps/powerpc/s_llrintf.c: New file. * sysdeps/powerpc/s_llround.c: Now is for double. * sysdeps/powerpc/s_llroundf.c: New file. * sysdeps/powerpc/s_lrint.c: Now is for double. * sysdeps/powerpc/s_lrintf.S: New file. * sysdeps/powerpc/s_lround.c: Now is for double. * sysdeps/powerpc/s_lroundf.c: New file. * sysdeps/powerpc/bits/mathinlines.h: Add inline versions of lrint, lrintf, fdim, fdimf. * sysdeps/unix/sysv/linux/powerpc/kernel_termios.h: Don't use bits/ file directly, use its parent. * sysdeps/unix/sysv/linux/powerpc/dl-sysdep.c: Re-instate '++' (for the third time). 1997-12-20 13:50 Richard Henderson <rth@cygnus.com> * posix/sched.h: timespec is in <time.h>. * sysdeps/unix/sysv/linux/sys/kd.h: Don't redefine _LINUX_TYPES_H.
Diffstat (limited to 'sysdeps/powerpc')
-rw-r--r--sysdeps/powerpc/__longjmp.S1
-rw-r--r--sysdeps/powerpc/atomicity.h99
-rw-r--r--sysdeps/powerpc/bits/mathinline.h67
-rw-r--r--sysdeps/powerpc/s_fdim.c31
-rw-r--r--sysdeps/powerpc/s_fdimf.c27
-rw-r--r--sysdeps/powerpc/s_fmax.S43
-rw-r--r--sysdeps/powerpc/s_fmaxf.S1
-rw-r--r--sysdeps/powerpc/s_fmin.S43
-rw-r--r--sysdeps/powerpc/s_fminf.S1
-rw-r--r--sysdeps/powerpc/s_llrint.c11
-rw-r--r--sysdeps/powerpc/s_llrintf.c27
-rw-r--r--sysdeps/powerpc/s_llround.c12
-rw-r--r--sysdeps/powerpc/s_llroundf.c46
-rw-r--r--sysdeps/powerpc/s_lrint.c28
-rw-r--r--sysdeps/powerpc/s_lrintf.S1
-rw-r--r--sysdeps/powerpc/s_lround.c12
-rw-r--r--sysdeps/powerpc/s_lroundf.c46
-rw-r--r--sysdeps/powerpc/setjmp.S1
18 files changed, 456 insertions, 41 deletions
diff --git a/sysdeps/powerpc/__longjmp.S b/sysdeps/powerpc/__longjmp.S
index 4a22fb8..5d6422c 100644
--- a/sysdeps/powerpc/__longjmp.S
+++ b/sysdeps/powerpc/__longjmp.S
@@ -19,6 +19,7 @@
#include <sysdep.h>
#define _ASM
+#define _SETJMP_H
#include <bits/setjmp.h>
ENTRY (__longjmp)
diff --git a/sysdeps/powerpc/atomicity.h b/sysdeps/powerpc/atomicity.h
new file mode 100644
index 0000000..dba0965
--- /dev/null
+++ b/sysdeps/powerpc/atomicity.h
@@ -0,0 +1,99 @@
+/* Low-level functions for atomic operations. PowerPC version.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#ifndef _ATOMICITY_H
+#define _ATOMICITY_H 1
+
+#include <inttypes.h>
+
+static inline int
+__attribute__ ((unused))
+exchange_and_add (volatile uint32_t *mem, int val)
+{
+ int tmp, result;
+ __asm__ __volatile__ ("\
+0: lwarx %0,0,%2
+ add %1,%3,%0
+ stwcx. %1,0,%2
+ bne- 0b
+" : "=&r"(result), "=&r"(tmp) : "r" (mem), "r"(val) : "cr0");
+ return result;
+}
+
+static inline void
+__attribute__ ((unused))
+atomic_add (volatile uint32_t *mem, int val)
+{
+ int tmp;
+ __asm__ __volatile__("\
+0: lwarx %0,0,%1
+ add %0,%2,%0
+ stwcx. %0,0,%1
+ bne- 0b
+" : "=&r"(tmp) : "r" (mem), "r"(val) : "cr0");
+}
+
+static inline int
+__attribute__ ((unused))
+compare_and_swap (volatile long int *p, long int oldval, long int newval)
+{
+ int result;
+ __asm__ __volatile__ ("\
+0: lwarx %0,0,%1
+ xor. %0,%0,%2
+ cntlzw %0,%0
+ bne- 1f
+ stwcx. %3,0,%1
+ bne- 0b
+1: srwi %0,%0,5
+" : "=&r"(result) : "r"(p), "r"(oldval), "r"(newval) : "cr0");
+ return result;
+}
+
+static inline long int
+__attribute__ ((unused))
+always_swap (volatile long int *p, long int newval)
+{
+ long int result;
+ __asm__ __volatile__ ("\
+0: lwarx %0,0,%1
+ stwcx. %2,0,%1
+ bne- 0b
+" : "=&r"(result) : "r"(p), "r"(newval) : "cr0");
+ return result;
+}
+
+static inline int
+__attribute__ ((unused))
+test_and_set (volatile long int *p, long int oldval, long int newval)
+{
+ int result;
+ __asm__ __volatile__ ("\
+0: lwarx %0,0,%1
+ xor. %0,%0,%2
+ cntlzw %0,%0
+ bne- 1f
+ stwcx. %3,0,%1
+ bne- 0b
+1: srwi %0,%0,5
+" : "=&r"(result) : "r"(p), "r"(oldval), "r"(newval) : "cr0");
+ return result;
+}
+
+#endif /* atomicity.h */
diff --git a/sysdeps/powerpc/bits/mathinline.h b/sysdeps/powerpc/bits/mathinline.h
index 24f186a..fff1d64 100644
--- a/sysdeps/powerpc/bits/mathinline.h
+++ b/sysdeps/powerpc/bits/mathinline.h
@@ -18,28 +18,14 @@
Boston, MA 02111-1307, USA. */
#ifdef __GNUC__
-#if !defined __NO_MATH_INLINES && defined __OPTIMIZE__
-
-#ifdef __cplusplus
-# define __MATH_INLINE __inline
-#else
-# define __MATH_INLINE extern __inline
-#endif
-
-__MATH_INLINE double __sgn1 (double __x);
-__MATH_INLINE double
-__sgn1 (double __x)
-{
- return __x >= 0.0 ? 1.0 : -1.0;
-}
-#endif /* !__NO_MATH_INLINES && __OPTIMIZE__ */
#if __USE_ISOC9X && !defined _SOFT_FLOAT
# define __unordered_cmp(x, y) \
(__extension__ \
({ __typeof__(x) __x = (x); __typeof__(y) __y = (y); \
unsigned __r; \
- __asm__("fcmpu 7,%1,%2 ; mfcr %0" : "=r" (__r) : "f" (__x), "f"(__y)); \
+ __asm__("fcmpu 7,%1,%2 ; mfcr %0" : "=r" (__r) : "f" (__x), "f"(__y) \
+ : "cr7"); \
__r; }))
# define isgreater(x, y) (__unordered_cmp (x, y) >> 2 & 1)
@@ -50,4 +36,53 @@ __sgn1 (double __x)
# define isunordered(x, y) (__unordered_cmp (x, y) & 1)
#endif /* __USE_ISOC9X && !_SOFT_FLOAT */
+#if !defined __NO_MATH_INLINES && defined __OPTIMIZE__
+
+#ifdef __cplusplus
+# define __MATH_INLINE __inline
+#else
+# define __MATH_INLINE extern __inline
+#endif /* __cplusplus */
+
+#ifdef __USE_ISOC9X
+__MATH_INLINE long int lrint (double __x);
+__MATH_INLINE long int
+lrint (double __x)
+{
+ union {
+ double __d;
+ long int __ll[2];
+ } __u;
+ asm ("fctiw %0,%1" : "=f"(__u.__d) : "f"(__x));
+ return __u.__ll[1];
+}
+
+__MATH_INLINE long int lrintf (float __x);
+__MATH_INLINE long int
+lrintf (float __x)
+{
+ union {
+ double __d;
+ long int __ll[2];
+ } __u;
+ asm ("fctiw %0,%1" : "=f"(__u.__d) : "f"(__x));
+ return __u.__ll[1];
+}
+
+__MATH_INLINE double fdim (double __x, double __y);
+__MATH_INLINE double
+fdim (double __x, double __y)
+{
+ return __x < __y ? 0 : __x - __y;
+}
+
+__MATH_INLINE float fdimf (float __x, float __y);
+__MATH_INLINE float
+fdimf (float __x, float __y)
+{
+ return __x < __y ? 0 : __x - __y;
+}
+
+#endif /* __USE_ISOC9X */
+#endif /* !__NO_MATH_INLINES && __OPTIMIZE__ */
#endif /* __GNUC__ */
diff --git a/sysdeps/powerpc/s_fdim.c b/sysdeps/powerpc/s_fdim.c
new file mode 100644
index 0000000..da22f5c
--- /dev/null
+++ b/sysdeps/powerpc/s_fdim.c
@@ -0,0 +1,31 @@
+/* Return positive difference between arguments.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <math.h>
+
+double
+__fdim (double x, double y)
+{
+ return x < y ? 0 : x - y;
+}
+weak_alias (__fdim, fdim)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__fdim, __fdiml)
+weak_alias (__fdim, fdiml)
+#endif
diff --git a/sysdeps/powerpc/s_fdimf.c b/sysdeps/powerpc/s_fdimf.c
new file mode 100644
index 0000000..bebe7e5
--- /dev/null
+++ b/sysdeps/powerpc/s_fdimf.c
@@ -0,0 +1,27 @@
+/* Return positive difference between arguments.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <math.h>
+
+float
+__fdimf (float x, float y)
+{
+ return x < y ? 0 : x - y;
+}
+weak_alias (__fdimf, fdimf)
diff --git a/sysdeps/powerpc/s_fmax.S b/sysdeps/powerpc/s_fmax.S
new file mode 100644
index 0000000..559769a
--- /dev/null
+++ b/sysdeps/powerpc/s_fmax.S
@@ -0,0 +1,43 @@
+/* Floating-point maximum. PowerPC version.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <sysdep.h>
+
+ENTRY(__fmax)
+/* double [f1] fmax (double [f1] x, double [f2] y); */
+ fcmpu %cr0,%f1,%f2
+ blt %cr0,0f /* if x < y, neither x nor y can be NaN... */
+ bnulr+ %cr0
+/* x and y are unordered, so one of x or y must be a NaN... */
+ fcmpu %cr1,%f2,%f2
+ bunlr %cr1
+0: fmr %f1,%f2
+ blr
+END(__fmax)
+
+weak_alias(__fmax,fmax)
+
+/* It turns out that it's safe to use this code even for single-precision. */
+strong_alias(__fmax,__fmaxf)
+weak_alias(__fmax,fmaxf)
+
+#ifdef NO_LONG_DOUBLE
+weak_alias(__fmax,__fmaxl)
+weak_alias(__fmax,fmaxl)
+#endif
diff --git a/sysdeps/powerpc/s_fmaxf.S b/sysdeps/powerpc/s_fmaxf.S
new file mode 100644
index 0000000..3c2d62b
--- /dev/null
+++ b/sysdeps/powerpc/s_fmaxf.S
@@ -0,0 +1 @@
+/* __fmaxf is in s_fmax.c */
diff --git a/sysdeps/powerpc/s_fmin.S b/sysdeps/powerpc/s_fmin.S
new file mode 100644
index 0000000..72516c2
--- /dev/null
+++ b/sysdeps/powerpc/s_fmin.S
@@ -0,0 +1,43 @@
+/* Floating-point minimum. PowerPC version.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <sysdep.h>
+
+ENTRY(__fmin)
+/* double [f1] fmin (double [f1] x, double [f2] y); */
+ fcmpu %cr0,%f1,%f2
+ bgt %cr0,0f /* if x > y, neither x nor y can be NaN... */
+ bnulr+ %cr0
+/* x and y are unordered, so one of x or y must be a NaN... */
+ fcmpu %cr1,%f2,%f2
+ bunlr %cr1
+0: fmr %f1,%f2
+ blr
+END(__fmin)
+
+weak_alias(__fmin,fmin)
+
+/* It turns out that it's safe to use this code even for single-precision. */
+strong_alias(__fmin,__fminf)
+weak_alias(__fmin,fminf)
+
+#ifdef NO_LONG_DOUBLE
+weak_alias(__fmin,__fminl)
+weak_alias(__fmin,fminl)
+#endif
diff --git a/sysdeps/powerpc/s_fminf.S b/sysdeps/powerpc/s_fminf.S
new file mode 100644
index 0000000..10ab7fe
--- /dev/null
+++ b/sysdeps/powerpc/s_fminf.S
@@ -0,0 +1 @@
+/* __fminf is in s_fmin.c */
diff --git a/sysdeps/powerpc/s_llrint.c b/sysdeps/powerpc/s_llrint.c
index 7ca48c0..1789e79 100644
--- a/sysdeps/powerpc/s_llrint.c
+++ b/sysdeps/powerpc/s_llrint.c
@@ -1,5 +1,4 @@
-/* Round a long long floating point value to an integer in the current
- rounding mode.
+/* Round a double value to a long long in the current rounding mode.
Copyright (C) 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -21,8 +20,12 @@
#include "math.h"
long long int
-__llrint (long double x)
+__llrint (double x)
{
- return (long long int) __rintl (x);
+ return (long long int) __rint (x);
}
weak_alias (__llrint, llrint)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__llrint, __llrintl)
+weak_alias (__llrint, llrintl)
+#endif
diff --git a/sysdeps/powerpc/s_llrintf.c b/sysdeps/powerpc/s_llrintf.c
new file mode 100644
index 0000000..2068a02
--- /dev/null
+++ b/sysdeps/powerpc/s_llrintf.c
@@ -0,0 +1,27 @@
+/* Round a float value to a long long in the current rounding mode.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include "math.h"
+
+long long int
+__llrintf (float x)
+{
+ return (long long int) __rintf (x);
+}
+weak_alias (__llrintf, llrintf)
diff --git a/sysdeps/powerpc/s_llround.c b/sysdeps/powerpc/s_llround.c
index fbe3a32..6b49dbf 100644
--- a/sysdeps/powerpc/s_llround.c
+++ b/sysdeps/powerpc/s_llround.c
@@ -1,4 +1,4 @@
-/* Round long double value to long int.
+/* Round double value to long long int.
Copyright (C) 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -26,12 +26,12 @@
clipping to MAX_LLONG or MIN_LLONG. */
long long int
-__llround (long double x)
+__llround (double x)
{
- long double xrf;
+ double xrf;
long long int xr;
xr = (long long int) x;
- xrf = (long double) xr;
+ xrf = (double) xr;
if (x >= 0.0)
if (x - xrf >= 0.5 && x - xrf < 1.0 && x+1 > 0)
return x+1;
@@ -44,3 +44,7 @@ __llround (long double x)
return x;
}
weak_alias (__llround, llround)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__llround, __llroundl)
+weak_alias (__llround, llroundl)
+#endif
diff --git a/sysdeps/powerpc/s_llroundf.c b/sysdeps/powerpc/s_llroundf.c
new file mode 100644
index 0000000..23f1c28
--- /dev/null
+++ b/sysdeps/powerpc/s_llroundf.c
@@ -0,0 +1,46 @@
+/* Round float value to long long int.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <math.h>
+
+/* I think that what this routine is supposed to do is round a value
+ to the nearest integer, with values exactly on the boundary rounded
+ away from zero. */
+/* This routine relies on (long long)x, when x is out of range of a long long,
+ clipping to MAX_LLONG or MIN_LLONG. */
+
+long long int
+__llroundf (float x)
+{
+ float xrf;
+ long long int xr;
+ xr = (long long int) x;
+ xrf = (float) xr;
+ if (x >= 0.0)
+ if (x - xrf >= 0.5 && x - xrf < 1.0 && x+1 > 0)
+ return x+1;
+ else
+ return x;
+ else
+ if (xrf - x >= 0.5 && xrf - x < 1.0 && x-1 < 0)
+ return x-1;
+ else
+ return x;
+}
+weak_alias (__llroundf, llroundf)
diff --git a/sysdeps/powerpc/s_lrint.c b/sysdeps/powerpc/s_lrint.c
index 647cf30..a060598 100644
--- a/sysdeps/powerpc/s_lrint.c
+++ b/sysdeps/powerpc/s_lrint.c
@@ -19,26 +19,28 @@
#include "math.h"
-#ifdef NO_LONG_DOUBLE
-
long int
-__lrint (long double x)
-{
- return (long int) __rintl(x);
-}
-
-#else
-
-long int
-__lrint (long double x)
+__lrint (double x)
{
union {
double d;
long int ll[2];
} u;
asm ("fctiw %0,%1" : "=f"(u.d) : "f"(x));
- return d.ll[1];
+ return u.ll[1];
}
+weak_alias (__lrint, lrint)
+
+/* This code will also work for a 'float' argument. */
+asm ("\
+ .globl __lrintf
+ .globl lrintf
+ .weak lrintf
+ .set __lrintf,__lrint
+ .set lrintf,__lrint
+");
+#ifdef NO_LONG_DOUBLE
+strong_alias (__lrint, __lrintl)
+weak_alias (__lrint, lrintl)
#endif
-weak_alias (__lrint, lrint)
diff --git a/sysdeps/powerpc/s_lrintf.S b/sysdeps/powerpc/s_lrintf.S
new file mode 100644
index 0000000..e247665
--- /dev/null
+++ b/sysdeps/powerpc/s_lrintf.S
@@ -0,0 +1 @@
+/* __lrintf is in s_lrint.c */
diff --git a/sysdeps/powerpc/s_lround.c b/sysdeps/powerpc/s_lround.c
index a6cb6c9..c52c038 100644
--- a/sysdeps/powerpc/s_lround.c
+++ b/sysdeps/powerpc/s_lround.c
@@ -1,4 +1,4 @@
-/* Round long double value to long int.
+/* Round double value to long int.
Copyright (C) 1997 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -26,12 +26,12 @@
clipping to MAX_LONG or MIN_LONG. */
long int
-__lround (long double x)
+__lround (double x)
{
- long double xrf;
+ double xrf;
long int xr;
xr = (long int) x;
- xrf = (long double) xr;
+ xrf = (double) xr;
if (x >= 0.0)
if (x - xrf >= 0.5 && x - xrf < 1.0 && x+1 > 0)
return x+1;
@@ -44,3 +44,7 @@ __lround (long double x)
return x;
}
weak_alias (__lround, lround)
+#ifdef NO_LONG_DOUBLE
+strong_alias (__lround, __lroundl)
+weak_alias (__lround, lroundl)
+#endif
diff --git a/sysdeps/powerpc/s_lroundf.c b/sysdeps/powerpc/s_lroundf.c
new file mode 100644
index 0000000..ce1c3cf
--- /dev/null
+++ b/sysdeps/powerpc/s_lroundf.c
@@ -0,0 +1,46 @@
+/* Round float value to long int.
+ Copyright (C) 1997 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <math.h>
+
+/* I think that what this routine is supposed to do is round a value
+ to the nearest integer, with values exactly on the boundary rounded
+ away from zero. */
+/* This routine relies on (long int)x, when x is out of range of a long int,
+ clipping to MAX_LONG or MIN_LONG. */
+
+long int
+__lroundf (float x)
+{
+ float xrf;
+ long int xr;
+ xr = (long int) x;
+ xrf = (float) xr;
+ if (x >= 0.0)
+ if (x - xrf >= 0.5 && x - xrf < 1.0 && x+1 > 0)
+ return x+1;
+ else
+ return x;
+ else
+ if (xrf - x >= 0.5 && xrf - x < 1.0 && x-1 < 0)
+ return x-1;
+ else
+ return x;
+}
+weak_alias (__lroundf, lroundf)
diff --git a/sysdeps/powerpc/setjmp.S b/sysdeps/powerpc/setjmp.S
index 8fa863f..dc9d923 100644
--- a/sysdeps/powerpc/setjmp.S
+++ b/sysdeps/powerpc/setjmp.S
@@ -19,6 +19,7 @@
#include <sysdep.h>
#define _ASM
+#define _SETJMP_H
#include <bits/setjmp.h>
ENTRY (__sigsetjmp)