mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-13 00:30:07 +00:00
a8c79c4088
2007-03-22 Jakub Jelinek <jakub@redhat.com> [BZ #3427] * sysdeps/x86_64/fpu/feholdexcpt.c (feholdexcept): Clear all exceptions both in SW and MXCSR. * sysdeps/x86_64/fpu/feupdateenv.c: New file. * sysdeps/x86_64/fpu/feenablxcpt.c (feenableexcept): Remove dead code. * sysdeps/x86_64/fpu/fedisblxcpt.c (fedisableexcept): Likewise. * sysdeps/i386/fpu/feholdexcpt.c (feholdexcept): Clear all exceptions in MXCSR if SSE is available. * sysdeps/i386/fpu/feupdateenv.c: Include unistd.h, dl-procinfo.h and ldsodefs.h. (__feupdateenv): Query exceptions also from MXCSR if SSE is available. Fix comment typo. * sysdeps/ia64/fpu/feholdexcpt.c (feholdexcept): Clear all exceptions. Return 0 rather than 1. * sysdeps/ia64/fpu/feupdateenv.c (feupdateenv): Fix comment typo. Remove incorrect part of a comment. Fix argument to feraiseexcept. * math/test-fenv.c (feholdexcept_tests): New function. (main): Call it. 2007-01-05 Richard B. Kreckel <kreckel@ginac.de> [BZ #3427] * sysdeps/i386/fpu/feholdexcpt.c (feholdexcept): Clear all exceptions in SW.
41 lines
1.3 KiB
C
41 lines
1.3 KiB
C
/* Install given floating-point environment and raise exceptions.
|
|
Copyright (C) 1997, 2000, 2007 Free Software Foundation, Inc.
|
|
This file is part of the GNU C Library.
|
|
Contributed by Christian Boissat <Christian.Boissat@cern.ch>, 1999.
|
|
|
|
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>
|
|
|
|
int
|
|
feupdateenv (const fenv_t *envp)
|
|
{
|
|
fenv_t fpsr;
|
|
|
|
|
|
/* Get the current exception state. */
|
|
__asm__ __volatile__ ("mov.m %0=ar.fpsr" : "=r" (fpsr));
|
|
|
|
/* Install new environment. */
|
|
fesetenv (envp);
|
|
|
|
/* Raise the saved exceptions. */
|
|
feraiseexcept ((int) (fpsr >> 13) & FE_ALL_EXCEPT);
|
|
|
|
/* Success. */
|
|
return 0;
|
|
}
|