From fabe2a9514d60183408a0bb0d874488852b2814a Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Tue, 28 Feb 2012 13:15:34 +0100 Subject: Avoid local PLT for dirfd --- io/fts.c | 2 +- io/ftw.c | 8 ++++---- posix/glob.c | 4 ++-- sysdeps/unix/sysv/linux/grantpt.c | 2 +- 4 files changed, 8 insertions(+), 8 deletions(-) diff --git a/io/fts.c b/io/fts.c index 5ba202b8aa..11c5707d4c 100644 --- a/io/fts.c +++ b/io/fts.c @@ -654,7 +654,7 @@ fts_build(sp, type) */ cderrno = 0; if (nlinks || type == BREAD) { - if (fts_safe_changedir(sp, cur, dirfd(dirp), NULL)) { + if (fts_safe_changedir(sp, cur, __dirfd(dirp), NULL)) { if (nlinks && type == BREAD) cur->fts_errno = errno; cur->fts_flags |= FTS_DONTCHDIR; diff --git a/io/ftw.c b/io/ftw.c index ee3ba88174..9d6eb716e5 100644 --- a/io/ftw.c +++ b/io/ftw.c @@ -1,5 +1,5 @@ /* File tree walker functions. - Copyright (C) 1996-2004, 2006-2008, 2010 Free Software Foundation, Inc. + Copyright (C) 1996-2004, 2006-2008, 2010, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1996. @@ -365,7 +365,7 @@ open_dir_stream (int *dfdp, struct ftw_data *data, struct dir_data *dirp) result = -1; else { - dirp->streamfd = dirfd (dirp->stream); + dirp->streamfd = __dirfd (dirp->stream); dirp->content = NULL; data->dirstreams[data->actdir] = dirp; @@ -524,7 +524,7 @@ fail: /* If necessary, change to this directory. */ if (data->flags & FTW_CHDIR) { - if (__fchdir (dirfd (dir.stream)) < 0) + if (__fchdir (__dirfd (dir.stream)) < 0) { result = -1; goto fail; @@ -604,7 +604,7 @@ fail: /* Change back to the parent directory. */ int done = 0; if (old_dir->stream != NULL) - if (__fchdir (dirfd (old_dir->stream)) == 0) + if (__fchdir (__dirfd (old_dir->stream)) == 0) done = 1; if (!done) diff --git a/posix/glob.c b/posix/glob.c index 68ea2055da..b92dc24240 100644 --- a/posix/glob.c +++ b/posix/glob.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2011 +/* Copyright (C) 1991-2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2011, 2012 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -1545,7 +1545,7 @@ glob_in_dir (const char *pattern, const char *directory, int flags, { #ifdef _LIBC int dfd = (__builtin_expect (flags & GLOB_ALTDIRFUNC, 0) - ? -1 : dirfd ((DIR *) stream)); + ? -1 : __dirfd ((DIR *) stream)); #endif int fnm_flags = ((!(flags & GLOB_PERIOD) ? FNM_PERIOD : 0) | ((flags & GLOB_NOESCAPE) ? FNM_NOESCAPE : 0) diff --git a/sysdeps/unix/sysv/linux/grantpt.c b/sysdeps/unix/sysv/linux/grantpt.c index 0a3cd472fa..06b696b3f7 100644 --- a/sysdeps/unix/sysv/linux/grantpt.c +++ b/sysdeps/unix/sysv/linux/grantpt.c @@ -25,7 +25,7 @@ close_all_fds (void) { char *endp; long int fd = strtol (d->d_name, &endp, 10); - if (*endp == '\0' && fd != PTY_FILENO && fd != dirfd (dir)) + if (*endp == '\0' && fd != PTY_FILENO && fd != __dirfd (dir)) close_not_cancel_no_status (fd); } -- cgit 1.4.1 From 94c3cff5832a7f3f0a53674a644a7d3b3633eb8f Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Tue, 28 Feb 2012 13:16:05 +0100 Subject: Rename dirfd to __dirfd, add weak_alias. --- dirent/dirfd.c | 5 +++-- sysdeps/mach/hurd/dirfd.c | 5 +++-- sysdeps/unix/dirfd.c | 5 +++-- 3 files changed, 9 insertions(+), 6 deletions(-) diff --git a/dirent/dirfd.c b/dirent/dirfd.c index 026421f33b..569484c5af 100644 --- a/dirent/dirfd.c +++ b/dirent/dirfd.c @@ -1,5 +1,5 @@ /* Return the file descriptor used by a DIR stream. Stub version. - Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 2012 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 @@ -21,12 +21,13 @@ #include int -dirfd (dirp) +__dirfd (dirp) DIR *dirp; { __set_errno (ENOSYS); return -1; } +weak_alias(__dirfd, dirfd) stub_warning (dirfd) #include diff --git a/sysdeps/mach/hurd/dirfd.c b/sysdeps/mach/hurd/dirfd.c index 587ae7b2f1..975bc02863 100644 --- a/sysdeps/mach/hurd/dirfd.c +++ b/sysdeps/mach/hurd/dirfd.c @@ -1,5 +1,5 @@ /* dirfd -- Return the file descriptor used by a DIR stream. Hurd version. - Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 2012 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 @@ -22,7 +22,7 @@ #include int -dirfd (DIR *dirp) +__dirfd (DIR *dirp) { int fd; __mutex_lock (&_hurd_dtable_lock); @@ -38,3 +38,4 @@ dirfd (DIR *dirp) return fd; } +weak_alias(__dirfd, dirfd) diff --git a/sysdeps/unix/dirfd.c b/sysdeps/unix/dirfd.c index 536c44e30e..0cdacf9163 100644 --- a/sysdeps/unix/dirfd.c +++ b/sysdeps/unix/dirfd.c @@ -1,5 +1,5 @@ /* Return the file descriptor used by a DIR stream. Unix version. - Copyright (C) 1995, 1996 Free Software Foundation, Inc. + Copyright (C) 1995, 1996, 2012 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 @@ -22,8 +22,9 @@ #undef dirfd int -dirfd (dirp) +__dirfd (dirp) DIR *dirp; { return dirp->fd; } +weak_alias(__dirfd, dirfd) -- cgit 1.4.1 From 625d134f42d65ebc0349c03a0d9592400e86d084 Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Tue, 28 Feb 2012 13:16:18 +0100 Subject: Add __dirfd prototype. --- include/dirent.h | 1 + 1 file changed, 1 insertion(+) diff --git a/include/dirent.h b/include/dirent.h index 2e88005e00..80199d63ba 100644 --- a/include/dirent.h +++ b/include/dirent.h @@ -41,6 +41,7 @@ extern DIR *__alloc_dir (int fd, bool close_fd, int flags, const struct stat64 *statp) internal_function; extern void __scandir_cancel_handler (void *arg); +extern int __dirfd (DIR *__dirp); libc_hidden_proto (rewinddir) libc_hidden_proto (scandirat) -- cgit 1.4.1 From b35fe25ed9b3b406754fe681b1785f330d9faf62 Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Wed, 7 Mar 2012 14:51:39 +0100 Subject: [BZ #13658] * sysdeps/x86_64/fpu/s_sincos.S: Delete. * math/libm-test.inc (sincos_test): Add test for large input. --- math/libm-test.inc | 2 ++ sysdeps/x86_64/fpu/s_sincos.S | 60 ------------------------------------------- 2 files changed, 2 insertions(+), 60 deletions(-) delete mode 100644 sysdeps/x86_64/fpu/s_sincos.S diff --git a/math/libm-test.inc b/math/libm-test.inc index 9bdbc4cb98..1020ceb1a3 100644 --- a/math/libm-test.inc +++ b/math/libm-test.inc @@ -6426,7 +6426,9 @@ sincos_test (void) #ifdef TEST_DOUBLE TEST_extra (sincos, 0.80190127184058835, 0.71867942238767868, 0.69534156199418473); + TEST_extra (sincos, 1e22, -0.8522008497671888017727058937530, 0.5232147853951389454975944733847); #endif + END (sincos); } diff --git a/sysdeps/x86_64/fpu/s_sincos.S b/sysdeps/x86_64/fpu/s_sincos.S deleted file mode 100644 index 3bc9d71f58..0000000000 --- a/sysdeps/x86_64/fpu/s_sincos.S +++ /dev/null @@ -1,60 +0,0 @@ -/* Compute sine and cosine of argument. - Copyright (C) 1997, 2000, 2001, 2005 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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, see - . */ - -#include -#include "bp-sym.h" -#include "bp-asm.h" - -#define PARMS LINKAGE /* no space for saved regs */ -#define ANGLE PARMS -#define SINP ANGLE+12 -#define COSP SINP+PTR_SIZE - - .text -ENTRY (BP_SYM (__sincos)) - ENTER - - movsd %xmm0, -8(%rsp) - fldl -8(%rsp) - fsincos - fnstsw %ax - testl $0x400,%eax - jnz 1f - fstpl (%rsi) - fstpl (%rdi) - - LEAVE - retq - -1: fldpi - fadd %st(0) - fxch %st(1) -2: fprem1 - fnstsw %ax - testl $0x400,%eax - jnz 2b - fstp %st(1) - fsincos - fstpl (%rsi) - fstpl (%rdi) - - LEAVE - retq -END (BP_SYM (__sincos)) -weak_alias (BP_SYM (__sincos), BP_SYM (sincos)) -- cgit 1.4.1 From a20026128cef2e95ffd15fb293dd6b1e9bf3ae1e Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Thu, 8 Mar 2012 10:44:32 +0100 Subject: Add further tests --- math/libm-test.inc | 2 ++ 1 file changed, 2 insertions(+) diff --git a/math/libm-test.inc b/math/libm-test.inc index 1020ceb1a3..a51f125198 100644 --- a/math/libm-test.inc +++ b/math/libm-test.inc @@ -2010,6 +2010,7 @@ cos_test (void) #ifdef TEST_DOUBLE TEST_f_f (cos, 0.80190127184058835, 0.69534156199418473); + TEST_f_f (cos, 1e22, 0.5232147853951389454975944733847); #endif END (cos); @@ -6255,6 +6256,7 @@ sin_test (void) #ifdef TEST_DOUBLE TEST_f_f (sin, 0.80190127184058835, 0.71867942238767868); TEST_f_f (sin, 2.522464e-1, 2.4957989804940911e-1); + TEST_f_f (sin, 1e22, -0.8522008497671888017727058937530); #endif END (sin); -- cgit 1.4.1 From 1e2405c8fa877d7cb3c06626c94356faaa7bd1e0 Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Wed, 14 Mar 2012 16:50:33 +0100 Subject: Remove files so that i386 uses the iee754/dbl-64 sin and cos implementation. --- dirent/dirfd.c | 5 ++- include/dirent.h | 1 - io/fts.c | 2 +- io/ftw.c | 8 ++--- posix/glob.c | 4 +-- sysdeps/i386/fpu/branred.c | 1 - sysdeps/i386/fpu/dosincos.c | 1 - sysdeps/i386/fpu/mpa.c | 1 - sysdeps/i386/fpu/s_cos.S | 54 --------------------------------- sysdeps/i386/fpu/s_sin.S | 54 --------------------------------- sysdeps/i386/fpu/s_sincos.S | 64 --------------------------------------- sysdeps/i386/fpu/sincos32.c | 1 - sysdeps/mach/hurd/dirfd.c | 5 ++- sysdeps/unix/dirfd.c | 5 ++- sysdeps/unix/sysv/linux/grantpt.c | 2 +- 15 files changed, 14 insertions(+), 194 deletions(-) delete mode 100644 sysdeps/i386/fpu/branred.c delete mode 100644 sysdeps/i386/fpu/dosincos.c delete mode 100644 sysdeps/i386/fpu/mpa.c delete mode 100644 sysdeps/i386/fpu/s_cos.S delete mode 100644 sysdeps/i386/fpu/s_sin.S delete mode 100644 sysdeps/i386/fpu/s_sincos.S delete mode 100644 sysdeps/i386/fpu/sincos32.c diff --git a/dirent/dirfd.c b/dirent/dirfd.c index 569484c5af..026421f33b 100644 --- a/dirent/dirfd.c +++ b/dirent/dirfd.c @@ -1,5 +1,5 @@ /* Return the file descriptor used by a DIR stream. Stub version. - Copyright (C) 1995, 1996, 2012 Free Software Foundation, Inc. + Copyright (C) 1995, 1996 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 @@ -21,13 +21,12 @@ #include int -__dirfd (dirp) +dirfd (dirp) DIR *dirp; { __set_errno (ENOSYS); return -1; } -weak_alias(__dirfd, dirfd) stub_warning (dirfd) #include diff --git a/include/dirent.h b/include/dirent.h index 36e765162a..8e4823ce73 100644 --- a/include/dirent.h +++ b/include/dirent.h @@ -43,7 +43,6 @@ extern DIR *__alloc_dir (int fd, bool close_fd, int flags, const struct stat64 *statp) internal_function; extern void __scandir_cancel_handler (void *arg); -extern int __dirfd (DIR *__dirp); libc_hidden_proto (rewinddir) libc_hidden_proto (scandirat) diff --git a/io/fts.c b/io/fts.c index 11c5707d4c..5ba202b8aa 100644 --- a/io/fts.c +++ b/io/fts.c @@ -654,7 +654,7 @@ fts_build(sp, type) */ cderrno = 0; if (nlinks || type == BREAD) { - if (fts_safe_changedir(sp, cur, __dirfd(dirp), NULL)) { + if (fts_safe_changedir(sp, cur, dirfd(dirp), NULL)) { if (nlinks && type == BREAD) cur->fts_errno = errno; cur->fts_flags |= FTS_DONTCHDIR; diff --git a/io/ftw.c b/io/ftw.c index 9d6eb716e5..ee3ba88174 100644 --- a/io/ftw.c +++ b/io/ftw.c @@ -1,5 +1,5 @@ /* File tree walker functions. - Copyright (C) 1996-2004, 2006-2008, 2010, 2012 Free Software Foundation, Inc. + Copyright (C) 1996-2004, 2006-2008, 2010 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Ulrich Drepper , 1996. @@ -365,7 +365,7 @@ open_dir_stream (int *dfdp, struct ftw_data *data, struct dir_data *dirp) result = -1; else { - dirp->streamfd = __dirfd (dirp->stream); + dirp->streamfd = dirfd (dirp->stream); dirp->content = NULL; data->dirstreams[data->actdir] = dirp; @@ -524,7 +524,7 @@ fail: /* If necessary, change to this directory. */ if (data->flags & FTW_CHDIR) { - if (__fchdir (__dirfd (dir.stream)) < 0) + if (__fchdir (dirfd (dir.stream)) < 0) { result = -1; goto fail; @@ -604,7 +604,7 @@ fail: /* Change back to the parent directory. */ int done = 0; if (old_dir->stream != NULL) - if (__fchdir (__dirfd (old_dir->stream)) == 0) + if (__fchdir (dirfd (old_dir->stream)) == 0) done = 1; if (!done) diff --git a/posix/glob.c b/posix/glob.c index b92dc24240..68ea2055da 100644 --- a/posix/glob.c +++ b/posix/glob.c @@ -1,4 +1,4 @@ -/* Copyright (C) 1991-2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2011, 2012 +/* Copyright (C) 1991-2002, 2003, 2004, 2005, 2006, 2007, 2008, 2010, 2011 Free Software Foundation, Inc. This file is part of the GNU C Library. @@ -1545,7 +1545,7 @@ glob_in_dir (const char *pattern, const char *directory, int flags, { #ifdef _LIBC int dfd = (__builtin_expect (flags & GLOB_ALTDIRFUNC, 0) - ? -1 : __dirfd ((DIR *) stream)); + ? -1 : dirfd ((DIR *) stream)); #endif int fnm_flags = ((!(flags & GLOB_PERIOD) ? FNM_PERIOD : 0) | ((flags & GLOB_NOESCAPE) ? FNM_NOESCAPE : 0) diff --git a/sysdeps/i386/fpu/branred.c b/sysdeps/i386/fpu/branred.c deleted file mode 100644 index 1cc8931700..0000000000 --- a/sysdeps/i386/fpu/branred.c +++ /dev/null @@ -1 +0,0 @@ -/* Not needed. */ diff --git a/sysdeps/i386/fpu/dosincos.c b/sysdeps/i386/fpu/dosincos.c deleted file mode 100644 index 1cc8931700..0000000000 --- a/sysdeps/i386/fpu/dosincos.c +++ /dev/null @@ -1 +0,0 @@ -/* Not needed. */ diff --git a/sysdeps/i386/fpu/mpa.c b/sysdeps/i386/fpu/mpa.c deleted file mode 100644 index 1cc8931700..0000000000 --- a/sysdeps/i386/fpu/mpa.c +++ /dev/null @@ -1 +0,0 @@ -/* Not needed. */ diff --git a/sysdeps/i386/fpu/s_cos.S b/sysdeps/i386/fpu/s_cos.S deleted file mode 100644 index d341d008c5..0000000000 --- a/sysdeps/i386/fpu/s_cos.S +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Written by J.T. Conklin . - * Fixed errno handling by Ulrich Drepper . - * Public domain. - */ - -#define __need_Emath -#include -#include - -RCSID("$NetBSD: s_cos.S,v 1.5 1995/05/08 23:54:00 jtc Exp $") - -ENTRY(__cos) - fldl 4(%esp) - fxam - fstsw %ax - movb $0x45, %dh - andb %ah, %dh - cmpb $0x05, %dh - je 3f -4: fcos - fnstsw %ax - testl $0x400,%eax - jnz 1f - ret - .align ALIGNARG(4) -1: fldpi - fadd %st(0) - fxch %st(1) -2: fprem1 - fnstsw %ax - testl $0x400,%eax - jnz 2b - fstp %st(1) - fcos - ret -3: -#ifdef PIC - pushl %ebx - cfi_adjust_cfa_offset (4) - cfi_rel_offset (ebx, 0) - LOAD_PIC_REG (bx) - call __errno_location@PLT - movl $EDOM, (%eax) - popl %ebx - cfi_adjust_cfa_offset (-4) - cfi_restore (ebx) -#else - call __errno_location@PLT - movl $EDOM, (%eax) -#endif - jmp 4b -END (__cos) -weak_alias (__cos, cos) diff --git a/sysdeps/i386/fpu/s_sin.S b/sysdeps/i386/fpu/s_sin.S deleted file mode 100644 index 6b913992dc..0000000000 --- a/sysdeps/i386/fpu/s_sin.S +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Written by J.T. Conklin . - * Fixed errno handling by Ulrich Drepper . - * Public domain. - */ - -#define __need_Emath -#include -#include - -RCSID("$NetBSD: s_sin.S,v 1.5 1995/05/09 00:25:54 jtc Exp $") - -ENTRY(__sin) - fldl 4(%esp) - fxam - fstsw %ax - movb $0x45, %dh - andb %ah, %dh - cmpb $0x05, %dh - je 3f -4: fsin - fnstsw %ax - testl $0x400,%eax - jnz 1f - ret - .align ALIGNARG(4) -1: fldpi - fadd %st(0) - fxch %st(1) -2: fprem1 - fnstsw %ax - testl $0x400,%eax - jnz 2b - fstp %st(1) - fsin - ret -3: -#ifdef PIC - pushl %ebx - cfi_adjust_cfa_offset (4) - cfi_rel_offset (ebx, 0) - LOAD_PIC_REG (bx) - call __errno_location@PLT - movl $EDOM, (%eax) - popl %ebx - cfi_adjust_cfa_offset (-4) - cfi_restore (ebx) -#else - call __errno_location@PLT - movl $EDOM, (%eax) -#endif - jmp 4b -END (__sin) -weak_alias (__sin, sin) diff --git a/sysdeps/i386/fpu/s_sincos.S b/sysdeps/i386/fpu/s_sincos.S deleted file mode 100644 index 86526c9725..0000000000 --- a/sysdeps/i386/fpu/s_sincos.S +++ /dev/null @@ -1,64 +0,0 @@ -/* Compute sine and cosine of argument. - Copyright (C) 1997, 2000 Free Software Foundation, Inc. - This file is part of the GNU C Library. - Contributed by Ulrich Drepper , 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, see - . */ - -#include -#include "bp-sym.h" -#include "bp-asm.h" - -#define PARMS LINKAGE /* no space for saved regs */ -#define ANGLE PARMS -#define SINP ANGLE+8 -#define COSP SINP+PTR_SIZE - - .text -ENTRY (BP_SYM (__sincos)) - ENTER - - fldl ANGLE(%esp) - fsincos - movl SINP(%esp), %ecx - CHECK_BOUNDS_BOTH_WIDE (%ecx, SINP(%esp), $8) - movl COSP(%esp), %edx - CHECK_BOUNDS_BOTH_WIDE (%edx, COSP(%esp), $8) - fnstsw %ax - testl $0x400,%eax - jnz 1f - fstpl (%edx) - fstpl (%ecx) - - LEAVE - ret - - .align ALIGNARG(4) -1: fldpi - fadd %st(0) - fxch %st(1) -2: fprem1 - fnstsw %ax - testl $0x400,%eax - jnz 2b - fstp %st(1) - fsincos - fstpl (%edx) - fstpl (%ecx) - - LEAVE - ret -END (BP_SYM (__sincos)) -weak_alias (BP_SYM (__sincos), BP_SYM (sincos)) diff --git a/sysdeps/i386/fpu/sincos32.c b/sysdeps/i386/fpu/sincos32.c deleted file mode 100644 index 1cc8931700..0000000000 --- a/sysdeps/i386/fpu/sincos32.c +++ /dev/null @@ -1 +0,0 @@ -/* Not needed. */ diff --git a/sysdeps/mach/hurd/dirfd.c b/sysdeps/mach/hurd/dirfd.c index 975bc02863..587ae7b2f1 100644 --- a/sysdeps/mach/hurd/dirfd.c +++ b/sysdeps/mach/hurd/dirfd.c @@ -1,5 +1,5 @@ /* dirfd -- Return the file descriptor used by a DIR stream. Hurd version. - Copyright (C) 1995, 1996, 2012 Free Software Foundation, Inc. + Copyright (C) 1995, 1996 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 @@ -22,7 +22,7 @@ #include int -__dirfd (DIR *dirp) +dirfd (DIR *dirp) { int fd; __mutex_lock (&_hurd_dtable_lock); @@ -38,4 +38,3 @@ __dirfd (DIR *dirp) return fd; } -weak_alias(__dirfd, dirfd) diff --git a/sysdeps/unix/dirfd.c b/sysdeps/unix/dirfd.c index 0cdacf9163..536c44e30e 100644 --- a/sysdeps/unix/dirfd.c +++ b/sysdeps/unix/dirfd.c @@ -1,5 +1,5 @@ /* Return the file descriptor used by a DIR stream. Unix version. - Copyright (C) 1995, 1996, 2012 Free Software Foundation, Inc. + Copyright (C) 1995, 1996 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 @@ -22,9 +22,8 @@ #undef dirfd int -__dirfd (dirp) +dirfd (dirp) DIR *dirp; { return dirp->fd; } -weak_alias(__dirfd, dirfd) diff --git a/sysdeps/unix/sysv/linux/grantpt.c b/sysdeps/unix/sysv/linux/grantpt.c index 06b696b3f7..0a3cd472fa 100644 --- a/sysdeps/unix/sysv/linux/grantpt.c +++ b/sysdeps/unix/sysv/linux/grantpt.c @@ -25,7 +25,7 @@ close_all_fds (void) { char *endp; long int fd = strtol (d->d_name, &endp, 10); - if (*endp == '\0' && fd != PTY_FILENO && fd != __dirfd (dir)) + if (*endp == '\0' && fd != PTY_FILENO && fd != dirfd (dir)) close_not_cancel_no_status (fd); } -- cgit 1.4.1 From c4814b6b3a2b4f264a461a27667a139387968ee1 Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Wed, 14 Mar 2012 17:20:10 +0100 Subject: Implement and use libc_feholdexcept_setround_53bit and libc_feupdateenv_53bit so that double arithmetic in s_sin is done in 53 bit (without extend i386 double precision) --- sysdeps/generic/math_private.h | 5 +++++ sysdeps/i386/fpu/math_private.h | 29 +++++++++++++++++++++++++++++ sysdeps/ieee754/dbl-64/s_sin.c | 10 +++++----- 3 files changed, 39 insertions(+), 5 deletions(-) diff --git a/sysdeps/generic/math_private.h b/sysdeps/generic/math_private.h index 777762dd33..be1e4d2314 100644 --- a/sysdeps/generic/math_private.h +++ b/sysdeps/generic/math_private.h @@ -370,6 +370,9 @@ extern void __docos (double __x, double __dx, double __v[]); #define libc_feholdexcept_setroundl(e, r) \ do { feholdexcept (e); fesetround (r); } while (0) +#define libc_feholdexcept_setround_53bit(e, r) \ + libc_feholdexcept_setround (e, r) + #define libc_fetestexcept(e) fetestexcept (e) #define libc_fetestexceptf(e) fetestexcept (e) #define libc_fetestexceptl(e) fetestexcept (e) @@ -382,6 +385,8 @@ extern void __docos (double __x, double __dx, double __v[]); #define libc_feupdateenvf(e) (void) feupdateenv (e) #define libc_feupdateenvl(e) (void) feupdateenv (e) +#define libc_feupdateenv_53bit(e) libc_feupdateenv (e) + #define __nan(str) \ (__builtin_constant_p (str) && str[0] == '\0' ? NAN : __nan (str)) #define __nanf(str) \ diff --git a/sysdeps/i386/fpu/math_private.h b/sysdeps/i386/fpu/math_private.h index 5253998a57..d96996fadf 100644 --- a/sysdeps/i386/fpu/math_private.h +++ b/sysdeps/i386/fpu/math_private.h @@ -16,4 +16,33 @@ do \ while (0) #include_next + +# include + +# undef libc_feholdexcept_setround_53bit +# define libc_feholdexcept_setround_53bit(e, r) \ + do \ + { \ + fpu_control_t cw; \ + libc_feholdexcept_setround (e, r); \ + _FPU_GETCW (cw); \ + cw &= ~(fpu_control_t) _FPU_EXTENDED; \ + cw |= _FPU_DOUBLE; \ + _FPU_SETCW (cw); \ + } \ + while (0) + +# undef libc_feupdateenv_53bit +# define libc_feupdateenv_53bit(e) \ + do \ + { \ + fpu_control_t cw; \ + libc_feupdateenv (e); \ + _FPU_GETCW (cw); \ + cw &= ~(fpu_control_t) _FPU_EXTENDED; \ + cw |= _FPU_EXTENDED; \ + _FPU_SETCW (cw); \ + } \ + while (0) + #endif diff --git a/sysdeps/ieee754/dbl-64/s_sin.c b/sysdeps/ieee754/dbl-64/s_sin.c index e3e3a2a965..4b4b67573d 100644 --- a/sysdeps/ieee754/dbl-64/s_sin.c +++ b/sysdeps/ieee754/dbl-64/s_sin.c @@ -1,7 +1,7 @@ /* * IBM Accurate Mathematical Library * written by International Business Machines Corp. - * Copyright (C) 2001, 2009, 2011 Free Software Foundation + * Copyright (C) 2001-2012 Free Software Foundation * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU Lesser General Public License as published by @@ -111,7 +111,7 @@ __sin(double x){ fenv_t env; double retval = 0; - libc_feholdexcept_setround (&env, FE_TONEAREST); + libc_feholdexcept_setround_53bit (&env, FE_TONEAREST); u.x = x; m = u.i[HIGH_HALF]; @@ -365,7 +365,7 @@ __sin(double x){ } ret: - libc_feupdateenv (&env); + libc_feupdateenv_53bit (&env); return retval; } @@ -386,7 +386,7 @@ __cos(double x) fenv_t env; double retval = 0; - libc_feholdexcept_setround (&env, FE_TONEAREST); + libc_feholdexcept_setround_53bit (&env, FE_TONEAREST); u.x = x; m = u.i[HIGH_HALF]; @@ -635,7 +635,7 @@ __cos(double x) } ret: - libc_feupdateenv (&env); + libc_feupdateenv_53bit (&env); return retval; } -- cgit 1.4.1 From 22417c803dbcfab05a7b94b903610cc53aef9af7 Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Wed, 14 Mar 2012 17:23:31 +0100 Subject: Update ULPs. --- sysdeps/i386/fpu/libm-test-ulps | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sysdeps/i386/fpu/libm-test-ulps b/sysdeps/i386/fpu/libm-test-ulps index 2e86ff6234..0d25d75c07 100644 --- a/sysdeps/i386/fpu/libm-test-ulps +++ b/sysdeps/i386/fpu/libm-test-ulps @@ -1029,9 +1029,9 @@ Test "j1 (0.75) == 0.349243602174862192523281016426251335": double: 1 idouble: 1 Test "j1 (10.0) == 0.0434727461688614366697487680258592883": -double: 1 +double: 2 float: 1 -idouble: 1 +idouble: 2 ifloat: 1 ildouble: 1 ldouble: 1 @@ -1078,9 +1078,9 @@ Test "jn (1, 0.75) == 0.349243602174862192523281016426251335": double: 1 idouble: 1 Test "jn (1, 10.0) == 0.0434727461688614366697487680258592883": -double: 1 +double: 2 float: 1 -idouble: 1 +idouble: 2 ifloat: 1 ildouble: 1 ldouble: 1 @@ -1797,9 +1797,9 @@ float: 2 idouble: 1 ifloat: 2 Test "yn (10, 10.0) == -0.359814152183402722051986577343560609": -double: 1 +double: 2 float: 3 -idouble: 1 +idouble: 2 ifloat: 3 Test "yn (10, 2.0) == -129184.542208039282635913145923304214": double: 2 @@ -2168,9 +2168,9 @@ ildouble: 1 ldouble: 1 Function: "j1": -double: 1 +double: 2 float: 1 -idouble: 1 +idouble: 2 ifloat: 1 ildouble: 1 ldouble: 1 -- cgit 1.4.1 From ad6e0564b860ba31198ee9ed29828ce7b4b55d21 Mon Sep 17 00:00:00 2001 From: Andreas Jaeger Date: Thu, 15 Mar 2012 14:14:39 +0100 Subject: Cleanup formatting. --- math/libm-test.inc | 1 - sysdeps/i386/fpu/math_private.h | 10 +++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/math/libm-test.inc b/math/libm-test.inc index aeba1ae7be..8882833dc6 100644 --- a/math/libm-test.inc +++ b/math/libm-test.inc @@ -6565,7 +6565,6 @@ sincos_test (void) TEST_extra (sincos, 0.80190127184058835, 0.71867942238767868, 0.69534156199418473); TEST_extra (sincos, 1e22, -0.8522008497671888017727058937530, 0.5232147853951389454975944733847); #endif - END (sincos); } diff --git a/sysdeps/i386/fpu/math_private.h b/sysdeps/i386/fpu/math_private.h index d96996fadf..65202269b0 100644 --- a/sysdeps/i386/fpu/math_private.h +++ b/sysdeps/i386/fpu/math_private.h @@ -17,10 +17,10 @@ while (0) #include_next -# include +#include -# undef libc_feholdexcept_setround_53bit -# define libc_feholdexcept_setround_53bit(e, r) \ +#undef libc_feholdexcept_setround_53bit +#define libc_feholdexcept_setround_53bit(e, r) \ do \ { \ fpu_control_t cw; \ @@ -32,8 +32,8 @@ while (0) } \ while (0) -# undef libc_feupdateenv_53bit -# define libc_feupdateenv_53bit(e) \ +#undef libc_feupdateenv_53bit +#define libc_feupdateenv_53bit(e) \ do \ { \ fpu_control_t cw; \ -- cgit 1.4.1