From 246ec411990908950e96332213bc6d11d19a17f9 Mon Sep 17 00:00:00 2001 From: Ulrich Drepper Date: Sat, 12 Apr 2008 00:51:34 +0000 Subject: * sysdeps/powerpc/fpu/fenv_libc.h: Add libm_hidden_proto for __fe_nomask_env. * sysdeps/powerpc/fpu/fe_nomask.c: Add libm_hidden_def. * sysdeps/unix/sysv/linux/powerpc/powerpc32/fpu/fe_nomask.c: Likewise. * sysdeps/unix/sysv/linux/powerpc/powerpc64/fpu/fe_nomask.c: Likewise. * sysdeps/powerpc/bits/fenv.h: Make safe for C++. * sysdeps/unix/sysv/linux/powerpc/bits/mathinline.h: New file. * sysdeps/powerpc/fpu/fegetexcept.c (__fegetexcept): Rename function from fegetexcept and make old name weak alias. * include/fenv.h: Declare __fegetexcept. * sysdeps/powerpc/fpu/fedisblxcpt.c: Use __fegetexcept instead of fegetexcept. * sysdeps/powerpc/fpu/feenablxcpt.c: Likewise. * sysdeps/powerpc/fpu/fraiseexcpt.c (__feraiseexcept): Avoid call to fetestexcept. * sysdeps/ieee754/ldbl-128ibm/s_log1pl.c (__log1pl): Use __frexpl instead of frexpl to avoid local PLT. * math/s_significandl.c (__significandl): Use __ilogbl instead of ilogbl to avoid local PLT. * sysdeps/ieee754/ldbl-128ibm/s_expm1l.c (__expm1l): Use __ldexpl instead of ldexpl to avoid local PLT. * sysdeps/ieee754/ldbl-128ibm/e_expl.c (__ieee754_expl): Use __roundl not roundl to avoid local PLT. * sysdeps/ieee754/ldbl-128/e_j0l.c: Use function names which avoid local PLTs. Use __sincosl instead of separate sinl and cosl calls. * sysdeps/ieee754/ldbl-128/e_j1l.c: Likewise. --- sysdeps/powerpc/bits/fenv.h | 7 ++++++- sysdeps/powerpc/fpu/fe_nomask.c | 5 +++-- sysdeps/powerpc/fpu/fedisblxcpt.c | 6 +++--- sysdeps/powerpc/fpu/feenablxcpt.c | 6 +++--- sysdeps/powerpc/fpu/fegetexcept.c | 7 ++++--- sysdeps/powerpc/fpu/fenv_libc.h | 6 ++++-- sysdeps/powerpc/fpu/fraiseexcpt.c | 11 +++++++---- 7 files changed, 30 insertions(+), 18 deletions(-) (limited to 'sysdeps/powerpc') diff --git a/sysdeps/powerpc/bits/fenv.h b/sysdeps/powerpc/bits/fenv.h index 10582a6..1a5720a 100644 --- a/sysdeps/powerpc/bits/fenv.h +++ b/sysdeps/powerpc/bits/fenv.h @@ -1,4 +1,4 @@ -/* Copyright (C) 1997, 1998, 1999 Free Software Foundation, Inc. +/* Copyright (C) 1997, 1998, 1999, 2008 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 @@ -136,6 +136,8 @@ extern const fenv_t __fe_enabled_env; extern const fenv_t __fe_nonieee_env; # define FE_NONIEEE_ENV (&__fe_nonieee_env) +__BEGIN_DECLS + /* Floating-point environment with all exceptions enabled. Note that just evaluating this value does not change the processor exception mode. Passing this mask to fesetenv will result in a prctl syscall to change @@ -152,4 +154,7 @@ extern const fenv_t *__fe_nomask_env (void); this allows the fastest possible floating point execution.*/ extern const fenv_t *__fe_mask_env (void); # define FE_MASK_ENV FE_DFL_ENV + +__END_DECLS + #endif diff --git a/sysdeps/powerpc/fpu/fe_nomask.c b/sysdeps/powerpc/fpu/fe_nomask.c index 3cccee1..bc18bb8 100644 --- a/sysdeps/powerpc/fpu/fe_nomask.c +++ b/sysdeps/powerpc/fpu/fe_nomask.c @@ -1,5 +1,5 @@ /* Procedure definition for FE_NOMASK_ENV. - Copyright (C) 1997 Free Software Foundation, Inc. + Copyright (C) 1997, 2008 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 @@ -17,7 +17,7 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#include +#include #include /* This is a generic stub. An OS specific override is required to set @@ -30,4 +30,5 @@ __fe_nomask_env(void) __set_errno (ENOSYS); return FE_ENABLED_ENV; } +libm_hidden_def (__fe_nomask_env) stub_warning (__fe_nomask_env) diff --git a/sysdeps/powerpc/fpu/fedisblxcpt.c b/sysdeps/powerpc/fpu/fedisblxcpt.c index 3002b1b..9df4bbc 100644 --- a/sysdeps/powerpc/fpu/fedisblxcpt.c +++ b/sysdeps/powerpc/fpu/fedisblxcpt.c @@ -1,5 +1,5 @@ /* Disable floating-point exceptions. - Copyright (C) 2000 Free Software Foundation, Inc. + Copyright (C) 2000, 2008 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Geoffrey Keating , 2000. @@ -26,7 +26,7 @@ fedisableexcept (int excepts) fenv_union_t fe; int result, new; - result = fegetexcept (); + result = __fegetexcept (); if ((excepts & FE_ALL_INVALID) == FE_ALL_INVALID) excepts = (excepts | FE_INVALID) & ~ FE_ALL_INVALID; @@ -44,7 +44,7 @@ fedisableexcept (int excepts) fe.l[1] &= ~(1 << (31 - FPSCR_VE)); fesetenv_register (fe.fenv); - new = fegetexcept (); + new = __fegetexcept (); if (new == 0 && result != 0) (void)__fe_mask_env (); diff --git a/sysdeps/powerpc/fpu/feenablxcpt.c b/sysdeps/powerpc/fpu/feenablxcpt.c index 7bff18b..4875e95 100644 --- a/sysdeps/powerpc/fpu/feenablxcpt.c +++ b/sysdeps/powerpc/fpu/feenablxcpt.c @@ -1,5 +1,5 @@ /* Enable floating-point exceptions. - Copyright (C) 2000 Free Software Foundation, Inc. + Copyright (C) 2000, 2008 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Geoffrey Keating , 2000. @@ -26,7 +26,7 @@ feenableexcept (int excepts) fenv_union_t fe; int result, new; - result = fegetexcept (); + result = __fegetexcept (); if ((excepts & FE_ALL_INVALID) == FE_ALL_INVALID) excepts = (excepts | FE_INVALID) & ~ FE_ALL_INVALID; @@ -44,7 +44,7 @@ feenableexcept (int excepts) fe.l[1] |= (1 << (31 - FPSCR_VE)); fesetenv_register (fe.fenv); - new = fegetexcept (); + new = __fegetexcept (); if (new != 0 && result == 0) (void)__fe_nomask_env (); diff --git a/sysdeps/powerpc/fpu/fegetexcept.c b/sysdeps/powerpc/fpu/fegetexcept.c index 0b5cebb..c85cb1b 100644 --- a/sysdeps/powerpc/fpu/fegetexcept.c +++ b/sysdeps/powerpc/fpu/fegetexcept.c @@ -1,5 +1,5 @@ /* Get floating-point exceptions. - Copyright (C) 2000 Free Software Foundation, Inc. + Copyright (C) 2000, 2008 Free Software Foundation, Inc. This file is part of the GNU C Library. Contributed by Geoffrey Keating , 2000. @@ -21,13 +21,13 @@ #include int -fegetexcept (void) +__fegetexcept (void) { fenv_union_t fe; int result = 0; fe.fenv = fegetenv_register (); - + if (fe.l[1] & (1 << (31 - FPSCR_XE))) result |= FE_INEXACT; if (fe.l[1] & (1 << (31 - FPSCR_ZE))) @@ -41,3 +41,4 @@ fegetexcept (void) return result; } +weak_alias (__fegetexcept, fegetexcept) diff --git a/sysdeps/powerpc/fpu/fenv_libc.h b/sysdeps/powerpc/fpu/fenv_libc.h index fd5fc0c..6f116b6 100644 --- a/sysdeps/powerpc/fpu/fenv_libc.h +++ b/sysdeps/powerpc/fpu/fenv_libc.h @@ -1,5 +1,5 @@ /* Internal libc stuff for floating point environment routines. - Copyright (C) 1997, 2006 Free Software Foundation, Inc. + Copyright (C) 1997, 2006, 2008 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,6 +22,8 @@ #include +libm_hidden_proto (__fe_nomask_env) + /* The sticky bits in the FPSCR indicating exceptions have occurred. */ #define FPSCR_STICKY_BITS ((FE_ALL_EXCEPT | FE_ALL_INVALID) & ~FE_INVALID) @@ -137,5 +139,5 @@ enum { ({ float f; asm volatile ("fmuls %0,%1,%2" \ : "=f"(f) \ : "f" (x), "f"((float)1.0)); f; }) - + #endif /* fenv_libc.h */ diff --git a/sysdeps/powerpc/fpu/fraiseexcpt.c b/sysdeps/powerpc/fpu/fraiseexcpt.c index dbe36c3..2d983d9 100644 --- a/sysdeps/powerpc/fpu/fraiseexcpt.c +++ b/sysdeps/powerpc/fpu/fraiseexcpt.c @@ -1,5 +1,5 @@ /* Raise given exceptions. - Copyright (C) 1997,99,2000,01,02 Free Software Foundation, Inc. + Copyright (C) 1997,1999-2002, 2008 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 @@ -45,12 +45,15 @@ __feraiseexcept (int excepts) triggering any appropriate exceptions. */ fesetenv_register (u.fenv); - if ((excepts & FE_INVALID) + if ((excepts & FE_INVALID)) + { /* For some reason, some PowerPC chips (the 601, in particular) don't have FE_INVALID_SOFTWARE implemented. Detect this case and raise FE_INVALID_SNAN instead. */ - && !fetestexcept (FE_INVALID)) - set_fpscr_bit (FPSCR_VXSNAN); + u.fenv = fegetenv_register (); + if ((u.l[1] & FE_INVALID) == 0) + set_fpscr_bit (FPSCR_VXSNAN); + } /* Success. */ return 0; -- cgit v1.1