mirror of git://sourceware.org/git/glibc.git
Use libc calls defined by fenv_private.h to implement several fenv functions
rather than duplicating functionality. To make this work for softfp builds, ensure functions in fenv_private are not conditionally compiled. 2014-06-24 Wilco <wdijkstr@arm.com> * sysdeps/arm/fegetround.c (fegetround): Call get_rounding_mode. * sysdeps/arm/feholdexcpt.c (feholdexcept): Call libc_feholdexcept_vfp. * sysdeps/arm/fesetround.c (fesetround): Call libc_fesetround_vfp. * sysdeps/arm/fgetexcptflg.c (fegetexceptflag): Call libc_fetestexcept_vfp. * sysdeps/arm/ftestexcept.c (fetestexcept): Call libc_fetestexcept_vfp. * sysdeps/arm/fenv_private.h: Move libc_*_vfp functions outside of __SOFTFP__ ifdef so that they can be built for softfp.
This commit is contained in:
parent
08e5862f5f
commit
4841e6a6c2
11
ChangeLog
11
ChangeLog
|
|
@ -1,3 +1,14 @@
|
||||||
|
2014-06-24 Wilco <wdijkstr@arm.com>
|
||||||
|
|
||||||
|
* sysdeps/arm/fegetround.c (fegetround): Call get_rounding_mode.
|
||||||
|
* sysdeps/arm/feholdexcpt.c (feholdexcept): Call libc_feholdexcept_vfp.
|
||||||
|
* sysdeps/arm/fesetround.c (fesetround): Call libc_fesetround_vfp.
|
||||||
|
* sysdeps/arm/fgetexcptflg.c (fegetexceptflag):
|
||||||
|
Call libc_fetestexcept_vfp.
|
||||||
|
* sysdeps/arm/ftestexcept.c (fetestexcept): Call libc_fetestexcept_vfp.
|
||||||
|
* sysdeps/arm/fenv_private.h: Move libc_*_vfp functions outside of
|
||||||
|
__SOFTFP__ ifdef so that they can be built for softfp.
|
||||||
|
|
||||||
2014-06-24 Siddhesh Poyarekar <siddhesh@redhat.com>
|
2014-06-24 Siddhesh Poyarekar <siddhesh@redhat.com>
|
||||||
|
|
||||||
* sysdeps/x86/nptl/elide.h (elision_adapt): Make first
|
* sysdeps/x86/nptl/elide.h (elision_adapt): Make first
|
||||||
|
|
|
||||||
|
|
@ -16,22 +16,12 @@
|
||||||
License along with the GNU C Library. If not, see
|
License along with the GNU C Library. If not, see
|
||||||
<http://www.gnu.org/licenses/>. */
|
<http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
#include <fenv.h>
|
#include <get-rounding-mode.h>
|
||||||
#include <fpu_control.h>
|
|
||||||
#include <arm-features.h>
|
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
fegetround (void)
|
fegetround (void)
|
||||||
{
|
{
|
||||||
fpu_control_t fpscr;
|
return get_rounding_mode ();
|
||||||
|
|
||||||
/* FE_TONEAREST is the only supported rounding mode
|
|
||||||
if a VFP unit isn't present. */
|
|
||||||
if (!ARM_HAVE_VFP)
|
|
||||||
return FE_TONEAREST;
|
|
||||||
|
|
||||||
_FPU_GETCW (fpscr);
|
|
||||||
return fpscr & FE_TOWARDZERO;
|
|
||||||
}
|
}
|
||||||
libm_hidden_def (fegetround)
|
libm_hidden_def (fegetround)
|
||||||
|
|
|
||||||
|
|
@ -16,30 +16,18 @@
|
||||||
License along with the GNU C Library. If not, see
|
License along with the GNU C Library. If not, see
|
||||||
<http://www.gnu.org/licenses/>. */
|
<http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
#include <fenv.h>
|
#include <fenv_private.h>
|
||||||
#include <fpu_control.h>
|
|
||||||
#include <arm-features.h>
|
#include <arm-features.h>
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
feholdexcept (fenv_t *envp)
|
feholdexcept (fenv_t *envp)
|
||||||
{
|
{
|
||||||
fpu_control_t fpscr;
|
|
||||||
|
|
||||||
/* Fail if a VFP unit isn't present. */
|
/* Fail if a VFP unit isn't present. */
|
||||||
if (!ARM_HAVE_VFP)
|
if (!ARM_HAVE_VFP)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
_FPU_GETCW (fpscr);
|
libc_feholdexcept_vfp (envp);
|
||||||
envp->__cw = fpscr;
|
|
||||||
|
|
||||||
/* Now set all exceptions to non-stop. */
|
|
||||||
fpscr &= ~(FE_ALL_EXCEPT << FE_EXCEPT_SHIFT);
|
|
||||||
|
|
||||||
/* And clear all exception flags. */
|
|
||||||
fpscr &= ~FE_ALL_EXCEPT;
|
|
||||||
|
|
||||||
_FPU_SETCW (fpscr);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -22,8 +22,6 @@
|
||||||
#include <fenv.h>
|
#include <fenv.h>
|
||||||
#include <fpu_control.h>
|
#include <fpu_control.h>
|
||||||
|
|
||||||
#ifndef __SOFTFP__
|
|
||||||
|
|
||||||
static __always_inline void
|
static __always_inline void
|
||||||
libc_feholdexcept_vfp (fenv_t *envp)
|
libc_feholdexcept_vfp (fenv_t *envp)
|
||||||
{
|
{
|
||||||
|
|
@ -142,49 +140,6 @@ libc_feupdateenv_vfp (const fenv_t *envp)
|
||||||
libc_feupdateenv_test_vfp (envp, 0);
|
libc_feupdateenv_test_vfp (envp, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define libc_feholdexcept libc_feholdexcept_vfp
|
|
||||||
#define libc_feholdexceptf libc_feholdexcept_vfp
|
|
||||||
#define libc_feholdexceptl libc_feholdexcept_vfp
|
|
||||||
|
|
||||||
#define libc_fesetround libc_fesetround_vfp
|
|
||||||
#define libc_fesetroundf libc_fesetround_vfp
|
|
||||||
#define libc_fesetroundl libc_fesetround_vfp
|
|
||||||
|
|
||||||
#define libc_feresetround libc_feresetround_vfp
|
|
||||||
#define libc_feresetroundf libc_feresetround_vfp
|
|
||||||
#define libc_feresetroundl libc_feresetround_vfp
|
|
||||||
|
|
||||||
#define libc_feresetround_noex libc_fesetenv_vfp
|
|
||||||
#define libc_feresetround_noexf libc_fesetenv_vfp
|
|
||||||
#define libc_feresetround_noexl libc_fesetenv_vfp
|
|
||||||
|
|
||||||
#define libc_feholdexcept_setround libc_feholdexcept_setround_vfp
|
|
||||||
#define libc_feholdexcept_setroundf libc_feholdexcept_setround_vfp
|
|
||||||
#define libc_feholdexcept_setroundl libc_feholdexcept_setround_vfp
|
|
||||||
|
|
||||||
#define libc_feholdsetround libc_feholdsetround_vfp
|
|
||||||
#define libc_feholdsetroundf libc_feholdsetround_vfp
|
|
||||||
#define libc_feholdsetroundl libc_feholdsetround_vfp
|
|
||||||
|
|
||||||
#define libc_fetestexcept libc_fetestexcept_vfp
|
|
||||||
#define libc_fetestexceptf libc_fetestexcept_vfp
|
|
||||||
#define libc_fetestexceptl libc_fetestexcept_vfp
|
|
||||||
|
|
||||||
#define libc_fesetenv libc_fesetenv_vfp
|
|
||||||
#define libc_fesetenvf libc_fesetenv_vfp
|
|
||||||
#define libc_fesetenvl libc_fesetenv_vfp
|
|
||||||
|
|
||||||
#define libc_feupdateenv libc_feupdateenv_vfp
|
|
||||||
#define libc_feupdateenvf libc_feupdateenv_vfp
|
|
||||||
#define libc_feupdateenvl libc_feupdateenv_vfp
|
|
||||||
|
|
||||||
#define libc_feupdateenv_test libc_feupdateenv_test_vfp
|
|
||||||
#define libc_feupdateenv_testf libc_feupdateenv_test_vfp
|
|
||||||
#define libc_feupdateenv_testl libc_feupdateenv_test_vfp
|
|
||||||
|
|
||||||
/* We have support for rounding mode context. */
|
|
||||||
#define HAVE_RM_CTX 1
|
|
||||||
|
|
||||||
static __always_inline void
|
static __always_inline void
|
||||||
libc_feholdsetround_vfp_ctx (struct rm_ctx *ctx, int r)
|
libc_feholdsetround_vfp_ctx (struct rm_ctx *ctx, int r)
|
||||||
{
|
{
|
||||||
|
|
@ -232,17 +187,62 @@ libc_fesetenv_vfp_ctx (struct rm_ctx *ctx)
|
||||||
_FPU_SETCW (new_fpscr);
|
_FPU_SETCW (new_fpscr);
|
||||||
}
|
}
|
||||||
|
|
||||||
#define libc_feholdsetround_ctx libc_feholdsetround_vfp_ctx
|
#ifndef __SOFTFP__
|
||||||
#define libc_feresetround_ctx libc_feresetround_vfp_ctx
|
|
||||||
#define libc_feresetround_noex_ctx libc_fesetenv_vfp_ctx
|
|
||||||
|
|
||||||
#define libc_feholdsetroundf_ctx libc_feholdsetround_vfp_ctx
|
# define libc_feholdexcept libc_feholdexcept_vfp
|
||||||
#define libc_feresetroundf_ctx libc_feresetround_vfp_ctx
|
# define libc_feholdexceptf libc_feholdexcept_vfp
|
||||||
#define libc_feresetround_noexf_ctx libc_fesetenv_vfp_ctx
|
# define libc_feholdexceptl libc_feholdexcept_vfp
|
||||||
|
|
||||||
#define libc_feholdsetroundl_ctx libc_feholdsetround_vfp_ctx
|
# define libc_fesetround libc_fesetround_vfp
|
||||||
#define libc_feresetroundl_ctx libc_feresetround_vfp_ctx
|
# define libc_fesetroundf libc_fesetround_vfp
|
||||||
#define libc_feresetround_noexl_ctx libc_fesetenv_vfp_ctx
|
# define libc_fesetroundl libc_fesetround_vfp
|
||||||
|
|
||||||
|
# define libc_feresetround libc_feresetround_vfp
|
||||||
|
# define libc_feresetroundf libc_feresetround_vfp
|
||||||
|
# define libc_feresetroundl libc_feresetround_vfp
|
||||||
|
|
||||||
|
# define libc_feresetround_noex libc_fesetenv_vfp
|
||||||
|
# define libc_feresetround_noexf libc_fesetenv_vfp
|
||||||
|
# define libc_feresetround_noexl libc_fesetenv_vfp
|
||||||
|
|
||||||
|
# define libc_feholdexcept_setround libc_feholdexcept_setround_vfp
|
||||||
|
# define libc_feholdexcept_setroundf libc_feholdexcept_setround_vfp
|
||||||
|
# define libc_feholdexcept_setroundl libc_feholdexcept_setround_vfp
|
||||||
|
|
||||||
|
# define libc_feholdsetround libc_feholdsetround_vfp
|
||||||
|
# define libc_feholdsetroundf libc_feholdsetround_vfp
|
||||||
|
# define libc_feholdsetroundl libc_feholdsetround_vfp
|
||||||
|
|
||||||
|
# define libc_fetestexcept libc_fetestexcept_vfp
|
||||||
|
# define libc_fetestexceptf libc_fetestexcept_vfp
|
||||||
|
# define libc_fetestexceptl libc_fetestexcept_vfp
|
||||||
|
|
||||||
|
# define libc_fesetenv libc_fesetenv_vfp
|
||||||
|
# define libc_fesetenvf libc_fesetenv_vfp
|
||||||
|
# define libc_fesetenvl libc_fesetenv_vfp
|
||||||
|
|
||||||
|
# define libc_feupdateenv libc_feupdateenv_vfp
|
||||||
|
# define libc_feupdateenvf libc_feupdateenv_vfp
|
||||||
|
# define libc_feupdateenvl libc_feupdateenv_vfp
|
||||||
|
|
||||||
|
# define libc_feupdateenv_test libc_feupdateenv_test_vfp
|
||||||
|
# define libc_feupdateenv_testf libc_feupdateenv_test_vfp
|
||||||
|
# define libc_feupdateenv_testl libc_feupdateenv_test_vfp
|
||||||
|
|
||||||
|
/* We have support for rounding mode context. */
|
||||||
|
#define HAVE_RM_CTX 1
|
||||||
|
|
||||||
|
# define libc_feholdsetround_ctx libc_feholdsetround_vfp_ctx
|
||||||
|
# define libc_feresetround_ctx libc_feresetround_vfp_ctx
|
||||||
|
# define libc_feresetround_noex_ctx libc_fesetenv_vfp_ctx
|
||||||
|
|
||||||
|
# define libc_feholdsetroundf_ctx libc_feholdsetround_vfp_ctx
|
||||||
|
# define libc_feresetroundf_ctx libc_feresetround_vfp_ctx
|
||||||
|
# define libc_feresetround_noexf_ctx libc_fesetenv_vfp_ctx
|
||||||
|
|
||||||
|
# define libc_feholdsetroundl_ctx libc_feholdsetround_vfp_ctx
|
||||||
|
# define libc_feresetroundl_ctx libc_feresetround_vfp_ctx
|
||||||
|
# define libc_feresetround_noexl_ctx libc_fesetenv_vfp_ctx
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -16,16 +16,13 @@
|
||||||
License along with the GNU C Library. If not, see
|
License along with the GNU C Library. If not, see
|
||||||
<http://www.gnu.org/licenses/>. */
|
<http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
#include <fenv.h>
|
#include <fenv_private.h>
|
||||||
#include <fpu_control.h>
|
|
||||||
#include <arm-features.h>
|
#include <arm-features.h>
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
fesetround (int round)
|
fesetround (int round)
|
||||||
{
|
{
|
||||||
fpu_control_t fpscr;
|
|
||||||
|
|
||||||
/* FE_TONEAREST is the only supported rounding mode
|
/* FE_TONEAREST is the only supported rounding mode
|
||||||
if a VFP unit isn't present. */
|
if a VFP unit isn't present. */
|
||||||
if (!ARM_HAVE_VFP)
|
if (!ARM_HAVE_VFP)
|
||||||
|
|
@ -35,9 +32,7 @@ fesetround (int round)
|
||||||
if (round & ~FE_TOWARDZERO)
|
if (round & ~FE_TOWARDZERO)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
_FPU_GETCW (fpscr);
|
libc_fesetround_vfp (round);
|
||||||
fpscr = (fpscr & ~FE_TOWARDZERO) | round;
|
|
||||||
_FPU_SETCW (fpscr);
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -17,22 +17,17 @@
|
||||||
License along with the GNU C Library. If not, see
|
License along with the GNU C Library. If not, see
|
||||||
<http://www.gnu.org/licenses/>. */
|
<http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
#include <fenv.h>
|
#include <fenv_private.h>
|
||||||
#include <fpu_control.h>
|
|
||||||
#include <arm-features.h>
|
#include <arm-features.h>
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
fegetexceptflag (fexcept_t *flagp, int excepts)
|
fegetexceptflag (fexcept_t *flagp, int excepts)
|
||||||
{
|
{
|
||||||
fpu_control_t fpscr;
|
|
||||||
|
|
||||||
/* Fail if a VFP unit isn't present. */
|
/* Fail if a VFP unit isn't present. */
|
||||||
if (!ARM_HAVE_VFP)
|
if (!ARM_HAVE_VFP)
|
||||||
return 1;
|
return 1;
|
||||||
|
|
||||||
_FPU_GETCW (fpscr);
|
*flagp = libc_fetestexcept_vfp (excepts);
|
||||||
|
|
||||||
*flagp = fpscr & excepts & FE_ALL_EXCEPT;
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -16,23 +16,17 @@
|
||||||
License along with the GNU C Library. If not, see
|
License along with the GNU C Library. If not, see
|
||||||
<http://www.gnu.org/licenses/>. */
|
<http://www.gnu.org/licenses/>. */
|
||||||
|
|
||||||
#include <fenv.h>
|
#include <fenv_private.h>
|
||||||
#include <fpu_control.h>
|
|
||||||
#include <arm-features.h>
|
#include <arm-features.h>
|
||||||
|
|
||||||
|
|
||||||
int
|
int
|
||||||
fetestexcept (int excepts)
|
fetestexcept (int excepts)
|
||||||
{
|
{
|
||||||
fpu_control_t fpscr;
|
|
||||||
|
|
||||||
/* Return no exception flags if a VFP unit isn't present. */
|
/* Return no exception flags if a VFP unit isn't present. */
|
||||||
if (!ARM_HAVE_VFP)
|
if (!ARM_HAVE_VFP)
|
||||||
return 0;
|
return 0;
|
||||||
|
|
||||||
/* Get current exceptions. */
|
return libc_fetestexcept_vfp (excepts);
|
||||||
_FPU_GETCW (fpscr);
|
|
||||||
|
|
||||||
return fpscr & excepts & FE_ALL_EXCEPT;
|
|
||||||
}
|
}
|
||||||
libm_hidden_def (fetestexcept)
|
libm_hidden_def (fetestexcept)
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue