mirror of
https://sourceware.org/git/glibc.git
synced 2024-12-14 07:10:05 +00:00
* sysdeps/mips/fpu/fraiseexcpt.c (__feraiseexcept): Set cause bits.
* sysdeps/mips/fpu/fgetexcptflg.c (__fegetexceptflag): Add comment. * sysdeps/mips/fpu/fclrexcpt.c (__feclearexcept): Clear also cause bits. * sysdeps/mips/fpu/fenv_libc.h (CAUSE_MASK): New. (CAUSE_SHIFT): New.
This commit is contained in:
parent
5154198c0e
commit
ced0a621eb
@ -1,5 +1,5 @@
|
|||||||
/* Clear given exceptions in current floating-point environment.
|
/* Clear given exceptions in current floating-point environment.
|
||||||
Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
|
Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Andreas Jaeger <aj@suse.de>, 1998.
|
Contributed by Andreas Jaeger <aj@suse.de>, 1998.
|
||||||
|
|
||||||
@ -19,6 +19,7 @@
|
|||||||
02111-1307 USA. */
|
02111-1307 USA. */
|
||||||
|
|
||||||
#include <fenv.h>
|
#include <fenv.h>
|
||||||
|
#include <fenv_libc.h>
|
||||||
#include <fpu_control.h>
|
#include <fpu_control.h>
|
||||||
#include <shlib-compat.h>
|
#include <shlib-compat.h>
|
||||||
|
|
||||||
@ -33,8 +34,11 @@ __feclearexcept (int excepts)
|
|||||||
/* Read the complete control word. */
|
/* Read the complete control word. */
|
||||||
_FPU_GETCW (cw);
|
_FPU_GETCW (cw);
|
||||||
|
|
||||||
/* Clear exception bits. */
|
/* Clear exception flag bits and cause bits. If the cause bit is not
|
||||||
cw &= ~excepts;
|
cleared, the next CTC instruction (just below) will re-generate
|
||||||
|
the exception. */
|
||||||
|
|
||||||
|
cw &= ~(excepts | (excepts << CAUSE_SHIFT));
|
||||||
|
|
||||||
/* Put the new data in effect. */
|
/* Put the new data in effect. */
|
||||||
_FPU_SETCW (cw);
|
_FPU_SETCW (cw);
|
||||||
@ -42,6 +46,7 @@ __feclearexcept (int excepts)
|
|||||||
/* Success. */
|
/* Success. */
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
|
#if SHLIB_COMPAT (libm, GLIBC_2_1, GLIBC_2_2)
|
||||||
strong_alias (__feclearexcept, __old_feclearexcept)
|
strong_alias (__feclearexcept, __old_feclearexcept)
|
||||||
compat_symbol (libm, __old_feclearexcept, feclearexcept, GLIBC_2_1);
|
compat_symbol (libm, __old_feclearexcept, feclearexcept, GLIBC_2_1);
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 2000 Free Software Foundation, Inc.
|
/* Copyright (C) 2000, 2002 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Andreas Jaeger <aj@suse.de>.
|
Contributed by Andreas Jaeger <aj@suse.de>.
|
||||||
|
|
||||||
@ -20,10 +20,13 @@
|
|||||||
#ifndef _FENV_LIBC_H
|
#ifndef _FENV_LIBC_H
|
||||||
#define _FENV_LIBC_H 1
|
#define _FENV_LIBC_H 1
|
||||||
|
|
||||||
/* Mask for enabling exceptions. */
|
/* Mask for enabling exceptions and for the CAUSE bits. */
|
||||||
#define ENABLE_MASK 0xF80U
|
#define ENABLE_MASK 0x00F80U
|
||||||
|
#define CAUSE_MASK 0x1F000U
|
||||||
|
|
||||||
/* Shift for FE_* flags. */
|
/* Shift for FE_* flags to get up to the ENABLE bits and the CAUSE bits. */
|
||||||
#define ENABLE_SHIFT 5
|
#define ENABLE_SHIFT 5
|
||||||
|
#define CAUSE_SHIFT 10
|
||||||
|
|
||||||
|
|
||||||
#endif /* _FENV_LIBC_H */
|
#endif /* _FENV_LIBC_H */
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Store current representation for exceptions.
|
/* Store current representation for exceptions.
|
||||||
Copyright (C) 1998, 1999, 2000 Free Software Foundation, Inc.
|
Copyright (C) 1998, 1999, 2000, 2002 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Andreas Jaeger <aj@suse.de>, 1998.
|
Contributed by Andreas Jaeger <aj@suse.de>, 1998.
|
||||||
|
|
||||||
@ -30,6 +30,10 @@ __fegetexceptflag (fexcept_t *flagp, int excepts)
|
|||||||
/* Get the current exceptions. */
|
/* Get the current exceptions. */
|
||||||
_FPU_GETCW (temp);
|
_FPU_GETCW (temp);
|
||||||
|
|
||||||
|
/* It is important that the CAUSE bits are not saved here. If they
|
||||||
|
were, a call to fesetexceptflag() would generate an
|
||||||
|
exception. */
|
||||||
|
|
||||||
*flagp = temp & excepts & FE_ALL_EXCEPT;
|
*flagp = temp & excepts & FE_ALL_EXCEPT;
|
||||||
|
|
||||||
/* Success. */
|
/* Success. */
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
/* Raise given exceptions.
|
/* Raise given exceptions.
|
||||||
Copyright (C) 2000 Free Software Foundation, Inc.
|
Copyright (C) 2000, 2002 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Andreas Jaeger <aj@suse.de>, 2000.
|
Contributed by Andreas Jaeger <aj@suse.de>, 2000.
|
||||||
|
|
||||||
@ -19,6 +19,7 @@
|
|||||||
02111-1307 USA. */
|
02111-1307 USA. */
|
||||||
|
|
||||||
#include <fenv.h>
|
#include <fenv.h>
|
||||||
|
#include <fenv_libc.h>
|
||||||
#include <fpu_control.h>
|
#include <fpu_control.h>
|
||||||
#include <shlib-compat.h>
|
#include <shlib-compat.h>
|
||||||
|
|
||||||
@ -30,8 +31,13 @@ __feraiseexcept (int excepts)
|
|||||||
/* Get current state. */
|
/* Get current state. */
|
||||||
_FPU_GETCW (cw);
|
_FPU_GETCW (cw);
|
||||||
|
|
||||||
/* Set exceptions bits. */
|
/* Set flag bits (which are accumulative), and *also* set the cause
|
||||||
cw |= (excepts & FE_ALL_EXCEPT);
|
bits. The setting of the cause bits is what actually causes the
|
||||||
|
hardware to generate the exception, if the corresponding enable
|
||||||
|
bit is set as well. */
|
||||||
|
|
||||||
|
excepts &= FE_ALL_EXCEPT;
|
||||||
|
cw |= excepts | (excepts << CAUSE_SHIFT);
|
||||||
|
|
||||||
/* Set new state. */
|
/* Set new state. */
|
||||||
_FPU_SETCW (cw);
|
_FPU_SETCW (cw);
|
||||||
|
Loading…
Reference in New Issue
Block a user